Analysing solution (.sol) file in pyomo

后端 未结 1 719
攒了一身酷
攒了一身酷 2021-01-17 04:47

I have a model in pyomo in say machine 1 and I have the CPLEX solver in machine 2. I convert the pyomo model (ConcreteModel) into a problem.lp file

相关标签:
1条回答
  • 2021-01-17 05:45

    As given in the Edit 1 the symbol map is returned while writing the model to problem.lp. As given in line numbers 27-29 of this code, a tuple of variable names in the model and its reference variable can be obtained.

    Then, the XML file which the CPLEX generates (solution.sol) can be parsed in python using package like xml. Now we have the map and also the values. We just need to compare the reference variables and store its value into the variable with the name as that in the model.

    0 讨论(0)
提交回复
热议问题