| 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… |
|---|
Create Sum Optimization from Point Optimization Output |
When you have run an optimization an Output node appears in the optimization tree and the Optimization Output views appear. CAGE provides tools for analyzing your results with these views.
CAGE automatically selects successful optimization solutions and highlights unsuccessful solutions for you to investigate. These selections are shown in the icons and check boxes next to the Run column in the Optimization Results table, and shown in the Results Surface and Results Contour views. You can change the selections using the check boxes for each solution, or right-click to change acceptable status of solutions in the graphical views.
You can use these selections to choose solutions within the table for use in:
Importing to other optimization starting values: Import from Output.
Accept status is shown in the following ways:
CAGE automatically selects the Accept check boxes for solutions where the algorithm exit flag indicates success (>0). These solutions show a green square icon next to the check box. Typically constraints are met within tolerance.
![]()
Solutions with a red round icon indicate that the algorithm exit flag does not report success (<0). Some constraints may not be met.
![]()
Solutions with an orange triangular icon indicate that the algorithm exit flag is zero. Some constraints may not be met. An exit flag of zero indicates the algorithm failed because it exceeded limits on the amount of computation allowed (e.g., the algorithm ran out of iterations or function evaluations). You could decide to accept these solutions or you could try changing tolerances and optimizing again.
![]()
Solutions where you have altered the check box status show an asterisk.
![]()
Violated constraints are shown by yellow cells with cross icons in the table. You can control the value used for this highlighting by selecting View > Edit Constraint Tolerance.
![]()
It is possible to have highlighted constraints within green accept status solutions. The algorithm can report success if constraints are met within tolerance on scaled values. The constraint display applies a tolerance to raw values, and you can also edit this tolerance to help you analyze results.
If you are viewing constraints with more than one value and have the view set to Compact, the cell is yellow if any of the individual values are infeasible.
You can view the algorithm output flag in a tooltip by hovering the mouse pointer over each colored accept status icon, or click to select a solution and you can view the algorithm Exit flag, Exit message and other details in the Solution Information table.
The icon and (editable) Accept status check box are also shown at the top right for the currently selected solution.
For more information on using the graphical views to investigate your results, see Viewing Your Optimization Results.
CAGE has additional graphical tools for analyzing optimizations with more than one objective, see Tools for Multiobjective Optimizations.
Note For help understanding your results, see Analyzing Point Optimization Output or Interpreting Sum Optimization Output. |
Many users employ a point optimization to find good initial values for a sum optimization. To make this workflow easier and faster, you can use a utility to create a sum optimization from your point optimization output.
From your point optimization output node, select Solution > Create Sum Optimization .
CAGE creates a new optimization (called Sum_myOptimizationName). The optimization has these characteristics:
The objective matches your original optimization but converted to a sum objective.
The new optimization has identical constraints to your original optimization. Edit or add to these as usual if desired.
Your original fixed and free variables are converted to a sum optimization (a single run with multiple values).
The new optimization uses only accepted solutions from your original optimization output (all runs with a selected Accept check box).
Therefore, the number of accepted solutions you had in the original optimization determines the number of values within the sum optimization run.
The free variable initial values and fixed variable values are populated from your point optimal results (accepted solutions only).
The fixed variables have a Weights column with every value set to 1.
You can export the optimization output results to new data sets or existing data sets.
Note In a single objective optimization there is only one solution for each operating point, so this is exported. Use the Accept check boxes to choose a subset of results for export. See Choosing Acceptable Solutions. Multiobjective optimizations produce more than one solution per point, so you can either export all solutions or select your preferred solutions for export to a data set. See Tools for Multiobjective Optimizations. |
To export to a data set:
Select Solution > Export to Data Set or use the toolbar button. The Export to Data Set dialog box appears.

If exporting to a New data set (the default), you can edit the name in the edit box.
If you want to overwrite or add to an existing data set:
Select the option button Modify existing.
Select the desired data set in the list.
Choose from Action list:
Append adds the data to the chosen data set
Overwrite replaces all data in the data set with the new data
By default, the check box Use acceptable solutions only is selected. Optimization results with selected Accept check boxes will be exported. Clear the Use acceptable solutions only check box if you want to export all the optimization results. See Choosing Acceptable Solutions.
Click OK and the data is exported to the data set.
Export Rules
All fixed and free variables are exported where possible.
No models are exported to the data set. If you want to evaluate a model at the variable values, add the model to the data set in the Data Sets view.
When appending, the rules are the same as when merging data sets:
Columns of inputs are appended to columns with names that match in the data set you are appending to.
Outputs (models) and any other columns without matching names are not appended.
The values for any unmatched columns in the data set are set to the set point if possible, or zero otherwise.
There are two methods for filling tables with optimization results.
In the Optimization output view, you can use the Table Filling wizard as follows.
At the Optimization_Output node,
select Solution > Fill
Tables, or click the toolbar button
.
The Table Filling wizard appears.
Select the tables to fill, and click the button to add them to the list of tables to be filled. Click Next.
If your tables are in a tradeoff, CAGE automatically populates the filling factors for the tables from the tradeoff. View the Tradeoff column to see if a table is associated with a tradeoff. CAGE does not populate the fill factor if a table belongs to more than one tradeoff and there are different fill factors.
Note If you create your tables using the Create Tables from Model wizard, you can add all your new tables to a tradeoff. The tradeoff can be useful for specifying fill factors for tables and for investigating optimization results. See Creating Tables From a Model. |
If your tables are not in a tradeoff and you have not filled them before, you need to select filling factors for your tables as follows:
Select a table to be filled.
Select the correct variable or model output from the list of optimization results and click the button to match them.
Alternatively you can also double-click in the results column to match to the currently selected table.
Your selected filling factor appears in the Output Column.
Repeat for other tables.

In a single objective optimization there is only one solution for each operating point. In a multiobjective optimization there is more than one solution per point, so you must first select the preferred solutions before you can use the Table Filling wizard. To collect your preferred solutions you must use the Selected Solution Slice, then you can use this wizard to fill tables with the selected solutions.
Select a Fill Method.
Extrapolate Fill — Uses the optimization results to fill the whole table by extrapolation.
Direct Fill — Fills only those table cells whose breakpoints exactly match the optimization points.
Custom Fill — You can write your own table filling algorithm and use the file browser to select it. See Custom Fill Function Structure.
Use acceptable solutions only — select this check box to use only optimization results marked as 'acceptable'. See Choosing Acceptable Solutions.
Add to extrapolation mask— when this check box is selected, filled table cells are added to the extrapolation mask.
If you use the wizard to repeatedly fill a table any existing extrapolation mask is added to. As an example, consider filling multiple zones of a table using results from different optimizations. All zones are cumulatively added to the mask. If there is overlap with previous fills cells are overwritten unless they are locked. Note that locked cells are never altered by table filling.
Update tradeoffs — select this check box to update tradeoffs with the optimal values from your optimization. You must update your tradeoff to populate it with optimization results. If you do not update the tradeoff, table values and tradeoff values do not match.
For best results you need a table for each model input (free and fixed, except normalizer variables) to fill simultaneously from the optimization results. You can automatically create a tradeoff with all these tables by using the Create Tables from Model wizard. Evaluation of models in tradeoff uses the variable set points for any variables that do not have a tradeoff table.
Click Finish to fill the tables.
You will see a dialog box reporting which tables have been successfully filled. Switch to the Tables view to examine the tables.
The other method of filling tables with optimization output uses Data Sets. This can be useful to see the optimization results and the filled table surface on the same plot. In Data Sets you can also manually edit the results before filling, and compare results with external data.
From the Optimization_Output optimization
output node, click Export to Data Set (
) in the toolbar
(or select Solution > Export
to Data Set). The Export to Data Set dialog
box appears. See Exporting to a Data Set for
instructions.
Go to the Data Sets view (click the Data Sets button in the Data Objects pane) to see that the table of optimization results is contained in the new data set.
You can now use this data set (or any optimization results) to fill tables, as you can with any data set.
Select the data set and click
(Fill Table From
Data Set) in the toolbar.
Clear the check box to Show table history after fill.
Choose to fill a table with the desired optimization output by selecting them in the two lists, then click the button Fill Table at the bottom right.
Right-click the display and select Surface to see the filled table surface and the optimization output values.
See also
Tutorial: Filling Tables from Data in the Getting Started documentation for more details on using data sets to fill tables.
It can be useful to create your own function to fill tables from the results of an optimization, for example to implement alternative fill methods, smoothing strategies, or to customize output.
The input/output structure of a custom fill function resembles that of the MATLAB interpolation routines INTERP1 and INTERP2. To see the structure of the function it is best to look at an example:
Locate and open the file griddataTableFill.m in the mbctraining directory.
Type the following at the command line to open the example:
edit griddataTableFill
There are instructions for using this example in the optimization tutorial, Using a Custom Fill Routine to Fill Tables, in the Getting Started documentation. This function is an example of a function that will fill 2-D tables from optimization results.
All 2-D custom fill functions must take the following six inputs, which will be supplied to it by CAGE when the function is called:
| Input | Description |
|---|---|
col | Column coordinate of optimization results (NF-by-1) |
row | Row coordinate of optimization results (NF-by-1) |
filldata | Optimized results at (row, col) points (NF-by-1) |
colaxis | Column breakpoints of table to be filled (1-by-NCOL) |
rowaxis | Row breakpoints of table to be filled (NROW-by-1) |
currtabdata | Existing table values of table to be filled (NROW-by-NCOL) |
The function must pass three output arguments back to CAGE, to allow CAGE to fill the table:
| Output | Description |
|---|---|
| ok | Boolean flag to indicate success of the table fill (TRUE or FALSE) |
| tabval | New table values of table to be filled (NROW-by-NCOL) |
| fillmask | Logical matrix to indicate cells to be added to the extrapolation mask as a consequence of the table being filled (NROW-by-NCOL) |
In the above specifications:
NF is the number of points from the optimization results that will be used to fill your tables
NCOL is the number of column breakpoints in the table
NROW is the number of row breakpoints in the table
Note that your function should handle the cases when the table fill is successful or not. In griddataTableFill, this is handled using the try-catch construct around the call to griddata. If griddata should fail, then the ok flag is set to false and the function returns.
You can also write custom fill functions to fill 1–D tables. In this case the input and output specifications are as follows:
| Input | Description |
|---|---|
| row | Row coordinate of optimization results (NF-by-1) |
| filldata | Optimized results at (row, col) points (NF-by-1) |
| rowaxis | Row breakpoints of table to be filled (NROW-by-1) |
| currtabdata | Existing table values of table to be filled (NROW-by-1) |
| Output | Description |
|---|---|
| ok | Boolean flag to indicate success of the table fill (TRUE or FALSE) |
| tabval | New table values of table to be filled (NROW-by-1) |
| fillmask | Logical matrix to indicate cells to be added to the extrapolation mask as a consequence of the table being filled (NROW-by-1) |
![]() | Optimization Analysis | Viewing Your Optimization Results | ![]() |

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 |