$npx skillfedfor your agent

optlang

Formulate optimization problems using sympy expressions and solve them using interfaces to third-party optimization software (e.g. GLPK).

Worth itPyPI MathematicsReleased Jun 202683.2K downloads / moApache-2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — optlang-1.9.1-py2.py3-none-any.whl
v1.9.1 · released 2026-06-02 · Python >=3.9 · 2 runtime deps: swiglpk, sympy

Yes. Optlang is actively maintained, has low install friction, carries no known vulnerabilities, and offers a clean Pythonic API for optimization problems. It's a good fit if you need to formulate and solve LP/MILP/QP problems with solver flexibility. Install it if you're doing operations research, scientific computing, or constraint-based modeling in Python.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python >= 3.9; swiglpk (GLPK interface) installs by default but optional solvers (cplex, gurobipy, scipy, osqp) must be installed separately if needed.
  • Low friction: pure Python wheel with two runtime dependencies (sympy and swiglpk).
  • Actively maintained as of June 2026 with recent releases.

License · maintenance · safety

Apache-2.0 (permissive) — Apache-2.0 is permissive; you may use, modify, and distribute optlang freely in commercial or proprietary projects provided you include the license notice.

last release 2026-06-02 (73 days) · last repo commit 2026-06-02 · 271 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 83,241 downloads/mo, #14,089 on PyPI

Verify before relying

pip install optlang

from optlang import Model, Variable, Constraint, Objective

x1 = Variable('x1', lb=0)
x2 = Variable('x2', lb=0)
c1 = Constraint(x1 + x2, ub=100)
obj = Objective(10*x1 + 6*x2, direction='max')

model = Model()
model.objective = obj
model.add([c1])
status = model.optimize()
print(model.objective.value)
  • Whether the package handles numerical stability or precision guarantees for large-scale problems.
  • Performance characteristics when solving problems with thousands of variables or constraints.
  • Completeness of support for all GLPK solver features through the swiglpk interface.
Same gist for agents: .md · .json

What it is and what it does

Optlang is a Python library that lets you define linear, mixed-integer, and quadratic optimization problems using symbolic math expressions (via sympy), then solve them through a unified interface to multiple solver backends. Instead of writing problems in a solver-specific format, you declare variables with bounds, build constraints and objectives from symbolic expressions, combine them into a Model, and call optimize()—the same code can then switch between GLPK, CPLEX, Gurobi, or other solvers without rewriting the problem formulation.

The library is built on sympy for symbolic math and swiglpk for GLPK access by default, with optional support for commercial solvers (CPLEX, Gurobi) and open-source alternatives (scipy, osqp). It's actively maintained, supports Python 3.9–3.13, and carries no known security vulnerabilities. It's commonly used in scientific and operations research workflows where problem portability and clean problem definition matter.

Use it for

  • Define and solve linear programming problems (e.g., resource allocation, production planning) without learning solver-specific syntax.
  • Prototype optimization models in Python that can later be solved with different backends (GLPK, CPLEX, Gurobi) by changing one import.
  • Formulate mixed-integer programs for scheduling, routing, or combinatorial optimization using symbolic constraints.
  • Build quadratic programming solvers for portfolio optimization or least-squares problems via optional solvers.
  • Integrate optimization into scientific workflows where sympy expressions are already used for symbolic math.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

Optlang is actively maintained, has low install friction, carries no known vulnerabilities, and offers a clean Pythonic API for optimization problems. It's a good fit if you need to formulate and solve LP/MILP/QP problems with solver flexibility. Install it if you're doing operations research, scientific computing, or constraint-based modeling in Python.

Install

optlang on PyPI

Before you install

Low friction: pure Python wheel with two runtime dependencies (sympy and swiglpk). Actively maintained as of June 2026 with recent releases.

Requires Python >= 3.9; swiglpk (GLPK interface) installs by default but optional solvers (cplex, gurobipy, scipy, osqp) must be installed separately if needed.

License in practice

Apache-2.0 is permissive; you may use, modify, and distribute optlang freely in commercial or proprietary projects provided you include the license notice.

Quickstart

pip install optlang

from optlang import Model, Variable, Constraint, Objective

x1 = Variable('x1', lb=0)
x2 = Variable('x2', lb=0)
c1 = Constraint(x1 + x2, ub=100)
obj = Objective(10*x1 + 6*x2, direction='max')

model = Model()
model.objective = obj
model.add([c1])
status = model.optimize()
print(model.objective.value)

Verify before relying

  • Whether the package handles numerical stability or precision guarantees for large-scale problems.
  • Performance characteristics when solving problems with thousands of variables or constraints.
  • Completeness of support for all GLPK solver features through the swiglpk interface.

Package facts

LicenseApache-2.0 permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
swiglpksympy
MaintenanceActively maintained 73 days since the last release
Last repo commit
First released
Downloads83,241 / month, #14,089 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Mathematics

Evidence: optlang-1.9.1-py2.py3-none-any.whl

Tags

Capabilities
linear programming solver pythonmathematical optimization sympymixed integer programming interfacequadratic programming pythonoptimization problem formulationGLPK python wrapperconstraint optimization solver
Topics
optimizationlinear-programmingsymbolic-math
PyPI keywords
optimizationmathematical programmingheuristic optimizationsympy

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “mathematical optimization sympy”

  • optlangOptlang formulates and solves linear, mixed-integer, and quadratic…
  • sympySymPy is a Python library for symbolic mathematics, performing…
  • latex2sympy2Parses LaTeX math expressions and converts them to SymPy symbolic…

Give your agent the search over MCP, or paste the wish link into any chat.

More Mathematics packages

networkx Worth it
PyPI · Python Modules · released Dec 2025

NetworkX provides data structures and algorithms for creating, analyzing, and manipulating graphs and networks, supporting everything from simple undirected graphs to complex directed and weighted networks.

BSD-3-Clausepure Python
290.9Mdownloads / mo
kiwisolver Worth it
PyPI · Mathematics · released Mar 2026

kiwisolver is a Python binding to a fast C++ implementation of the Cassowary constraint solver, enabling you to solve systems of linear constraints and inequalities.

Install it if you need to solve constraint systems; skip it if you only need simple linear algebra.

BSD-3-Clausecompiled wheel · 3.10+
205.5Mdownloads / mo
sympy Worth it
PyPI · Scientific/Engineering · released Apr 2025

SymPy is a Python library for symbolic mathematics, performing algebraic manipulation, calculus, equation solving, and mathematical expression simplification without numerical approximation.

BSD-3-Clausepure Python · 3.9+
196.4Mdownloads / mo
contourpy Worth it
PyPI · Information Analysis · released Jul 2025

ContourPy calculates contours of 2D quadrilateral grids using C++11 algorithms wrapped in Python, offering serial and multithreaded implementations without requiring Matplotlib as a dependency.

BSD-3-Clausecompiled wheel · 3.11+
191.2Mdownloads / mo
torch With conditions
PyPI · Software Development · released Jul 2026

PyTorch provides GPU-accelerated tensor computation and automatic differentiation for building and training deep neural networks in Python.

Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND MITcompiled wheel · 3.10+
102.5Mdownloads / mo
onnxruntime Worth it
PyPI · Software Development · released Jul 2026

onnxruntime loads and executes Open Neural Network Exchange (ONNX) models with a focus on inference performance across CPUs and accelerators.

Install it if you have ONNX models to run in production or development.

MITcompiled wheel · 3.11+
89.3Mdownloads / mo

See also amplpy · docplex · optbinning · pysr · swiglpk · ortools · claripy · gekko · PuLP · xpresslibs