| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Model-Based Calibration |
| Contents | Index |
| Learn more about Model-Based Calibration |
| On this page… |
|---|
In this optimization you will construct a search for values of spark that maximize values of torque while minimizing values of NOX at a series of (L, N, A, E) points.
To create your optimization,
Select Tools > Create Optimization From Model (or use the toolbar button).
The Create Optimization From Model Wizard appears.
Select TQ_Model as the first model you want to optimize.

Click Next.
On this page of the wizard you select the optimization settings.
Select NBI for the Algorithm. You must use the NBI algorithm to solve multiobjective optimizations.
Select Maximize for the Objective type.
Clear the check boxes for all the Free variables except SPK.

Click Finish to create the optimization.
You see the CAGE Browser Optimization view. A new branch named TQ_Model_Optimization_1 appears in the Optimization tree.
You need to set up your second objective. In the Objectives pane you see a status message informing you that you need to specify a model for the second objective.
Double-click Objective2 to edit the objective.
Edit the Objective name to NOX, and specify NOXFLOW_Model and Minimize.

Import the NOX constraint from your previous optimization.
Right-click in the Constraints pane and select Import constraint.
In the Import Constraints dialog box, select the NOX constraint from your previous optimization and click OK.
Your CAGE browser should look like the following example.

Your optimization has objectives and a constraint set up and is ready to run. However unless you edit the fixed variable values it will run at a single point, the set point of the variables.
In the Optimization Point Set pane, increase the Number of runs to 6. Notice 6 rows appear in both fixed and free variable values panes, all containing the default set point values of each variable.
Select Optimization > Import From Output. The Import From Output dialog box appears.
Select the previous single objective optimization node, TQ_Model_Optimization_Output, in the top list to import values from this optimization.
Clear the check boxes for SPK, A, and E, to leave only N and L selected for import, and click OK.
View these values in the N and L columns in the Fixed Variables pane.

Click Run Optimization (
) in the toolbar.
The optimization runs, showing progress messages as each point is evaluated until the optimization is complete. A new node, TQ_Model_Optimization_1_Output, appears under TQ_Model_Optimization_1 in the Optimization tree.
The view switches to the TQ_Model_Optimization_1_Output node in the Optimization tree where you can examine the optimization output.
The toolbar buttons determine which view is displayed. The default
is the Solution Slice (
). The Solution
Slice shows one solution at all operating points. That is, you can
see a table (and surface plot) of all operating points at once, and
you can scroll through the solutions using the Solution buttons
at the top. At the start all 6 operating points show solution 1. Change
solution to 2, and you see the second solution for all 6 operating
points, and so on. As this is a multiobjective optimization, there
are several solutions for each operating point.

The graphs show the objective functions at the currently selected operating point (highlighted in the table and Results Surface view), with the solution value shown in red.
Note that before you run an optimization you can specify how many solutions you want the optimization to find, using the Set Up and Run Optimization toolbar button.
For an example point, click in the table to select operating point 6, and enter 10 in the Solution edit box. Observe the constraint you applied in the objective function graphs, as shown in the example. Areas in yellow are excluded by constraints. Similarly, if you use a boundary constraint model exported from the Model Browser as a constraint, areas outside the boundary appear in optimization graphs as yellow areas. Note that for some problems the optimization might fail to find a value within the constraints (depending on the constraints and starting values) in which case you might need to run the optimization again to find valid solutions. Choosing more suitable starting values and changing your settings to make constraints less stringent can help in these cases. See Analyzing Point Optimization Output in the CAGE User's Guide documentation.

Right-click the Objective Graphs view and select Split View > Pareto Graphs.

The view splits to show both objective and pareto graphs. You can right-click and select Graph Size to adjust how many plots can be displayed. In the Pareto Graphs view you can see all solutions found by the optimization at the selected operating point (the selected solution is highlighted in red). Try clicking different points in the pareto graph to see the different solutions in the objective graphs.
Click Pareto Slice (
) in the toolbar.
This changes the table to display all solutions at a single operating
point. You can scroll through the operating points using the Run buttons
at the top. The pareto graphs always show the currently selected solution
in red. Click in the table or the graph to select different solutions.
Recall that the first example, a single-objective optimization, produced a single solution at each point, so you could not view the Pareto Slice. The Pareto Slice is useful to show you the set of optimal tradeoff solutions when using multiobjective optimizations, as in this case. You can use these plots to help you select the best solution for each operating point. As you can see, this example trades off NOX emissions for torque, so it is a judgment call to choose the best depending on your priorities. You will select best solutions in a later section, Selecting Best Solutions.
Click Weighted Pareto Slice (
) in the toolbar.

This table view displays a weighted sum objective output across all operating points for each solution.
The value in the NOXFLOW_Model column in the first row shows the weighted sum of the solution 1 values of NOX across all 6 operating points. The second row shows the weighted sum of solution 2 NOX values across all 6 operating points, and so on. This can be useful, for example, for evaluating total emissions across a drive cycle. The default weights are unity (1) for each operating point.
You can alter these weights by clicking
Edit Pareto Weights (
) in
the toolbar. The Pareto Weights Editor appears.

Here you can select models, and select weights for any operating point, by clicking and editing, as shown in the example above. The same weights are applied to each solution to calculate the weighted sums. Click OK to apply new weights, and the weighted sums are recalculated.
You can also specify weights with a MATLAB vector or any column in your optimization output by selecting the other radio buttons. If you select Output column you can also specify which solution; for example you could choose to use the values of spark from solution 5 at each operating point as weights. Click Table Entry again, and you can then view and edit these new values.
In a multiobjective optimization, there is more than one possible optimal solution at each operating point. You can export all solutions, or you can select a solution for each point. You can use the Selected Solution Slice to collect and export those solutions you have decided are optimal at each operating point.
Once you have enabled the Selected Solution Slice, you can use the plots in the Pareto Slice and Solution Slice to help you select best solutions for each operating point. These solutions are saved in the Selected Solution Slice. You can then export your chosen optimization output for each point from the Selected Solution Slice, or use your chosen optimization output to fill tables.
In order to choose a single solution at each operating point, you need to enable the Selected Solution Slice. Select Solution > Selected Solution > Initialize.
A dialog called Initialize Selected Solution appears. Click OK.

The default initializes the first solution for each operating point as the selected solution.
Click the Selected Solution Slice button (
) which is now enabled in the
toolbar. Observe that the Solution number at
the top is not editable, and is initially solution 1 for
each operating point you click in the table. You must select the solutions
you want using the Pareto Slice and Solution Slice to decide which
solution is best for each point.

Return to the Pareto Slice and select a solution for run 6. Enter 6 in the Run edit box, and click in the table or in the pareto graphs to select a solution. An example is shown with solution 7 highlighted. To select this solution as best, do one of the following:
Click Select Solution (
) in the toolbar.
Select the menu item Solution > Selected Solution > Select Current Solution.

If you return to the Selected Solution Slice you can now see that solution 7 is now present for operating point 6, while all the other operating points remain at the initial solution 1. This view collects all your selected solutions together in one place. For example, you might want to select solution 7 for the first operating point, and solution 6 best for the second, and so on.
In order to use one solution per point from your optimization output to fill tables, you should repeat this process to select a suitable solution for all operating points. Then use the Table Filling From Optimization Results Wizard (Solution > Fill Tables) as before — the table is filled with your selected solution for each run.
Alternatively you could fill from a data set containing the
selected solutions. To do this, click Export to Data Set (
) and click OK in
the dialog box. Go to the Data Sets view (click Data
Sets in the Data Objects pane) to
see that the table of optimization results is contained in a new data
set. You could use these optimization results to fill tables. Both
these table-filling methods are described in Using Optimization Results to Fill Tables.
Note that the table in the current view is exported to the data set. If you want to export your selected best solutions for each operating point, make sure you display the Selected Solution Slice before exporting the data. If you export from the Pareto Slice, the new data set contains all solutions at the single currently selected operating point set. If you export from the Solution Slice the new data set will contain the current solution at all operating points.
Recall that the previous example was a single-objective optimization and therefore only had one solution per operating point. In that case the optimization results could be exported directly from the Solution Slice, as there was no choice of solutions to be selected. See Single-Objective Optimization.
In the next tutorial section you will duplicate this NBI optimization example and alter it to create a sum optimization.
![]() | Single-Objective Optimization | Sum Optimization | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |