I'm dealing with a big optimization problem. Pyomo is used as a wrapper, xpress is used as a solver. Every run I save the values of variables in order to load these values into variables before solving the problem again. So I want to implement a warm start. The solver call looks like this:
opt = SolverFactory('xpress_direct')
results = opt.solve(model, warmstart=True, tee=True)
In the tee-log I see that the problem is solved from the beginning, and my assumptions about the initial values are not taken into account. I have two questions:
- How to interpret tee log (I didn't find details in the documentation);
- How to warm start if we saved the previous model and its variable values?
Here is a small code that illustrates how to use a warm start with the Xpress optimizer. Note that I am not an expert in Pyomo, so there may be better ways to implement the
create_modelfunction but for using warmstarts you should focus on the rest of the code anyway.In order to use a warmstart, you assign the warmstart value to each variable and call
solvewithwarmstart=True. The output log displayed viateewill then contain lines like these:The first line indicates that a warmstart solution was registered with the Xpress solver. The last two lines indicate that the warmstart solution was processed and accepted. A warmstart solution is reported as a solution from the 'U' heuristic in the log.
Note that processing of warmstart solutions may be delayed until after the initial LP solve, so it may take a while before they are reported in the log.