Pyomo在Docker机器上找不到GLPK求解器

时间:2018-03-11 20:21:58

标签: docker pyomo glpk

我有一台运行Linux的Docker机器。我正在使用Pyomo和GLPK求解器。我使用apt-get install glpk-utils

从Docker镜像的shell命令行安装了GLPK

我将所有代码保存在子文件夹/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使用不同的包。

我已经使用了所有最新版本。

非常感谢任何帮助。

0 个答案:

没有答案