看起来很简单,但是如何将Pyomo指向本地安装的求解器呢?我能够从我本地的计算机上获得NEOS的解决方案,所以我知道这个模型是适当设计的。昨天,我在Azure Ubuntu虚拟机上安装了COIN-OR tarfile,并希望使用Jupyter在该虚拟机上运行我的模型。
这是我到目前为止所知道的:
solvername='ipopt'
solverpath_folder='~/COIN-OR/bin/'
solverpath_exe='~/COIN-OR/bin/ipopt'
solver=SolverFactory(solvername,executable=solverpath_exe)
instance = model.create_instance()
opt.solve(instance,solver) 错误消息:
WARNING: DEPRECATED: Cannot call Model.create_instance() on a constructed
model; returning a clone of the current model instance.
WARNING: Could not locate the 'ipopt' executable, which is required for solver
ipopt发布于 2019-06-18 00:47:02
要消除您看到的第一个警告,您在处理具体模型时不需要create_instance调用。
要解决第二个警告和您的问题,我们建议通过修改path环境变量将包含求解器可执行文件的目录添加到搜索路径中。如果您不想修改搜索路径,那么我可以尝试指定可执行文件的路径,而不使用~/作为指向主目录的快捷方式。
https://stackoverflow.com/questions/56597538
复制相似问题