我有一台运行Linux的Docker机器。我正在使用Pyomo和GLPK求解器。我使用apt-get install glpk-utils
我将所有代码保存在子文件夹/code
我可以看到glpsol
安装在路径/usr/bin
我可以看到/usr/bin
是PATH环境变量下的路径。
我的相关进口如下:
from pyomo.environ import *
from pyomo.opt import SolverFactory
当我运行opt = SolverFactory("glpk")
时,我收到以下错误:
Attempting to use an unavailable solver.
The SolverFactory was unable to create the solver "glpk"
and returned an UnknownSolver object. This error is raised at the point
where the UnknownSolver object was used as if it were valid (by calling
method "solve").
The original solver was created with the following parameters:
type: glpk
_args: ()
options: {}
我不确定这是否与Docker相关,或者我是否应该为apt-get
使用不同的包。
我已经使用了所有最新版本。
非常感谢任何帮助。