Documentation |
Mixed-integer linear programming (MILP)
Finds the minimum of a problem specified by
$$\underset{x}{\mathrm{min}}{f}^{T}x\text{subjectto}\{\begin{array}{l}x(\text{intcon})\text{areintegers}\hfill \\ A\cdot x\le b\hfill \\ Aeq\cdot x=beq\hfill \\ lb\le x\le ub.\hfill \end{array}$$
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) solves min f'*x such that the components of x in intcon are integers, and A*x ≤ b.
x = intlinprog(f,intcon,A,b,Aeq,beq) solves the problem above while additionally satisfying the equality constraints Aeq*x = beq. Set A = [] and b = [] if no inequalities exist.
x = intlinprog(f,intcon,A,b,Aeq,beq,lb,ub) defines a set of lower and upper bounds on the design variables, x, so that the solution is always in the range lb ≤ x ≤ ub. Set Aeq = [] and beq = [] if no equalities exist.
Often, some supposedly integer-valued components of the solution x(intCon) are not precisely integers. intlinprog deems as integers all solution values within the TolInteger tolerance of an integer.
To round all supposed integers to be exactly integers, use the round function.
x(intcon) = round(x(intcon));
Caution 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.