Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# Linear Programming and Mixed-Integer Linear Programming

Solve linear programming problems with continuous and integer variables

See First Choose Problem-Based or Solver-Based Approach for choosing between problem-based optimization and solver-based optimization.

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 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 integer constraints, or use `linprog` when there are no integer constraints.

## Functions

expand all

 `evaluate` Evaluate optimization expression `findindex` Find numeric index equivalents of named index variables `infeasibility` Constraint violation at a point `prob2struct` Convert optimization problem to solver form `solve` Solve optimization problem
 `intlinprog` Mixed-integer linear programming (MILP) `linprog` Solve linear programming problems `mpsread` Read MPS file for LP and MILP optimization data

## Topics

### Problem-Based Mixed-Integer Linear Programming Applications

Mixed-Integer Linear Programming Basics: Problem-Based

Simple example of mixed-integer linear programming.

Factory, Warehouse, Sales Allocation Model: Problem-Based

This example shows how to set up and solve a mixed-integer linear programming problem.

Traveling Salesman Problem: Problem-Based

This example shows how to use binary integer programming to solve the classic traveling salesman problem.

Optimal Dispatch of Power Generators: Problem-Based

This example shows how to schedule two gas-fired electric generators optimally, meaning to get the most revenue minus cost.

Office Assignments by Binary Integer Programming: Problem-Based

This example shows how to solve an assignment problem by binary integer programming using the optimization problem approach.

Mixed-Integer Quadratic Programming Portfolio Optimization: Problem-Based

This example shows how to solve a Mixed-Integer Quadratic Programming (MIQP) portfolio optimization problem using the problem-based approach.

Cutting Stock Problem: Problem-Based

This example shows how to solve a cutting stock problem using linear programming with an integer linear programming subroutine.

Solve Sudoku Puzzles Via Integer Programming: Problem-Based

This example shows how to solve a Sudoku puzzle using binary integer programming.

### Solver-Based Mixed-Integer Linear Programming Applications

Mixed-Integer Linear Programming Basics: Solver-Based

Simple example of mixed-integer linear programming.

Factory, Warehouse, Sales Allocation Model: Solver-Based

Example of optimizing logistics in a small supply chain.

Traveling Salesman Problem: Solver-Based

The classic traveling salesman problem, with setup and solution.

Optimal Dispatch of Power Generators: Solver-Based

Example showing how to schedule power generation when there is a cost for activation.

Office Assignments by Binary Integer Programming: Solver-Based

Solve an assignment problem using binary integer programming.

Mixed-Integer Quadratic Programming Portfolio Optimization: Solver-Based

Example showing how to optimize a portfolio, a quadratic programming problem, with integer and other constraints.

Cutting Stock Problem: Solver-Based

Solve a cutting stock problem using linear programming with an integer programming subroutine.

Solve Sudoku Puzzles Via Integer Programming: Solver-Based

Sudoku is a type of puzzle that you can solve using integer linear programming.

### Problem-Based Linear Programming Applications

Set Up a Linear Program, Problem-Based

Linear problem formulation using the problem-based approach.

Maximize Long-Term Investments Using Linear Programming: Problem-Based

This example shows how to use the problem-based approach to solve an investment problem with deterministic returns over a fixed number of years `T`.

Create Multiperiod Inventory Model in Problem-Based Framework

This example shows how to create a multiperiod inventory model in the problem-based framework.

### Solver-Based Linear Programming Applications

Set Up a Linear Program, Solver-Based

Problem formulation using the solver-based approach.

Typical Linear Programming Problem

This example shows the solution of a typical linear programming problem.

Maximize Long-Term Investments Using Linear Programming: Solver-Based

Optimize a deterministic multiperiod investment problem using linear programming.

### Problem-Based Algorithms

Problem-Based Optimization Algorithms

How the optimization functions and objects solve optimization problems.

Supported Operations on Optimization Variables and Expressions

Lists all available mathematical and indexing operations on optimization variables and expressions.

### Solver-Based Algorithms and Options

Linear Programming Algorithms

Minimizing a linear objective function in n dimensions with only linear and bound constraints.

Mixed-Integer Linear Programming Algorithms

The algorithms used for solution of mixed-integer linear programs.

Optimization Options Reference

Describes optimization options.

Tuning Integer Linear Programming

Steps for improving solutions or solution time.

intlinprog Output Function and Plot Function Syntax

How to monitor the progress of the `intlinprog` solution process.

Watch now