首页 > 解决方案 > 如何让 GAMS 的求解器从 Pyomo 工作?

问题描述

我想运行一个用 pyomo 语言编写的模型,使用 cplex 解算器。但是我收到以下错误:

"No 'gams' command found on system PATH - GAMS shell"
NameError: No 'gams' command found on system PATH - GAMS shell solver 
functionality is not available. "

我已将文件夹 (C:\GAMS\win64\25.1) 添加到系统的环境变量中。Pyomo 版本是 5.6.5。Python 是 3.5.2。和 GAMS 是 25.1.2

如果您能为我提供帮助,我将不胜感激。

solvername = 'gams'
opt = SolverFactory(solvername)
results = opt.solve(
    instance, solver='cplex', keepfiles=True, tee=True)

标签: pythonoptimizationgams-math

解决方案


推荐阅读