CPLEX: CPXwritemipstarts without optimize!

Hi,

I would like to be able to save a model and its warm start as the solver got them when calling optimize!.

using JuMP
using CPLEX
m = Model(CPLEX.Optimizer);
direct_m = direct_model(CPLEX.Optimizer());
@variable(m, foo, Bin);
set_start_value(foo, 1);
MOI.copy_to(backend(direct_m), m);
backend_model = unsafe_backend(direct_m);
env = backend_model.env;
lp = backend_model.lp;
CPXwriteprob(env, lp, "CPLEX_model.mps", "MPS");
CPXwritemipstarts(env, lp, "CPLEX_mipstart.mst", 0, 0);

Writing the MPS works but not the MIP start: CPLEX Error 3020: No MIP start exists.

Julia packages:

  • CPLEX v1.0.3
  • JuMP v1.19.0

and CPLEX 22.1.1

I have no clue on how to extract the MIP start. Any idea?

Hi @remi-garcia

We add the mip starts inside optimize because the user might modify them at any point.

You’d need to do something similar to the code around here

1 Like

Thank you for pointing me in this direction, I’ll do some tests.

1 Like

This works great. Maybe it would be a nice thing to decompose optimize! into _load_model! _optimize! and read_optimize!?

In any case, it does what I wanted to do, which is actually not what I need… :sweat_smile:

Thanks again for the help

Whats the ultimate goal? Do you really just want a way to write mst files from JuMP?

I encounter a bug, solving a model leads to optimal in <1s on a computer and infeasible on another.

The ultimate goal is to be able to have the solver in the exact same state as before optimization to extract info from it, for replicability without julia.

But extracting MPS+MST or LP+MST is not sufficient as the constraints are exported and/or read in a different order (yes, the order of the constraints is actually very important as the model becomes feasible if I randomize their order with ShuffleContraints…)