我想知道如何在 PuLP ,python 上逐步添加 GLPK 求解器。
我已经安装了python(v=3.6.5)、pulp(v=1.6.8)。
当我执行 pulp.pulpTestAll()
时,我得到如下结果。
Testing zero subtraction
Testing inconsistant lp solution
Testing continuous LP solution
Testing maximize continuous LP solution
Testing unbounded continuous LP solution
Testing Long Names
Testing repeated Names
Testing zero constraint
Testing zero objective
Testing LpVariable (not LpAffineExpression) objective
Testing Long lines in LP
Testing LpAffineExpression divide
Testing MIP solution
Testing MIP solution with floats in objective
Testing MIP relaxation
Testing feasibility problem (no objective)
Testing an infeasible problem
Testing an integer infeasible problem
Testing column based modelling
Testing dual variables and slacks reporting
Testing fractional constraints
Testing elastic constraints (no change)
Testing elastic constraints (freebound)
Testing elastic constraints (penalty unchanged)
Testing elastic constraints (penalty unbounded)
* Solver <class 'pulp.solvers.PULP_CBC_CMD'> passed.
Solver <class 'pulp.solvers.CPLEX_DLL'> unavailable
Solver <class 'pulp.solvers.CPLEX_CMD'> unavailable
Solver <class 'pulp.solvers.CPLEX_PY'> unavailable
Solver <class 'pulp.solvers.COIN_CMD'> unavailable
Solver <class 'pulp.solvers.COINMP_DLL'> unavailable
Solver <class 'pulp.solvers.GLPK_CMD'> unavailable
Solver <class 'pulp.solvers.XPRESS'> unavailable
Solver <class 'pulp.solvers.GUROBI'> unavailable
Solver <class 'pulp.solvers.GUROBI_CMD'> unavailable
Solver <class 'pulp.solvers.PYGLPK'> unavailable
Solver <class 'pulp.solvers.YAPOSIB'> unavailable
最佳答案
对于 Debian/Ubuntu 系统,您只需要运行
sudo apt-get install glpk-utils
您可以通过键入来检查已安装的版本和安装路径
glpsol --version
和
which glpsol
对于 OSX,命令是使用 Homebrew 的 brew install glpk。
另一种解决方案是直接从官方网站 https://www.gnu.org/software/glpk/#downloading 下载 tarball 并构建和安装它。
关于python - 如何在 PuLP 、python 上添加 GLPK 求解器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51873735/