There are two approaches to linear programming and mixed-integer linear programming. This section describes the problem-based approach. See Linear Programming and Mixed-Integer Linear Programming.
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
.
optimproblem | Create optimization problem |
optimvar | Create optimization variables |
showbounds | Display variable bounds |
showproblem | Display optimization problem |
showvar | Display optimization variable |
writebounds | Save description of variable bounds |
writeproblem | Save optimization problem description |
writevar | Save optimization variable description |
optimconstr | Create empty optimization constraint array |
optimexpr | Create empty optimization expression array |
showconstr | Display optimization constraint |
showexpr | Display optimization expression |
writeconstr | Save optimization constraint description |
writeexpr | Save optimization expression description |
evaluate | Evaluate optimization expression |
infeasibility | Constraint violation at a point |
prob2struct | Convert optimization problem to solver form |
solve | Solve optimization problem |
OptimizationConstraint | Optimization constraints |
OptimizationExpression | Objective function or constraints |
OptimizationProblem | Optimization problem |
OptimizationVariable | Variable for optimization |
Problem-based steps for solving optimization problems.
Expressions define both objective and constraints.
Named Index for Optimization Variables
How to create and work with named indices for variables.
Review or Modify Optimization Problems
Shows how to review or modify problem elements such as variables and constraints.
How to evaluate the solution and its quality.
Create Efficient Optimization Problems
Tips for obtaining a faster or more accurate solution when there are integer constraints, and for avoiding loops in problem creation.
Separate Optimization Model from Data
To create reusable, scalable problems, separate the model from the data.
Variables with Duplicate Names Disallowed
Solution to the problem of two optimization variables with the same name.
Expression Contains Inf or NaN
Optimization expressions containing Inf
or
NaN
cannot be displayed, and can cause unexpected
results.
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.
Solve Sudoku Puzzles Via Integer Programming: Problem-Based
This example shows how to solve a Sudoku puzzle using binary integer programming.
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.
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.