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 Optimizer session. Optimize the model, and export the design variable set values for the third iteration.
Distillation Column Model
Open the distillation column model.
open_system('distillation_demo.slx')
Load Session
Load the preconfigured Response Optimizer session.
load('distillation_demo_sdosession_export_iter_dv.mat')
sdotool(SDOSessionData)
The Response Optimizer 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 app.
Note
The iteration number is added as a suffix to the saved data variable name.