Forum Discussion
FICO
3 years agoCommunity Manager
Execute multiple runs without reloading the optimizer
Dear support, We would like to be able to run a large amount of optimization problems that are very similar among them. Ideally we would like to avoid loading the data, building the model, loading ...
FICO
3 years agoCommunity Manager
You cannot modify the problem from within a callback (that would potentially invalidate presolve and many other things).
Instead you should solve your problem and once the optimize() call returns you can modify the problem, for example via XPRSchgrhs(), XPRSchgmcoef() or XPRSchgobj(). Then you can optimize() the modified problem.
Some things to consider for this approach:
- You can stop optimization from within a callback by means of XPRSinterrupt().
- You can also use things like MIPRELSTOP,MIPABSSTOP, MAXMIPSOL, ... to stop the solution process before optimality is proven.
- If the optimize() call returns before proving optimality or infeasiblity, then your problem will be in a presolved state and you will have to call XPRSpostsolve() to get it back into the original state in which you can then modify it. Actually, in your scenario I suggest to just always call XPRSpostsolve() after optimize() returned (it will be a no-op if the problem is not in presolved state).
- You may want to transfer solutions from one problem to the other by means of XPRSaddmipsol(). Even if the old solution is (slighty) infeasible in the new problem, this may help Xpress to find a first feasible solution faster. Whether transferring solutions can help depends on your actual problem, so you will have to conduct performance experiments to assess whether this is useful or not in your case.

