This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Problem-Based Optimization Setup

Solve linear, quadratic, or mixed-integer linear programming problems by creating an optimization problem.

There are two approaches to linear programming, quadratic programming, and mixed-integer linear programming. This section describes 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 examples, see Linear Programming and Mixed-Integer Linear Programming or Quadratic Programming.


expand all

optimproblemCreate optimization problem
optimvarCreate optimization variables
showboundsDisplay variable bounds
showproblemDisplay optimization problem
showvarDisplay optimization variable
writeboundsSave description of variable bounds
writeproblemSave optimization problem description
writevarSave optimization variable description
optimconstrCreate empty optimization constraint array
optimexprCreate empty optimization expression array
showconstrDisplay optimization constraint
showexprDisplay optimization expression
writeconstrSave optimization constraint description
writeexprSave optimization expression description
evaluateEvaluate optimization expression
findindexFind numeric index equivalents of named index variables
infeasibilityConstraint violation at a point
prob2structConvert optimization problem to solver form
solveSolve optimization problem


OptimizationConstraintOptimization constraints
OptimizationExpressionObjective function or constraints
OptimizationProblemOptimization problem
OptimizationVariableVariable for optimization


Problem-Based Steps

Problem-Based Workflow

Problem-based steps for solving optimization problems.

Optimization Expressions

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.

Examine Optimization Solution

How to evaluate the solution and its quality.

Tips for Problem-Based Optimization

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.

Create Initial Point for Optimization with Named Index Variables

This example shows how to create initial points for solve when you have named index variables by using the findindex function.

Expression Contains Inf or NaN

Optimization expressions containing Inf or NaN cannot be displayed, and can cause unexpected results.

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.