如何使用pyomo加载*.sol文件 [英] How to use pyomo to load *.sol file

查看:60
本文介绍了如何使用pyomo加载*.sol文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用pyomo编写脚本,但使用外部求解器进行优化.

I use pyomo to write the script, but use external solver to do the optimization.

外部求解器返回一个 *.sol 文件.我的问题是pyomo或任何python包是否可以解码sol文件,并将决策变量结果传递给原始模型.因此,我们可以做一些事后分析.

The external solver return a *.sol file. My question is that if pyomo or any package of python can decode the sol file, and pass the decision variable result into the original model. Therefore, we can do some post analysis.

推荐答案

我想将此添加为评论,但我没有足够的声誉.

I wanted to add this as a comment but I dont have enough reputation.

我在使用 CPLEX 时遇到了类似的问题.请参阅这个问题.您必须基本上存储变量映射并在解析解决方案文件时使用它.就我而言,CPLEX 以 XML 格式提供解决方案,因此我使用了 XML 解析器.

I was facing a similar problem with CPLEX. See this question. You have to basically store the variable map and use it while parsing the solution file. In my case CPLEX gives solution in XML format, so I used XML parser.

希望这会有所帮助!

这篇关于如何使用pyomo加载*.sol文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆