fxpOptimizationOptions class

Specify options for data type optimization


The fxpOptimizationOptions object enables you to specify options and constraints to use during the data type optimization process.


opt = fxpOptimizationOptions() creates a fxpOptimizationOptions object with default values.

opt = fxpOptimizationOptions(Name,Value) creates an fxpOptimizationOptions object with property values specified by one or more Name,Value pair arguments. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN.


expand all

Maximum number of iterations to perform, specified as a scalar integer. The optimization process iterates through different solutions until it finds an ideal solution, reaches the maximum number of iterations, or reaches another stopping criteria.

Example: opt.MaxIterations = 75;

Data Types: double

Maximum amount of time for the optimization to run, specified in seconds as a scalar number. The optimization runs until it reaches the time specified, an ideal solution, or another stopping criteria.

Example: opt.MaxTime = 1000;

Data Types: double

Maximum number of iterations where no new best solution is found, specified as a scalar integer. The optimization continues as long as the algorithm continues to find new best solutions.

Example: opt.Patience = 15;

Data Types: double

The level of information displayed at the command line during the optimization process, specified as either 'High', 'Moderate', or 'Silent'.

  • 'Silent' - Nothing is displayed at the command line until the optimization process is finished

  • 'Moderate' - Information is displayed at each major step of the optimization process, including when the process is in the preprocessing, modeling, and optimization phases.

  • 'High' - Information is displayed at the command line at each iteration of the optimization process, including whether a new best solution was found, and the cost of the solution.

Example: opt.Verbosity = 'High';

Data Types: char | string

Specify the word lengths that can be used in your optimized system under design. Use this property to target the neighborhood search of the optimization process. The final result of the optimization uses word lengths in the intersection of the AllowableWordLengths and word lengths compatible with hardware constraints specified in the Hardware Implementation pane of your model.

Example: opt.AllowableWordLenghts = [8:11,16,32];

Data Types: double

Whether to run iterations of the optimization in parallel, specified as a logical. Running the iterations in parallel requires a Parallel Computing Toolbox™ license. If you do not have a Parallel Computing Toolbox license, or if you specify false, the iterations run in serial.

Data Types: logical

Additional optimization options. AdvancedOptions is a struct containing four additional properties that can affect the optimization.

  • 1 (default) – Perform a neighborhood search for the optimized solution.

  • 0 – Do not perform a neighborhood search. Selecting this option can increase the speed of the optimization process, but also increases the chances of finding a less ideal solution.


Some blocks have a parameter that forces inputs to share a data type, or forces the output to share the same data type as the input.

  • 1 (default) – Allow the optimizer to relax this restriction on all blocks in the system under design. Relaxing this restriction enables the optimizer to provide better fitting data types.

  • 0 – Do not allow the optimizer to relax this restriction on blocks in the system under design.

  • 0 (default) – The optimizer does not consider ranges derived from design ranges in the model when assessing a solution.

  • 1 – The optimizer considers both observed simulation ranges and ranges derived from design ranges in the model when assessing a solution.

Depending on the model configuration, derived range analysis may take longer than simulation of the model.

SimulationScenariosDefine additional simulation scenarios to consider during optimization using a Simulink.SimulationInput object. For an example, see Optimize Data Types Using Multiple Simulation Scenarios.


addToleranceSpecify numeric tolerance for optimized system
showTolerancesShow tolerances specified for a system

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).


collapse all

Create an fxpOptimizationObject with default property values.

options = fxpOptimizationOptions();

Edit the properties after creation using dot syntax.

options.Patience = 15;
options.AllowableWordLengths = [8,16,32]
options = 
  fxpOptimizationOptions with properties:

           MaxIterations: 50
                 MaxTime: 600
                Patience: 15
               Verbosity: High
    AllowableWordLengths: [8 16 32]
             UseParallel: 0

   Advanced Options
         AdvancedOptions: [1x1 struct]

Introduced in R2018a