Linear Programming and Mixed-Integer Linear Programming - MATLAB & Simulink (original) (raw)

Main Content

Solve linear programming problems with continuous and integer variables

Before you begin to solve an optimization problem, you must choose the appropriate approach: problem-based or solver-based. For details, see First Choose Problem-Based or Solver-Based Approach.

For the problem-based approach, create problem variables, and then represent the objective function and constraints in terms of these symbolic variables. For the problem-based steps to take, see Problem-Based Optimization Workflow. To solve the resulting problem, use solve.

For the solver-based steps to take, including defining the objective function and constraints, and choosing the appropriate solver, see Solver-Based Optimization Problem Setup. To solve the resulting problem, use intlinprog when there are extended integer constraints, or use linprog when there are no integer constraints.

Functions

expand all

evaluate Evaluate optimization expression or objectives and constraints in problem
findindex Find numeric index equivalents of named index variables
infeasibility Constraint violation at a point
optimproblem Create optimization problem
optimvar Create optimization variables
prob2struct Convert optimization problem or equation problem to solver form
solve Solve optimization problem or equation problem
integerConstraint Indices of extended integer variables (Since R2025a)
intlinprog Mixed-integer linear programming (MILP)
linprog Solve linear programming problems
mpsread Read MPS file for LP and MILP optimization data

Objects

Live Editor Tasks

Optimize Optimize or solve equations in the Live Editor (Since R2020b)

Topics

Problem-Based Mixed-Integer Linear Programming

Solver-Based Mixed-Integer Linear Programming

Problem-Based Linear Programming

Solver-Based Linear Programming

Code Generation

Problem-Based Algorithms

Solver-Based Algorithms and Options