我通过康达安装了纸浆和GLPk
对于p.listSolvers(onlyAvailable=True)
,我看到gurobi和mosek安装为解算器:
Restricted license - for non-production use only - expires 2022-01-13
No parameters matching '_test' found
['GUROBI', 'MOSEK']
但是在执行.solve()时,我得到以下错误:
AttributeError Traceback (most recent call last)
<ipython-input-19-5a6ec0364643> in <module>
----> 1 m.solve()
~/anaconda3/anaconda3/envs/isye6669/lib/python3.8/site-packages/pulp/pulp.py in solve(self, solver, **kwargs)
1735 #time it
1736 self.solutionTime = -clock()
-> 1737 status = solver.actualSolve(self, **kwargs)
1738 self.solutionTime += clock()
1739 self.restoreObjective(wasNone, dummyVar)
AttributeError: 'NoneType' object has no attribute 'actualSolve'
pulp=2.4、python=3.8.8和glpk=4.65的版本
您需要提供要使用的解算器。如果不提供解算器作为m.solve()方法的参数,则pulp将使用默认值。在您的情况下,默认解算器不可用。尝试为solve方法提供GUROBI()或MOSEK()解算器,如下所述: https://coin-or.github.io/pulp/guides/how_to_configure_solvers.html
例如:
相关问题 更多 >
编程相关推荐