| 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… |
|---|
Overview of Setting Up Sum Optimizations Example Problem to Demonstrate Controls for Sum Optimizations |
CAGE can solve sum-type optimizations. These optimizations find the optimal settings of control parameters at several operating points simultaneously. You can use sum optimizations to solve drive-cycle problems where you must apply the constraints across the whole cycle. For example, a constraint such as weighted engine out brake specific NOx <= 3 g/kWh.
If you have an existing point optimization, you can use a utility to create a sum optimization from your point optimization output. This approach can help you find good initial values for a sum optimization. To create a sum optimization from your point optimization output node, select Solution > Create Sum Optimization . For more details see Create Sum Optimization from Point Optimization Output.
To set up a new sum optimization:
Use the Creating Optimizations from Models Wizard to create your optimization. You can configure a sum objective in the wizard. CAGE automatically configures your variable values correctly for a sum optimization, defining a single run. See What Is a Run?.
You can also configure a sum objective later in the Optimization view. See Sum Objectives.
Add constraints:
You can add a boundary model constraint in the wizard.
To apply other types of constraints you must use the Optimization view. You can apply linear, ellipsoid, 1-D table, 2-D table, and range constraints, and some constraints are specific to sum optimizations—sum constraints and table gradient constraints.
See Edit Constraint for details of all these constraints.
Choose the points where you want to run the optimization:
You can use the wizard to select a suitable table grid, data set, or point-by-point model, or use the variable set points.
You can also set up your optimization variable values in the Optimization view. You can enter values manually, or by importing from data sets, tables, or the output of existing optimizations. See Editing Variable Values.
For sum optimizations you must have a single run, defined by the length controls. CAGE automatically configures your variable values correctly for a sum optimization (defining a single run) when you either:
Use the Create Sum Optimization utility
Use the Create Optimization from Model wizard and then select a sum objective.
If you prefer, you can use the length controls in the Optimization view instead of the wizard. See Using Variable Values Length Controls.
(Optional) You can evaluate objectives or constraints over different operating points to those you specified in the optimization. See Using Application Point Sets.
Run the optimization. See Running Optimizations.
View the results (see Viewing Your Optimization Results). For descriptions of optimization output specific to sum problems, see Interpreting Sum Optimization Output.
Sum type optimizations determine optimal settings of operating points simultaneously. Thus, one call to the algorithm determines the optimal settings of the control parameters at each operating point.
In CAGE, a run refers to each call to the optimization algorithm. . You specify the number of runs that you want CAGE to perform with the Number of runs control in the Input Variable Values pane. For more details, see Using Variable Values Length Controls.
The following sections describe the controls and outputs for sum optimizations using the following example problem for illustration.
Say you have created models for torque (TQ), residual fraction (RESIDFRAC) and exhaust temperature (EXTEMP) for a gasoline engine.
The inputs to these models are
Spark advance, S
Intake cam timing, INT
Exhaust cam timing, EXH
Engine speed, N
Relative load, L
You need to set up an optimization to calculate optimal settings of S, INT and EXH for the following operating points:
| N | L |
|---|---|
| 1000 | 0.3 |
| 1100 | 0.2 |
| 1250 | 0.31 |
| 1500 | 0.25 |
| 1625 | 0.18 |
The objective for this optimization is:
Maximize the weighted sum of TQ over the operating points.
The constraints for this optimization are:
Constraint 1: EXTEMP <= 1290°C at each operating point
Constraint 2: RESIDFRAC <= 17% at each operating point
Constraint 3: Change in INT is no more than 5.5° per 500 rpm change in N and 5.5° per 0.1 change in L, evaluated over a 3-by-3 (N, L) table.
Constraint 4: Change in EXH is no more than 5.5° per 500 rpm change in N and 5.5° per 0.1 change in L, evaluated over a 3-by-3 (N, L) table.
You can use the foptcon algorithm in CAGE to solve this problem.
This example is used to explain the controls and outputs in the following sections, Using Variable Values Length Controls and Interpreting Sum Optimization Output.
See Algorithm Restrictions for details on the optimization algorithm restrictions in CAGE.
Note CAGE automatically configures your variable values correctly for a sum optimization when you use the Create Optimization from Model wizard and select a sum objective, or when you use the utility to Create Sum Optimization from point optimization output. CAGE defines a single run with multiple values, so you do not need to adjust the Number of Values controls. |
You use the Input Variable Values pane to set variable values for the points where you want the optimization to run. (See Editing Variable Values). You can enter values manually or by importing from data sets, tables, or the output of existing optimizations.
For sum optimizations you must have a single run. You specify the number of runs that CAGE will perform with the Number of Values length controls when defining the variable values.
At the optimization node the Input Variable Values pane has Number of Values controls for each free and fixed variable. Use these controls to increase the number of operating points per optimization run. If you leave all the Number of Values set to one, each row in the values panes represents one optimization run. See What Is a Run?.
You can edit the Number of Values directly, or you can select Optimization > Set Variable Lengths to change all variable lengths at once.
You can quickly toggle between N runs of one point and a single run of N points (which can be used as a drive cycle for sum optimization problems) using the Optimization menu items Convert to Single Run and Convert to Multiple Runs. You can also use the Number of Values controls to define your sum optimization runs.
If you increase the Number of Values of a fixed or free variable, then the number of operating points within each run increases, as shown in the following example.

The input variable values are configured for the example problem, showing a single run (left column under Number of Values shows 1) of five operating points (as shown in the right column under Number of Values). The optimizer simultaneously finds the optimal settings of S, EXH and INT at all the operating points, starting at the initial values shown in the Free Variables table for each point.
The index of each operating point is indicated by the number in brackets in the right column under Number of Values, for example the third operating point is N=1250, L=0.31.
When objectives or constraints require weights or bounds you can enter them in the Input Variable Values pane. In the example problem, the objective requires specified weights for the weighted sum of torque, so the column Objective1_weights appears in the Fixed Variables pane, where you can enter weights for each point. For an example see Setting Weights for the Sum Objective and Constraint in the diesel case study.
You can also run a sum optimization over different sets of operating points. Consider the following example, an optimization of the weighted sum of fuel consumption over two different drive cycles.

The preceding figure shows an optimization that runs twice (Number of runs has been set to 2, and the left column under Number of Values shows 2 runs). Each run contains five operating points (as shown in brackets in the right column under Number of Values).
The optimization algorithm will be called twice (two runs). In the first run, optimal settings of S, EXH and INT will be simultaneously calculated for each point in the first drive cycle, as shown in the following table.
| N | L |
|---|---|
| 1000 | 0.3 |
| 1100 | 0.2 |
| 1250 | 0.31 |
| 1500 | 0.25 |
| 1625 | 0.18 |
In the second run, optimal settings of S, EXH and INT will be calculated for each point in the second drive cycle, as shown in the following table.
| N | L |
|---|---|
| 5000 | 0.55 |
| 5214 | 0.5 |
| 5564 | 0.6 |
| 5847 | 0.64 |
| 6000 | 0.7 |
In the previous examples, the number of values for each variable is identical. It is also possible to specify a mixture of scalars and vectors for each variable, as shown in the following example.

The Number of Values controls are independent for each variable. In the preceding figure:
S Number of Values = 1
EXH Number of Values = 5
INT Number of Values = 1
In this case, the single initial value of S is used for every drive cycle point in the optimization, and similarly for INT (and the optimizer will return a single value for S and INT for the run).
Each run of a CAGE Optimization makes a call to the algorithm you have chosen to use. This algorithm needs to evaluate the objectives and constraints (probably several times) to allow it to determine the optimal settings of the free variables. Optimization algorithms typically have restrictions on the number of objective and constraint outputs they can handle. The following table details the restrictions on the two algorithms provided in CAGE.
| Algorithm Name | Objectives | Constraints |
|---|---|---|
| Foptcon | One output | Any number of outputs |
| NBI | Two or more outputs | Any number of outputs |
When each objective
and constraint is evaluated during a run, the number of outputs it
returns depends on the maximum number of values of all of its inputs.
The following table details the number of outputs each objective type
returns as a function of the maximum number of values of all of its
inputs.
| Objective Type | Maximum Number of Values of All Inputs to the Objective | Number of Outputs | Reason |
|---|---|---|---|
| Point | N | N | A point objective is evaluated at each operating point within a run, and all the values are returned. |
| Sum | N | One | A sum objective evaluates a model at every operating point and returns one value, which is the weighted sum of the model evaluations. |
Similarly, the following table details the number of outputs each constraint type returns as a function of the maximum number of values of all of its inputs.
| Constraint Type | Maximum Number of Values of All Inputs to the Constraint | Number of Outputs | Reason |
|---|---|---|---|
| Linear | N | N | These constraints are evaluated at every operating point within a run, and all values are returned. |
| Ellipsoid | N | N | |
| 1D Table | N | N | |
| 2D Table | N | N | |
| Model | N | N | |
| Range | N | 0, N or 2N | A range constraint evaluates an expression at each operating point within a run. The constraint returns two values for each point, the distance from the lower and upper bound. In this case 2N outputs are returned. If one of the bounds is infinite, then only the distance to the finite bound is returned for each point, and N outputs are returned. If both bounds are infinite then 0 outputs will be returned. |
| Sum | N | 1 | A sum constraint evaluates a model at every operating point and returns the difference between the weighted sum of the model and a bound. |
| Table | N | >=8 (dependent on settings) | A table gradient constraint constrains the gradient of a free variable over a grid. The number of outputs returned depends on the dimensions of the grid. |
You can use these three tables to check whether the problem set up satisfies the algorithm restrictions. As an example, the following table checks whether the example problem (detailed in Example Problem to Demonstrate Controls for Sum Optimizations) satisfies the restriction of the algorithm chosen to solve it, foptcon.
| Objective | Maximum Number of Values of All Inputs | Number of Outputs |
|---|---|---|
| Weighted sum of TQ over the drive cycle points | 5 | 1 (using the Objective table) |
| Constraint | Maximum Number of Values of All Inputs | Number of Outputs |
|---|---|---|
| EXTEMP <= 1290°C at each drive cycle point | 5 | 5 (using the Constraint table) |
| RESIDFRAC <= 17% at each drive cycle point | 5 | 5 (using the Constraint table) |
| Change in INT is no more than 5.5° per 500 rpm and 5.5° per 0.1 change in L | 5 | 24 (this value is the number of table gradient constraint outputs generated from a 3-by-3 table) |
| Change in EXH is no more than 5.5° per 500 rpm and 5.5° per 0.1 change in L | 5 | 24 (this value is the number of table gradient constraint outputs generated from a 3-by-3 table) |
Thus, the example problem has 1 objective output and 58 constraint outputs. This satisfies the restrictions of the foptcon algorithm and so the algorithm can be used.
You can use application point sets to evaluate constraints and objectives at different operating points than those specified in the optimization. You can only use application point sets with sum optimizations.
This can be useful for some problems, for example:
Your calibration problem requires consideration of several drive cycles, defined at different operating point sets. For example, it is common to have different drive cycles for performance and emissions.
You want to apply some constraints only at a subset of the optimization points (sometimes called "multiregion problems"). For example, there are often different constraints to consider at full load.
Your full operating point set of interest is very large and optimizing at every point will be very slow. You can run an optimization at a subset of points, and evaluate interpolated results across an application point set.
You may need to evaluate point-by-point models at different operating points to the points where the models are defined.
To use an application point set for evaluating an objective or constraint:
Right-click the objective or constraint, and select Select Application Point Set.
The Select Operating Point Variables dialog box appears.
Select a pair of variables to use in application point sets. The variables must be fixed variables in your optimization. You only select variables once per optimization. Click OK.
The Select Application Point Set dialog box appears.
Select an application point set. You can choose a data set or a New subset of the optimization points. To select a subset of points, you can use the check boxes or click points on the plot.

View the plot displaying the application points and optimization points. CAGE extrapolates the optimization results to evaluate the objective or constraint at the application points.
Click OK.
To see example plots that illustrate how CAGE uses application point sets, enter mbcAppPointSetDemo to load the example project file mbcAppPointSetDemo.cag into CAGE. Run the optimizations in the project to view the plots.
For a step-by-step example using application point sets, see Point-by-Point Optimization Overview in the Point-by-Point Diesel Engine Calibration Case Study documentation.
![]() | Creating an Optimization | Setting Up Multiobjective Optimizations | ![]() |

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 |