Main Content

fxpOptimizationOptions class

Specify options for data type optimization

描述

fxpOptimizationOptions对象使您可以指定在数据类型优化过程中使用的选项和约束。

Construction

opt= fxpoptimizePtions()创建一个fxpOptimizationOptionsobject with default values.

opt= fxpoptimizePtions(名称,价值)创建一个nfxpOptimizationOptionsobject with property values specified by one or more名称,价值pair arguments.Namemust appear inside single quotes ('')。您可以按任何顺序指定几个名称值对参数Name1,Value1,...,NameN,ValueN.

特性

展开全部

执行的最大迭代次数,指定为标量整数。优化过程通过不同的解决方案进行迭代,直到找到理想的解决方案,达到最大迭代次数或达到另一个停止标准。万博 尤文图斯

例子:opt.MaxIterations = 75;

数据类型:双倍的

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.

例子:opt.MaxTime = 1000;

数据类型:双倍的

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.

例子:opt.Patience = 15;

数据类型:双倍的

这level of information displayed at the command line during the optimization process, specified as either'High','Moderate', or'沉默的'.

  • '沉默的'- 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'- 在优化过程的每次迭代中,在命令行中显示信息,包括是否找到了新的最佳解决方案以及解决方案的成本。

例子:opt.Verbosity = 'Moderate';

数据类型:char|string

指定在设计下的优化系统中可以使用的单词长度。使用此属性来定位优化过程的邻域搜索。优化的最终结果使用单词长度在AllowableWordLengthsand word lengths compatible with hardware constraints specified in the硬件实现模型的窗格。

例子:Opt.AllowableWordLength = [8:11,16,32];

数据类型:双倍的

目的ive function to use during optimization search, specified as one of these values:

  • 'BitWidthSum'- 最小化总宽度总和。

  • “OperatorCount”- 最小化生成的C代码中运算符的估计计数。

    This option may result in a lower program memory size for C code generated from Simulink®楷模。这“OperatorCount”objective function is not suitable for FPGA or ASIC targets.

    Note

    使用“OperatorCount”在优化目标函数,model must be ready for code generation. For more information about determining code generation readiness, seeCheck Model and Configuration for Code Generation(Embedded Coder).

数据类型:char

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错误的, the iterations run in serial.

数据类型:logical

Additional advanced options for optimization.高级选项is an object containing additional properties that can affect the optimization.

财产 描述
performenighborhoodSearch
  • 1(default) – Perform a neighborhood search for the optimized solution.

  • 0- 不要执行邻里搜索。选择此选项可以提高优化过程的速度,但也增加了找到不太理想解决方案的机会。

EnforceLooseCoupling

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- 不允许优化器放宽对系统中系统中块的限制。

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

仿真季节 定义在优化期间使用A的其他模拟方案万博1manbetxSimulink.SimulationInputobject. For an example, see使用多个模拟方案优化数据类型.
SafetyMargin

Enter a safety margin, specified as a positive scalar value indicating the percentage increase in the bounds of the collected range. The safety margin is applied to the union of all collected ranges, including simulation ranges, derived ranges, and design ranges.

DataTypeOverride

在优化范围收集阶段进行模拟时,模型中指定的数据类型的覆盖数据类型。

  • '离开'(default) – Do not override data types

  • 'Single'– Override data types with singles

  • 'Double'– Override data types with doubles

  • “ scaleddouble'– Override data types with scaled doubles

hangeuns万博1manbetxupport

Some blocks are not supported for fixed-point conversion. For more information, see不支持定点数据类型的块万博1manbetx.

  • 'Isolate'(default) – Isolate unsupported blocks withData Type Conversion块。隔离块被优化器忽略。

  • '错误'- 停止优化并报告系统包含未支持定点转换的块时的错误。万博1manbetx

  • 'Warn'– Warn when the system contains blocks that are not supported for fixed-point conversion. Ignore unsupported blocks and continue optimization. This option allows you to replace unsupported constructs with other solutions, such as lookup tables, after optimization is complete.

PerformSlopeBiasCancellation
  • 0(默认值) - 请勿传播斜率偏差数据类型。

  • 1– Propagate slope-bias data types from outside the system under design. Slopes and biases are chosen to reduce the complexity of generated code.

InstrumentationContext [模型'/subsystem']- 限制仪器以最小,最大和溢出记录,以将优化范围收集步骤限制为子系统。子系统必须位于顶级模型下,并包含在设计中的系统。

Methods

addSpecification 在系统中指定已知数据类型
addtolerance 为优化系统指定数字公差
显示特异性 Show specifications for a system
展示耐力 显示针对系统指定的公差

Copy Semantics

处理。要了解处理课程如何影响复制操作,请参见复制对象.

例子

全部收缩

Create anfxpOptimizationObject具有默认属性值。

options = fxpOptimizationOptions();

使用DOT语法编辑创建后的属性。

options.Patience = 15; options.AllowableWordLengths = [8,16,32]; options.AdvancedOptions.UseDerivedRangeAnalysis = true
options = fxpOptimizationOptions with properties: MaxIterations: 50 MaxTime: 600 Patience: 15 Verbosity: High AllowableWordLengths: [8 16 32] ObjectiveFunction: BitWidthSum UseParallel: 0 Advanced Options AdvancedOptions: [1x1 DataTypeOptimization.AdvancedFxpOptimizationOptions]

Use property name-value pairs to set properties at object creation.

options = fxpOptimizationOptions('Patience',15,“允许wordlength”,[8,16,32])
options = fxpOptimizationOptions with properties: MaxIterations: 50 MaxTime: 600 Patience: 15 Verbosity: High AllowableWordLengths: [8 16 32] ObjectiveFunction: BitWidthSum UseParallel: 0 Advanced Options AdvancedOptions: [1x1 DataTypeOptimization.AdvancedFxpOptimizationOptions]

Specify advanced options.

options.AdvancedOptions.UseDerivedRangeAnalysis = 1
options = fxpOptimizationOptions with properties: MaxIterations: 50 MaxTime: 600 Patience: 15 Verbosity: High AllowableWordLengths: [8 16 32] ObjectiveFunction: BitWidthSum UseParallel: 0 Advanced Options AdvancedOptions: [1x1 DataTypeOptimization.AdvancedFxpOptimizationOptions]

You can import anfxpOptimizationOptions对象进入定点工具,以在应用中执行数据类型优化。通过导入fxpOptimizationOptionsobject rather than specifying settings manually in the app, you can easily save and restore your settings.

Open the model.

model ='ex_controllerHarness';Open_System(模型);

要指定优化的选项,例如允许的单词长度和迭代次数,请使用fxpOptimizationOptionsobject.

options = fxpOptimizationOptions(“允许wordlength”, [2:32],'MaxIterations',3E2,'Patience', 50);

控制器选定子系统。

fxptdlg('ex_controllerHarness/Controller')

在定点工具中,选择New > Optimized Fixed-Point Conversionto start the data type optimization workflow.

In theSetuppane, underAdvanced Options,选择从下拉菜单导入的优化选项对象。点击进口.

扩展设置menu in the toolstrip to confirm that the optimization options were applied.

已经rsion History

Introduced in R2018a