Bach62 Bach62 - 1 month ago 5
C++ Question

Save CPLEX preprocessing/aggregation

I'm using the C++ CPLEX API to model MILP problems. CPLEX "simplifies" my models before solving them (i.e., via the aggregator, MILP presolve, substitutions, etc.). When I use the

method of the
class it only considers the original model.

Is it possible to save the reduced model?

Thank you for your help


It is not possible to do this using the C++ API (you don't have access to the presolve model via the object oriented Concert layers). You can do it programmatically with the C Callable Library or the Python API. Alternatively, you can do it manually with the interactive, like so:

CPLEX> read model.sav
CPLEX> write model.lp
CPLEX> write presolved.pre
CPLEX> read presolved.pre
CPLEX> write presolved.lp

This example assumes that you've exported your original model in SAV format. After following those steps, you'd end up with presolved.lp (the presolved model in LP format). If you wanted to do it programmatically (using one of the API's above), you'd follow the same steps.