如何在纸浆,Python上添加GLPK求解器

时间:2018-08-16 09:25:37

标签: python pulp glpk

我想知道如何在纸浆python上逐步添加GLPK求解器。 我已经安装了python(v = 3.6.5),纸浆(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

1 个答案:

答案 0 :(得分:0)

对于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并进行构建和安装。