未知关键字 "mumps_mem_percent"

Unknown keyword "mumps_mem_percent"

我正在使用 Pyomo 对优化问题建模。如果我尝试设置 "mumps_mem_percent" 选项的值,我会收到错误消息。

opt = pyo.SolverFactory('ipopt')
opt.options['mumps_mem_percent'] = 10e3
opt.solve(mdl)

RROR:求解器 (ipopt) returned 非零 return 代码 (1) 错误:求解器日志:Ipopt 3.11.1:未知关键字 "mumps_mem_percent"

我是不是做错了什么?我检查了 IPOPT 的选项,我找到了这个选项。有什么建议

我认为您需要做的是创建一个 ipopt.opt 文件,指定所需的选项,并将其放在您的工作目录中。例如,对于你的情况,这样的事情可能有效(找到解决方案 here,但没有测试它):

with pyo.SolverFactory("ipopt") as opt:
    opt.options.option_file_name = "ipopt.opt"
    with open("ipopt.opt", "w") as f:
        f.write("mumps_mem_percent 10e3\n")
    opt.solve(mdl)

可在此处找到有关 IPOPT 选项文件的更多信息:https://coin-or.github.io/Ipopt/OPTIONS.html

另外,Github 上的某个人还提到,在您的选项中使用 "OF_" 前缀可能有效。