Mixed-integer linear programming (MILP)
Mixed-integer linear programming solver.
Finds the minimum of a problem specified by
f, x, intcon, b, beq, lb, and ub are vectors, and A and Aeq are matrices.
You can specify f, intcon, lb, and ub as vectors or arrays. See Matrix Arguments.
x = intlinprog(f,intcon,A,b)x = intlinprog(f,intcon,A,b,Aeq,beq)x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub)x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub,x0)x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub,x0,options)x = intlinprog(problem)[x,fval,exitflag,output]
= intlinprog(___)Often, some supposedly integer-valued components of
the solution x(intCon) are not precisely integers. intlinprog deems
as integers all solution values within IntegerTolerance of
an integer.
To round all supposed integers to be exactly integers, use the round function.
x(intcon) = round(x(intcon));
Rounding solutions can cause the solution 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
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.
intlinprog does not allow components
of the problem, such as coefficients in f, A,
or ub, to exceed 1e25 in absolute
value. If you try to run intlinprog with such
a problem, intlinprog issues an error.
Currently, you cannot run intlinprog in
the Optimization
app.
To specify binary variables, set the variables to be integers in intcon,
and give them lower bounds of 0 and upper bounds of
1.
Save memory by specifying sparse linear constraint
matrices A and Aeq. However,
you cannot use sparse matrices for b and beq.
If you include an x0 argument, intlinprog uses that value in heuristics. In particular, improvement heuristics such as rins and guided diving can start from x0 and attempt to improve the point. So setting the 'Heuristics' option to 'rins-diving' when you provide x0 can be effective. However, when the gap is small, heuristics do not run, so choosing 'rins-diving' does not always improve running time.
To provide logical indices for integer components,
meaning a binary vector with 1 indicating an integer,
convert to intcon form using find.
For example,
logicalindices = [1,0,0,1,1,0,0]; intcon = find(logicalindices)
intcon =
1 4 5intlinprog replaces bintprog.
To update old bintprog code to use intlinprog,
make the following changes:
Set intcon to 1:numVars, where
numVars is the number of variables in
your problem.
Set lb to zeros(numVars,1).
Set ub to ones(numVars,1).
Update any relevant options. Use optimoptions to
create options for intlinprog.
Change your call to bintprog as
follows:
[x,fval,exitflag,output] = bintprog(f,A,b,Aeq,Beq,x0,options)
% Change your call to:
[x,fval,exitflag,output] = intlinprog(f,intcon,A,b,Aeq,Beq,lb,ub,x0,options)linprog | mpsread | optimoptions