OptimizationExpression
Arithmetic or functional expression in terms of optimization variables
Description
An OptimizationExpression
is an arithmetic or functional
expression in terms of optimization variables. Use an
OptimizationExpression
as an objective function, or as a part of
an inequality or equality in a constraint or equation.
Tip
For the full workflow, see Problem-Based Optimization Workflow or Problem-Based Workflow for Solving Equations.
Creation
Create an optimization expression by performing operations on OptimizationVariable
objects. Use standard MATLAB® arithmetic including taking powers, indexing, and concatenation
of optimization variables to create expressions. See Supported Operations for Optimization Variables and Expressions and Examples.
You can also create an optimization expression from a MATLAB function applied to optimization variables by using fcn2optimexpr
. For examples, see Create Expression from Nonlinear Function and Problem-Based Nonlinear Optimization.
Create an empty optimization expression by using optimexpr
.
Typically, you then fill the expression in a loop. For examples, see Create Optimization Expression by Looping and the optimexpr
function reference page.
After you create an expression, use it as either an objective function, or as part of
a constraint or equation. For examples, see the solve
function reference page.