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
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.