Main Content

You can use Simulink^{®}
Design Optimization™ software with Parallel Computing Toolbox™ software to speed up the response optimization of a Simulink model. Using parallel computing may reduce model optimization time in
the following cases:

The model contains a large number of tuned parameters, and the

`Gradient descent`

method is selected for optimization.The

`Pattern search`

method is selected for optimization.The model contains a large number of uncertain parameters and uncertain parameter values.

The model is complex and takes a long time to simulate.

When you use parallel computing, the software distributes independent simulations
to run them in parallel on multiple MATLAB^{®} sessions, also known as *workers*. Distributing the
simulations significantly reduces the optimization time because the time required to
simulate the model dominates the total optimization time.

For information on how the software distributes the simulations and the expected speedup, see How Parallel Computing Speeds Up Optimization.

For information on configuring your system and using parallel computing, see Use Parallel Computing for Response Optimization.

You can enable parallel computing with the `Gradient descent`

and
`Pattern search`

optimization methods. When you enable parallel
computing, the software distributes independent simulations during optimization on
multiple MATLAB sessions. The following sections describe which simulations are
distributed and the potential speedup using parallel computing.

When you select `Gradient descent`

as the optimization
method, the model is simulated during the following computations:

Constraint and objective value computation — One simulation per iteration

Constraint and objective gradient computations — Two simulations for every tuned parameter per iteration

Line search computations — Multiple simulations per iteration

The total time, $$Ttotal$$, taken per iteration to perform these simulations is given by the following equation:

$$Ttotal=T+(Np\times 2\times T)+(Nls\times T)=T\times (1+(2\times Np)+Nls)$$

where $$T$$ is the time taken to simulate the model and is assumed to be equal for all simulations, $$Np$$ is the number of tuned parameters, and $$Nls$$ is the number of line searches. $$Nls$$ is difficult to estimate and you generally assume it to be equal to one, two, or three.

When you use parallel computing, the software distributes the simulations required for constraint and objective gradient computations. The simulation time taken per iteration when the gradient computations are performed in parallel, $$TtotalP$$, is approximately given by the following equation:

$$TtotalP=T+(ceil\left(\frac{Np}{Nw}\right)\times 2\times T)+(Nls\times T)=T\times (1+2\times ceil\left(\frac{Np}{Nw}\right)+Nls)$$

where $$Nw$$ is the number of MATLAB workers.

**Note**

The equation does not include the time overheads associated with configuring the system for parallel computing and loading Simulink software on the remote MATLAB workers.

The expected speedup for the total optimization time is given by the following equation:

$$\frac{TtotalP}{Ttotal}=\frac{1+2\times ceil\left(\frac{Np}{Nw}\right)+Nls}{1+(2\times Np)+Nls}$$

For example, for a model with `N`

,
_{p}=3`N`

, and
_{w}=4`N`

, the expected speedup
equals $$\frac{1+2\times ceil\left(\frac{3}{4}\right)+3}{1+(2\times 3)+3}=0.6$$._{ls}=3

For an example of the performance improvement achieved with the
`Gradient descent`

method, see Improving Optimization Performance Using Parallel Computing.

The `Pattern search`

optimization method uses search and poll
sets to create and compute a set of candidate solutions at each optimization
iteration.

The total time, $$Ttotal$$, taken per iteration to perform these simulations, is given by the following equation:

$$Ttotal=(T\times Np\times Nss)+(T\times Np\times Nps)=T\times Np\times (Nss+Nps)$$

where $$T$$ is the time taken to simulate the model and is assumed to be equal for all simulations, $$Np$$ is the number of tuned parameters, $$Nss$$ is a factor for the search set size, and $$Nps$$ is a factor for the poll set size. $$Nss$$ and $$Nps$$ are typically proportional to $$Np$$.

When you use parallel computing, Simulink
Design Optimization software distributes the simulations required for the search and
poll set computations, which are evaluated in separate `parfor`

(Parallel Computing Toolbox) loops. The simulation
time taken per iteration when the search and poll sets are computed in parallel, $$TtotalP$$, is given by the following equation:

$$\begin{array}{c}TtotalP=(T\times ceil(Np\times \frac{Nss}{Nw}))+(T\times ceil(Np\times \frac{Nps}{Nw}))\\ =T\times (ceil(Np\times \frac{Nss}{Nw})+ceil(Np\times \frac{Nps}{Nw}))\end{array}$$

where $$Nw$$ is the number of MATLAB workers.

**Note**

The equation does not include the time overheads associated with configuring the system for parallel computing and loading Simulink software on the remote MATLAB workers.

The expected speed up for the total optimization time is given by the following equation:

$$\frac{TtotalP}{Ttotal}=\frac{ceil(Np\times \frac{Nss}{Nw})+ceil(Np\times \frac{Nps}{Nw})}{Np\times (Nss+Nps)}$$

For example, for a model with `N`

,
_{p}=3`N`

,
_{w}=4`N`

, and
_{ss}=15`N`

, the expected speedup
equals $$\frac{ceil(3\times \frac{15}{4})+ceil(3\times \frac{2}{4})}{3\times (15+2)}=0.27$$._{ps}=2

**Note**

Using the `Pattern search`

method with parallel computing
may not speed up the optimization time. To learn more, see Why do I not see the optimization speedup I expected using parallel computing?

For an example of the performance improvement achieved with the
`Pattern search`

method, see Improving Optimization Performance Using Parallel Computing.