Save Design Variable Values for Specific Iteration

This example shows how to save the design variable values for specific optimization iterations.

During optimization, the optimization solver simulates the model using a different set of design variables at each iteration. After the optimization completes, you can export the values for an iteration from the iteration plot of the design variable set.

For this example, load a preconfigured Response Optimization tool session. Optimize the model, and export the design variable set values for the third iteration.

Open the Simulink model and load the preconfigured Response Optimization tool session.

load('distillation_demo_sdosession_export_iter_dv.mat')
sdotool(SDOSessionData)

The Response Optimization tool opens and loads the preconfigured session. Iteration Plot 1 is configured to plot the values of DesignVars for each optimization iteration.

Click Optimize.

The optimization completes after four iterations.

Select the iteration plot of the design variable set.

Click Iteration plot 1.

Open the Save Iteration Data dialog box.

Right-click on the iteration plot, and select Save Iteration Data.

You can also access the Save Iteration Data dialog box from the Optimization Progress Report. To do so, in the progress report, click Save Iteration.

Specify details about the design variable data to save:

  • In the Data to save list, select DesignVars.

  • In Iteration(s) to save, enter 3.

    To specify multiple iterations, use a vector of integers. For example, [0 2 5].

  • In Save to a variable named, enter DesignVars_iter.

Export the design variable values set.

Click OK. The exported data variable, DesignVars_iter_3, appears in the Data area of the tool.

Note

The iteration number is added as a suffix to the saved data variable name.

Related Examples

More About