Products & Services Solutions Academia Support User Community Company

Learn more about Model-Based Calibration   

Setting Up Sum Optimizations

Overview of Setting Up 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:

  1. 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.

  2. 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.

  3. 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.

  4. (Optional) You can evaluate objectives or constraints over different operating points to those you specified in the optimization. See Using Application Point Sets.

  5. Run the optimization. See Running Optimizations.

  6. View the results (see Viewing Your Optimization Results). For descriptions of optimization output specific to sum problems, see Interpreting Sum Optimization Output.

What Is a Run?

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.

Example Problem to Demonstrate Controls for Sum Optimizations

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

You need to set up an optimization to calculate optimal settings of S, INT and EXH for the following operating points:

NL
1000 0.3
11000.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:

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.

Using Variable Values Length 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?.

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.

NL
10000.3
1100 0.2
12500.31
1500 0.25
16250.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.

NL
50000.55
5214 0.5
55640.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:

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).

Algorithm Restrictions

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 NameObjectivesConstraints
FoptconOne output Any number of outputs
NBITwo or more outputsAny 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 TypeMaximum Number of Values of All Inputs to the ObjectiveNumber of OutputsReason
PointNNA point objective is evaluated at each operating point within a run, and all the values are returned.
SumNOneA 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 NNThese constraints are evaluated at every operating point within a run, and all values are returned.
Ellipsoid NN
1D Table NN
2D Table NN
Model NN
Range N0, N or 2NA 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 N1A sum constraint evaluates a model at every operating point and returns the difference between the weighted sum of the model and a bound.
TableN>=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.

ObjectiveMaximum Number of Values of All InputsNumber of Outputs
Weighted sum of TQ over the drive cycle points51 (using the Objective table)

ConstraintMaximum Number of Values of All InputsNumber of Outputs
EXTEMP <= 1290°C at each drive cycle point 55 (using the Constraint table)
RESIDFRAC <= 17% at each drive cycle point 55 (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 524 (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 L524 (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.

Using Application Point Sets

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:

To use an application point set for evaluating an objective or constraint:

  1. Right-click the objective or constraint, and select Select Application Point Set.

    The Select Operating Point Variables dialog box appears.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  


Recommended Products

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