我目前正在阅读pyomo手册,学习如何使用Python和cplex/gurobi这样的解算器来解两阶段随机线性规划。但是我很难执行这个github(https://github.com/Pyomo/pyomo/tree/master/examples/pysp/farmer)中提供的具体模型
对于农民的问题,使用命令行:runph --model-directory=models --instance-directory=nodedata --default-rho=1
或pyomo solve --solver=cplex ReferenceModel.py AverageScenario.dat
。我的Python版本是3.5
,我在Annaconda中安装的cplex
版本是3.5
。你知道吗
错误消息是
ERROR: Unexpected exception while running model:
No executable found for solver 'cplex'
我的问题:如何通过命令行更改目录路径,以便它可以查找cplex
解算器?我正在使用Annaconda运行命令行!pyomo solve --solver=cplex ReferenceModel.py AverageScenario.dat
。包含我的ReferenceModel.py
和nodedata
的路径是:Users/[myname]/pyomo-master/models/ReferenceModel.py
。我已经把所有的数据文件放在了ReferenceModel.py
的同一个文件夹中,但是没有任何效果。你知道吗
从错误消息来看,pyomo似乎无法找到
cplex.exe
可执行文件。根据pyomo documentation:例如,要在控制台窗口中执行此操作(临时),您可以执行以下操作:
要永久设置路径环境变量,请参见here。你知道吗
相关问题 更多 >
编程相关推荐