Products & Services Solutions Academia Support User Community Company

Learn more about Model-Based Calibration   

Using Optimization Results

Choosing Acceptable Solutions

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:

Accept status is shown in the following ways:

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.

Create Sum Optimization from Point 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:

Exporting to a Data Set

You can export the optimization output results to new data sets or existing data sets.

To export to a data set:

  1. Select Solution > Export to Data Set or use the toolbar button. The Export to Data Set dialog box appears.

  2. If exporting to a New data set (the default), you can edit the name in the edit box.

  3. If you want to overwrite or add to an existing data set:

    1. Select the option button Modify existing.

    2. Select the desired data set in the list.

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

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

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

Filling Tables from Optimization Results

There are two methods for filling tables with optimization results.

Table Filling From Optimization Results Wizard

In the Optimization output view, you can use the Table Filling wizard as follows.

  1. At the Optimization_Output node, select Solution > Fill Tables, or click the toolbar button .

    The Table Filling wizard appears.

  2. Select the tables to fill, and click the button to add them to the list of tables to be filled. Click Next.

      Note   Fill settings are remembered between optimization runs and saved with the CAGE project.

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

    1. Select a table to be filled.

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

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

  5. Use acceptable solutions only — select this check box to use only optimization results marked as 'acceptable'. See Choosing Acceptable Solutions.

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

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

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

Filling Tables Via Data Sets

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.

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

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

  3. Select the data set and click   (Fill Table From Data Set) in the toolbar.

  4. Clear the check box to Show table history after fill.

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

  6. Right-click the display and select Surface to see the filled table surface and the optimization output values.

See also

Custom Fill Function Structure

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:

  1. Locate and open the file griddataTableFill.m in the mbctraining directory.

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

InputDescription

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:

OutputDescription
okBoolean flag to indicate success of the table fill (TRUE or FALSE)
tabvalNew table values of table to be filled (NROW-by-NCOL)
fillmaskLogical 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:

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.

Custom Fill Function for 1–D Tables

You can also write custom fill functions to fill 1–D tables. In this case the input and output specifications are as follows:

InputDescription
row Row coordinate of optimization results (NF-by-1)
filldataOptimized results at (row, col) points (NF-by-1)
rowaxisRow breakpoints of table to be filled (NROW-by-1)
currtabdataExisting table values of table to be filled (NROW-by-1)

OutputDescription
ok Boolean flag to indicate success of the table fill (TRUE or FALSE)
tabvalNew table values of table to be filled (NROW-by-1)
fillmaskLogical matrix to indicate cells to be added to the extrapolation mask as a consequence of the table being filled (NROW-by-1)

  


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