Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Mixed-integer linear programming (MILP)

Mixed-integer linear programming solver.

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*,

You can specify * f*, intcon,

`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,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));

**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.

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`

.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 5

`intlinprog`

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,options)`

`linprog`

| `mpsread`

| `optimoptions`

- Mixed-Integer Linear Programming Basics
- Factory, Warehouse, Sales Allocation Model
- Travelling Salesman Problem
- Solve Sudoku Puzzles Via Integer Programming
- Mixed-Integer Quadratic Programming Portfolio Optimization
- Optimal Dispatch of Power Generators
- Mixed-Integer Linear Programming Algorithms
- Tuning Integer Linear Programming
- Optimization Problem Setup

Was this topic helpful?