测试Pulp安装失败

6 投票
2 回答
4151 浏览
提问于 2025-04-16 20:14

根据这个链接的说明,我通过“从源代码安装Windows版本”来安装了PuLP。

当我尝试在页面上运行测试时(页面上的说明是:“为了测试你的PuLP安装是否正常,请在Python解释器中输入以下内容,注意输出应该类似。下面的输出是你在没有安装其他求解器的情况下,使用PuLP自带的CoinMP求解器时应该看到的。”)

我的结果是:

import pulp
pulp.pulpTestAll()
求解器 pulp.solvers.CPLEX_DLL 不可用。
求解器 pulp.solvers.CPLEX_CMD 不可用。
求解器 pulp.solvers.COIN_CMD 不可用。
求解器 pulp.solvers.COINMP_DLL 不可用。
求解器 pulp.solvers.GLPK_CMD 不可用。
求解器 pulp.solvers.XPRESS 不可用。
求解器 pulp.solvers.GUROBI 不可用。

根据网页,这应该是我的输出:

import pulp
pulp.pulpTestAll()
求解器 pulp.pulp.COIN_MEM 不可用。
求解器 pulp.pulp.COIN_CMD 不可用。
测试连续线性规划解决方案
测试最大化连续线性规划解决方案
测试无界连续线性规划解决方案
测试混合整数规划解决方案
测试混合整数规划松弛
测试可行性问题(没有目标)
测试一个不可行的问题
测试一个整数不可行的问题(需要修复的错误)
测试基于列的建模
测试带有空约束的基于列的建模
测试对偶变量和松弛报告
测试问题的解决
测试顺序求解
测试分数约束
测试弹性约束(没有变化)
测试弹性约束(自由边界)
测试弹性约束(惩罚不变)
测试弹性约束(惩罚无界)
* 求解器 pulp.pulp.COINMP_DLL 通过测试。
求解器 pulp.pulp.GLPK_MEM 不可用。
求解器 pulp.pulp.GLPK_CMD 不可用。
求解器 pulp.pulp.XPRESS 不可用。

我使用的是Python 2.7.1,PuLP 1.4.7,操作系统是Windows 7 64位。

我猜是因为PuLP自带的CoinMP求解器没有正常工作。我刚开始学习Python一周,我在编程方面还是个新手。

2 个回答

-1

试着以管理员身份运行Python图形用户界面(GUI)

2

据我所知,你需要安装一个支持的求解器,比如

sudo aptitude install glpk

或者

sudo aptitude install coinor-libcbc0

我刚在(K)ubuntu 11.10上测试了这两个,得到了

Solver pulp.solvers.PULP_CBC_CMD unavailable.
Solver pulp.solvers.CPLEX_DLL unavailable.
Solver pulp.solvers.CPLEX_CMD unavailable.
     Testing zero subtraction
     Testing continuous LP solution
     Testing maximize continuous LP solution
     Testing unbounded continuous LP solution
     Testing Long Names
     Testing repeated Names
     Testing MIP solution
     Testing MIP relaxation
     Testing feasibility problem (no objective)
     Testing an infeasible problem
     Testing an integer infeasible problem
     Testing column based modelling
     Testing fractional constraints
     Testing elastic constraints (no change)
     Testing elastic constraints (freebound)
     Testing elastic constraints (penalty unchanged)
     Testing elastic constraints (penalty unbounded)
* Solver pulp.solvers.COIN_CMD passed.
Solver pulp.solvers.COINMP_DLL unavailable.
     Testing zero subtraction
     Testing continuous LP solution
     Testing maximize continuous LP solution
     Testing unbounded continuous LP solution
     Testing Long Names
     Testing repeated Names
     Testing MIP solution
     Testing MIP relaxation
     Testing feasibility problem (no objective)
     Testing an infeasible problem
     Testing an integer infeasible problem
     Testing column based modelling
     Testing fractional constraints
     Testing elastic constraints (no change)
     Testing elastic constraints (freebound)
     Testing elastic constraints (penalty unchanged)
     Testing elastic constraints (penalty unbounded)
* Solver pulp.solvers.GLPK_CMD passed.
Solver pulp.solvers.XPRESS unavailable.
Solver pulp.solvers.GUROBI unavailable.
Solver pulp.solvers.PYGLPK unavailable.
Solver pulp.solvers.YAPOSIB unavailable.

希望对你有帮助

撰写回答