微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

由于内存不足找不到GEKKOIPOPT解决方案?

如何解决由于内存不足找不到GEKKOIPOPT解决方案?

在使用时间序列数据以动态模式(m.options.imode = 4)模拟具有50个串联CSTR的化学反应器时,出现以下错误。稳态运行就好。而且,动态模拟似乎可以用于具有15个CSTR的简单模型。

是否有解决此问题的方法

MUMPS returned INFO(1) =-13 - out of memory when trying to allocate 219104583 bytes.
In some cases it helps to decrease the value of the option "mumps_mem_percent".
WARNING: Problem in step computation; switching to emergency mode.
   1r0.0000000e+000 2.87e+001 9.99e+002   1.5 0.00e+000    -  0.00e+000 0.00e+000R  1
MUMPS returned INFO(1) =-13 - out of memory when trying to allocate 219104583 bytes.
In some cases it helps to decrease the value of the option "mumps_mem_percent".
WARNING: Problem in step computation; switching to emergency mode.
Restoration phase is called at point that is almost feasible,with constraint violation 0.000000e+000. Abort.
Restoration phase in the restoration phase Failed.

Number of Iterations....: 1

                                   (scaled)                 (unscaled)
Objective...............:  0.0000000000000000e+000   0.0000000000000000e+000
Dual infeasibility......:  0.0000000000000000e+000   0.0000000000000000e+000
Constraint violation....:  2.8680600237259355e+001   2.8680600237259355e+001
Complementarity.........:  0.0000000000000000e+000   0.0000000000000000e+000
Overall NLP error.......:  2.8680600237259355e+001   2.8680600237259355e+001


Number of objective function evaluations             = 2
Number of objective gradient evaluations             = 2
Number of equality constraint evaluations            = 2
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 2
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 2
Total cpu secs in IPOPT (w/o function evaluations)   =      1.672
Total cpu secs in NLP function evaluations           =      4.237

EXIT: Restoration Failed!

 An error occured.
 The error code is  -2

解决方法

如果同时模式(IMODE=4)太大并且用完了内存,那么我建议您尝试使用(IMODE=7)进行连续模式。

from gekko import GEKKO
m = GEKKO(remote=False)
m.options.IMODE=7

# Your model

m.solve(disp=False)

切换到IMODE=7时的其他一些技巧:

  • 使用remote=False在计算机上而不是公共服务器上进行解决
  • 使用disp=False不显示求解器输出。打印语句会降低代码速度。

IMODE=4IMODE=7应该给出相同的结果,但是它们是不同的解决方法。在collocation materialDynamic Optimization course中查看同时模式。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。