tuning integer linear programming
change options to improve the solution process
note
often, you can change the formulation of a milp to make it more easily solvable. for suggestions on how to change your formulation, see williams [1].
after you run intlinprog
once, you might want to change some
options and rerun it. the changes you might want to see include:
lower run time
lower final objective function value (a better solution)
smaller final gap
more or different feasible points
here are general recommendations for option changes that are most likely to help the solution process. try the suggestions in this order:
for a faster and more accurate solution, increase the
cutmaxiterations
option from its default10
to a higher number such as25
. this can speed up the solution, but can also slow it.for a faster and more accurate solution, change the
cutgeneration
option to'intermediate'
or'advanced'
. this can speed up the solution, but can use much more memory, and can slow the solution.for a faster and more accurate solution, change the
integerpreprocess
option to'advanced'
. this can have a large effect on the solution process, either beneficial or not.for a faster and more accurate solution, change the
rootlpalgorithm
option to'primal-simplex'
. usually this change is not beneficial, but occasionally it can be.to try to find more or better feasible points, increase the
heuristicsmaxnodes
option from its default50
to a higher number such as100
.to try to find more or better feasible points, change the
heuristics
option to either'intermediate'
or'advanced'
.to try to find more or better feasible points, change the
branchrule
option to'strongpscost'
or, if that choice fails to improve the solution,'maxpscost'
.for a faster solution, increase the
objectiveimprovementthreshold
option from its default of zero to a positive value such as1e-4
. however, this change can causeintlinprog
to find fewer integer feasible points or a less accurate solution.to attempt to stop the solver more quickly, change the
relativegaptolerance
option to a higher value than the default1e-4
. similarly, to attempt to obtain a more accurate answer, change therelativegaptolerance
option to a lower value. these changes do not always improve results.
some “integer” solutions are not integers
often, some supposedly integer-valued components of the solution
x(intcon)
are not precisely integers.
intlinprog
considers as integers all solution values within
integertolerance
of an integer.
to round all supposed integers to be precisely integers, use the function.
x(intcon) = round(x(intcon));
caution
rounding can cause solutions to become infeasible. check feasibility after rounding:
max(a*x - b) % see if entries are not too positive, so have small infeasibility max(abs(aeq*x - beq)) % see if entries are near enough to zero max(x - ub) % positive entries are violated bounds max(lb - x) % positive entries are violated bounds
large components not integer valued
intlinprog
does not enforce that solution components be
integer valued when their absolute values exceed 2.1e9
. when your
solution has such components, intlinprog
warns you. if you
receive this warning, check the solution to see whether supposedly integer-valued
components of the solution are close to integers.
large coefficients disallowed
intlinprog
does not allow components of the problem, such as
coefficients in f
, a
, or
ub
, to exceed 1e15
in absolute value. if you
try to run intlinprog
with such a problem,
intlinprog
issues an error.
if you get this error, sometimes you can scale the problem to have smaller coefficients:
for coefficients in
f
that are too large, try multiplyingf
by a small positive scaling factor.for constraint coefficients that are too large, try multiplying all bounds and constraint matrices by the same small positive scaling factor.
references
[1] williams, h. paul. model building in mathematical programming, 5th edition. wiley, 2013.