How the Optimization Algorithm Formulates Minimization Problems
When you optimize parameters of a Simulink® model to meet design requirements, Simulink Design Optimization™ software automatically converts the requirements into a constrained optimization problem and then solves the problem using optimization techniques. The constrained optimization problem iteratively simulates the Simulink model, compares the results of the simulations with the constraint objectives, and uses optimization methods to adjust tuned parameters to better meet the objectives.
This topic describes how the software formulates the constrained optimization problem used by the optimization algorithms. For each optimization algorithm, the software formulates one of the following types of minimization problems:
Mixed feasibility and tracking
For more information on how each optimization algorithm formulates these problems, see:
Feasibility Problem and Constraint Formulation
Feasibility means that the optimization algorithm finds parameter values that satisfy all constraints to within specified tolerances but does not minimize any objective or cost function in doing so.
In the following figure, x1, x3, and xn represent a combination of parameter values P1 and P2 and are feasible solutions because they do not violate the lower bound constraint.
In a Simulink model, you constrain a signal by specifying
lower and upper bounds in a Check block (Check
Step Response Characteristics, ...) or a requirement object
(sdo.requirements.StepResponseEnvelope
,
...), as shown in the following figure.
These constraints are piecewise linear bounds. A piecewise linear bound ybnd with n edges can be represented as:
The software computes the signed distance between the simulated response and the edge. The signed distance for lower bounds is:
where ysim is the simulated response and is a function of the parameters being optimized.
The signed distance for upper bounds is:
At the command line, optimFcn supplies
c
directly from the Cleq
field of
vals
.
If all the constraints are met (c ≤ 0) for some combination of parameter values, then that solution is said to be feasible. In the following figure, x1 and x3 are feasible solutions.
When your model has multiple requirements or vector signals feeding a requirement, the constraint vector is extended with the constraint violations for each signal and bound:
Tracking Problem
In addition to lower and upper bounds, you can specify a reference
signal in a Check Against Reference block
or sdo.requirements.SignalTracking
object,
which the Simulink model output can track. The tracking objective
is a sum-squared-error tracking objective.
You specify the reference signal as a sequence of time-amplitude pairs:
The software computes the simulated response as a sequence of time-amplitude pairs:
where some values of tsim may match the values of tref.
A new time base, tnew, is formed from the union of the elements of tref and tsim. Elements that are not within the minimum-maximum range of both tref and tsim are omitted:
Using linear interpolation, the software computes the values of yref and ysim at the time points in tnew and then computes the scaled error:
Finally, the software computes the weighted, integral square error:
Note
The weight w(t) is 1 by default. You can specify a different value of weight only at the command line.
When your model has requirements or vector signals feeding a requirement, the tracking objective equals the sum of the individual tracking integral errors for each signal:
Gradient Descent Method Problem Formulations
The Gradient Descent method uses the function fmincon
to optimize model parameters to
meet design requirements.
Problem Type | Problem Formulation |
---|---|
Feasibility Problem | The software formulates the constraint C(x) as described in Feasibility Problem and Constraint Formulation.
|
Tracking Problem |
The software formulates the tracking objective F(x) as described in Tracking Problem and minimizes the tracking objective:
|
Mixed Feasibility and Tracking Problem | The software minimizes following problem formulation: Note When tracking a reference signal, the software ignores the maximally feasible solution option.
|
Simplex Search Method Problem Formulations
The Simplex Search method uses the function fminsearch
and fminbnd
to optimize model
parameters to meet design requirements. fminbnd
is used if one
scalar parameter is being optimized, otherwise fminsearch
is
used. You cannot use parameter bounds with fminsearch
.
Problem Type | Problem Formulation |
---|---|
Feasibility Problem | The software formulates the constraint C(x) as described in Feasibility Problem and Constraint Formulation and then minimizes the maximum constraint violation: |
Tracking Problem |
The software formulates the tracking objective F(x) as described in Tracking Problem and then minimizes the tracking objective:
|
Mixed Feasibility and Tracking Problem | The software formulates the problem in two steps:
|
Pattern Search Method Problem Formulations
The Pattern Search method uses the function patternsearch
(Global Optimization Toolbox) to optimize model parameters
to meet design requirements.
Problem Type | Problem Formulation |
---|---|
Feasibility Problem | The software formulates the constraint C(x) as described in Feasibility Problem and Constraint Formulation and then minimizes the maximum constraint violation: |
Tracking Problem |
The software formulates the tracking objective F(x) as described in Tracking Problem and then minimizes the tracking objective:
|
Mixed Feasibility and Tracking Problem |
The software formulates the problem in two steps:
|
Gradient Computations
For the Gradient descent
(fmincon
) optimization solver, the gradients
are computed using numerical perturbation:
x is a scalar design variable.
xmin is the lower bound of x.
xmax is the upper bound of x.
xtypical is the scaled value of x.
opt_fcn is the objective function.
dx is relatively large to accommodate simulation solver tolerances.
If you want to compute the gradients in any other way, you can
do so in the cost function you write for performing design optimization
programmatically. See sdo.optimize
and GradFcn
of sdo.OptimizeOptions
for
more information.