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 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, x_{1}, x_{3}, and x_{n} represent a combination of parameter values P_{1} and P_{2} 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 y_{bnd} with n edges can be represented as:
$${y}_{bnd}(t)=\{\begin{array}{cc}{y}_{1}(t)& {t}_{1}\le t\le {t}_{2}\\ {y}_{2}(t)& {t}_{2}\le t\le {t}_{3}\\ \vdots & \vdots \\ {y}_{n}(t)& {t}_{n}\le t\le {t}_{n+1}\end{array},$$
The software computes the signed distance between the simulated response and the edge. The signed distance for lower bounds is:
$$\begin{array}{l}c=\left[\begin{array}{l}\underset{{t}_{1}\le t\le {t}_{2}}{\mathrm{max}}{y}_{bnd}{y}_{sim}\\ \underset{{t}_{2}\le t\le {t}_{3}}{\mathrm{max}}\text{}{y}_{bnd}{y}_{sim}\\ \underset{{t}_{n}\le t\le {t}_{n+1}}{\mathrm{max}}{y}_{bnd}{y}_{sim}\end{array}\right],\\ \end{array}$$
where y_{sim} is the simulated response and is a function of the parameters being optimized.
The signed distance for upper bounds is:
$$c=\left[\begin{array}{c}\underset{{t}_{1}\le t\le {t}_{2}}{\mathrm{max}}{y}_{sim}{y}_{bnd}\\ \underset{{t}_{2}\le t\le {t}_{3}}{\mathrm{max}}{y}_{sim}{y}_{bnd}\\ \underset{{t}_{n}\le t\le {t}_{n+1}}{\mathrm{max}}{y}_{sim}{y}_{bnd}\end{array}\right].$$
At the command line, opt_fcn
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, x_{1} and x_{3} 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:
$$C=\left[{c}_{1};{c}_{2};\cdots ;{c}_{n}\right].$$
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 sumsquarederror tracking objective.
You specify the reference signal as a sequence of timeamplitude pairs:
$${y}_{ref}({t}_{ref}),{t}_{ref}\in \{{T}_{ref0},{T}_{ref1},\cdots ,{T}_{refN}\}.$$
The software computes the simulated response as a sequence of timeamplitude pairs:
$${y}_{sim}({t}_{sim}),{t}_{sim}\in \{{T}_{sim0},{T}_{sim1},\cdots ,{T}_{simN}\},$$
where some values of t_{sim} may match the values of t_{ref}.
A new time base, t_{new}, is formed from the union of the elements of t_{ref} and t_{sim}. Elements that are not within the minimummaximum range of both t_{ref} and t_{sim} are omitted:
$${t}_{new}=\{t:{t}_{sim}\cup {t}_{ref}\}$$
Using linear interpolation, the software computes the values of y_{ref} and y_{sim} at the time points in t_{new} and then computes the scaled error:
$$e({t}_{new})=\frac{\left({y}_{sim}({t}_{new}){y}_{ref}({t}_{new})\right)}{\underset{{t}_{new}}{\mathrm{max}}\left{y}_{ref}\right}.$$
Finally, the software computes the weighted, integral square error:
$$f={\displaystyle \int w\left(t\right)e{(t)}^{2}dt}.$$
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:
$$F={\displaystyle \sum {f}_{i}}.$$
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:
$$\begin{array}{l}\underset{x}{\mathrm{min}}\text{}F(x)\\ s.t.\text{}\underset{\xaf}{x}\le x\le \overline{x}\text{}\end{array}$$

Mixed Feasibility and Tracking Problem  The software minimizes following problem formulation: $$\begin{array}{l}\underset{x}{\mathrm{min}}\text{}F(x)\\ s.t.\text{}C(x)\le 0\\ \text{}\underset{\xaf}{x}\le x\le \overline{x}\end{array}$$ Note When tracking a reference signal, the software ignores the maximally feasible solution option.

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 $$\underset{\xaf}{x}\le x\le \overline{x}$$ 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: $$\underset{x}{\mathrm{min}}\text{max}\left(C\left(x\right)\right)$$ 
Tracking Problem 
The software formulates the tracking objective F(x) as described in Tracking Problem and then minimizes the tracking objective:
$$\underset{x}{\mathrm{min}}\text{}F(x)$$

Mixed Feasibility and Tracking Problem  The software formulates the problem in two steps:

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: $$\begin{array}{l}\underset{x}{\mathrm{min}}\text{max}\left(C\left(x\right)\right)\\ s.t.\text{}\underset{\xaf}{x}\le x\le \overline{x}\end{array}$$ 
Tracking Problem 
The software formulates the tracking objective F(x) as described in Tracking Problem and then minimizes the tracking objective:
$$\begin{array}{l}\underset{x}{\mathrm{min}}\text{}F(x)\\ s.t.\text{}\underset{\xaf}{x}\le x\le \overline{x}\end{array}$$

Mixed Feasibility and Tracking Problem 
The software formulates the problem in two steps:

For the Gradient descent
(fmincon
) optimization solver, the gradients
are computed using numerical perturbation:
$$\begin{array}{l}dx=\sqrt[3]{eps}\times \mathrm{max}\left(\leftx\right,\frac{1}{10}{x}_{typical}\right)\\ dL=\mathrm{max}\left(xdx,{x}_{\mathrm{min}}\right)\\ dR=\mathrm{min}\left(x+dx,{x}_{\mathrm{max}}\right)\\ {F}_{L}=opt\_fcn(dL)\\ {F}_{R}=opt\_fcn(dR)\\ \frac{dF}{dx}=\frac{\left({F}_{L}{F}_{R}\right)}{\left(dLdR\right)}\\ \end{array}$$
x is a scalar design variable.
x_{min} is the lower bound of x.
x_{max} is the upper bound of x.
x_{typical} 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.