2

I am using warm start in DoCplex. In the warm start, my intention is to use a subset of the decision variables from the previous model that resulted in non-empty values. For example, if I have decision binary variables, x_1,...,x_5 and the solution in the first model is x_1=1,x_2=1, and the rest is zero. So, in the warm start, I only want to have decision variables x_1 and x_2. In this way, I can reduce the dimension of the model and have a faster performance. Considering I have thousands of decision variables, how can I choose a subset of these variables in the warm start?

Nari90
  • 23
  • 2
  • Just have something like a loop over all your variables and add those that had non-zero values in your previous solution into the warm-start with their values from the previous solution. If you want to reduce that set even further just add extra criteria e.g. based on your problem structure, so for example only include variables and values in your warm start that represent the start times of activities, or which vehicle does each delivery, or which room a class is taught in, or whatever. – TimChippingtonDerrick Aug 06 '21 at 06:27

1 Answers1

0

A Docplex solution can be exported to a MIP start file (MST format), with a write_level parameter. This optional parameter is an enumerated value from the docplex.mp.constants/WriteLevel class.

This enum has four values implementing the cartesian product of two flags:

  • keep only discrete variables or keep all
  • keep zero values or all values

In particular: value WriteLevel.DiscreteNonZeroVars saves as MST only discrete variables with non-zero values. The code for this is:

sol = mdl.solve
mst1 = sol.export_as_mst(write_level=WriteLevel.DiscreteNonZeroVars)

Note that passing 4 (the enum numeric value) will also work, although less readable.

If none of these options fit your needs, you can always build a MST solution with custom code, as Tim suggested.

Philippe Couronne
  • 826
  • 1
  • 5
  • 6