{"library":"passagemath-glpk","title":"passagemath-glpk","description":"passagemath-glpk provides a linear and mixed integer linear optimization backend using GLPK (GNU Linear Programming Kit) for the passagemath library. It enables the construction and solution of linear programming (LP) and mixed-integer linear programming (MILP) problems. Version 10.8.4 supports Python >=3.11,<3.15. The package is part of the passagemath ecosystem, which reimplements functionality previously provided by SageMath.","language":"python","status":"active","last_verified":"Mon Apr 27","install":{"commands":["pip install passagemath-glpk"],"cli":null},"imports":["from passagemath.glpk.backend import GLPKBackend","from passagemath.numerical.mip import MixedIntegerLinearProgram","from passagemath.glpk.backend import GLPKBackend"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from passagemath.numerical.mip import MixedIntegerLinearProgram\n\n# Create MILP instance with GLPK backend\np = MixedIntegerLinearProgram(solver='GLPK')\n\n# Define variables\nx = p['x']\ny = p['y']\n\n# Add constraints\np.add_constraint(x + 2*y <= 4)\np.add_constraint(2*x + y <= 6)\n\n# Set objective\np.set_objective(3*x + 4*y)\n\n# Solve\np.solve()\n\n# Get solution\nprint(f\"x = {p.get_values(x)}\")\nprint(f\"y = {p.get_values(y)}\")","lang":"python","description":"Quickstart example: solve a simple MILP using GLPK backend.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}