Pyomo:错误:运行模型时出现意外异常:索引错误

2024-05-20 01:06:53 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我正在用Pycharm在Pyomo开发一个模型。当我在Pycharm中运行模型(测试语法是否正确等)时,如果我使用“pyomo solve--solver=glpk--stream solver--summary”通过cmd运行它,我不会出现任何错误模型.py“我得到以下输出

[    0.00] Setting up Pyomo environment
[    0.00] Applying Pyomo preprocessing actions
[    0.47] Creating model
[    0.47] Applying solver
GLPSOL: GLPK LP/MIP Solver, v4.57
Parameter(s) specified in the command line:
 --write C:\Users\Usuario\PycharmProjects\untitled\tmpppxfx743.glpk.raw --wglp
 C:\Users\Usuario\PycharmProjects\untitled\tmpsykfeh2b.glpk.glp --cpxlp C:\Users\Usuario\PycharmProjects\untitled\tmp9ogdtp4l.pyomo.lp
Reading problem data from 'C:\Users\Usuario\PycharmProjects\untitled\tmp9ogdtp4l.pyomo.lp'...
C:\Users\Usuario\PycharmProjects\untitled\tmp9ogdtp4l.pyomo.lp:42834: warning: lower bound of variable 'x2017' redefined
C:\Users\Usuario\PycharmProjects\untitled\tmp9ogdtp4l.pyomo.lp:42834: warning: upper bound of variable 'x2017' redefined
7105 rows, 2953 columns, 18462 non-zeros
936 integer variables, all of which are binary
43770 lines were read
Writing problem data to 'C:\Users\Usuario\PycharmProjects\untitled\tmpsykfeh2b.glpk.glp'...
36501 lines were written
GLPK Integer Optimizer, v4.57
7105 rows, 2953 columns, 18462 non-zeros
936 integer variables, all of which are binary
Preprocessing...
LP RELAXATION HAS NO DUAL FEASIBLE SOLUTION
Time used:   0.0 secs
Memory used: 4.3 Mb (4478268 bytes)
Writing MIP solution to 'C:\Users\Usuario\PycharmProjects\untitled\tmpppxfx743.glpk.raw'...
10060 lines were written

[    0.93] Processing results
    Number of solutions: 0
    Solver results file: results.yml

==========================================================
Solution Summary
==========================================================
[    0.93] Pyomo Finished

**ERROR: Unexpected exception while running model:
        list index out of range**

有人知道会是什么情况吗?我不确定它是否是不可行的(在输出中是怎么说的),因为错误消息不适合这种问题。在

谢谢你的帮助!在


Tags: of模型usersresultspyomolinessolverlp