分享好友 最新动态首页 最新动态分类 切换频道
matlab optimoptions,创建优化选项 - MATLAB optimoptions- MathWorks 中国
2024-12-26 20:00

创建默认选项

为 fmincon 求解器创建默认选项。

options = optimoptions('fmincon')

options =

fmincon options:

Options used by current Algorithm ('interior-point'):

(Other available algorithms: 'active-set', 'sqp', 'sqp-legacy', 'trust-region-reflective')

Set properties:

No options set.

Default properties:

Algorithm: 'interior-point'

CheckGradients: 0

ConstraintTolerance: 1.0000e-06

Display: 'final'

FiniteDifferenceStepSize: 'sqrt(eps)'

FiniteDifferenceType: 'forward'

HessianApproximation: 'bfgs'

HessianFcn: []

HessianMultiplyFcn: []

HonorBounds: 1

MaxFunctionEvaluations: 3000

MaxIterations: 1000

ObjectiveLimit: -1.0000e+20

OptimalityTolerance: 1.0000e-06

OutputFcn: []

PlotFcn: []

ScaleProblem: 0

SpecifyConstraintGradient: 0

SpecifyObjectiveGradient: 0

StepTolerance: 1.0000e-10

SubproblemAlgorithm: 'factorization'

TypicalX: 'ones(numberOfVariables,1)'

UseParallel: 0

Show options not used by current Algorithm ('interior-point')

创建非默认选项

为 fmincon 求解器创建非默认选项。

options = optimoptions(@fmincon,'Algorithm','sqp','MaxIterations',1500)

options =

fmincon options:

Options used by current Algorithm ('sqp'):

(Other available algorithms: 'active-set', 'interior-point', 'sqp-legacy', 'trust-region-reflective')

Set properties:

Algorithm: 'sqp'

MaxIterations: 1500

Default properties:

CheckGradients: 0

ConstraintTolerance: 1.0000e-06

Display: 'final'

FiniteDifferenceStepSize: 'sqrt(eps)'

FiniteDifferenceType: 'forward'

MaxFunctionEvaluations: '100*numberOfVariables'

ObjectiveLimit: -1.0000e+20

OptimalityTolerance: 1.0000e-06

OutputFcn: []

PlotFcn: []

ScaleProblem: 0

SpecifyConstraintGradient: 0

SpecifyObjectiveGradient: 0

StepTolerance: 1.0000e-06

TypicalX: 'ones(numberOfVariables,1)'

UseParallel: 0

Show options not used by current Algorithm ('sqp')

更新选项

用新值更新现有选项。

为 lsqnonlin 求解器创建选项。

oldoptions = optimoptions(@lsqnonlin,'Algorithm','levenberg-marquardt',...

'MaxFunctionEvaluations',1500)

oldoptions =

lsqnonlin options:

Options used by current Algorithm ('levenberg-marquardt'):

(Other available algorithms: 'trust-region-reflective')

Set properties:

Algorithm: 'levenberg-marquardt'

MaxFunctionEvaluations: 1500

Default properties:

CheckGradients: 0

Display: 'final'

FiniteDifferenceStepSize: 'sqrt(eps)'

FiniteDifferenceType: 'forward'

FunctionTolerance: 1.0000e-06

MaxIterations: 400

OutputFcn: []

PlotFcn: []

SpecifyObjectiveGradient: 0

StepTolerance: 1.0000e-06

TypicalX: 'ones(numberOfVariables,1)'

UseParallel: 0

Show options not used by current Algorithm ('levenberg-marquardt')

将 MaxFunctionEvaluations 增加到 2000。

options = optimoptions(oldoptions,'MaxFunctionEvaluations',2000)

options =

lsqnonlin options:

Options used by current Algorithm ('levenberg-marquardt'):

(Other available algorithms: 'trust-region-reflective')

Set properties:

Algorithm: 'levenberg-marquardt'

MaxFunctionEvaluations: 2000

Default properties:

CheckGradients: 0

Display: 'final'

FiniteDifferenceStepSize: 'sqrt(eps)'

FiniteDifferenceType: 'forward'

FunctionTolerance: 1.0000e-06

MaxIterations: 400

OutputFcn: []

PlotFcn: []

SpecifyObjectiveGradient: 0

StepTolerance: 1.0000e-06

TypicalX: 'ones(numberOfVariables,1)'

UseParallel: 0

Show options not used by current Algorithm ('levenberg-marquardt')

使用圆点表示法更新选项

使用圆点表示法用新值更新现有选项。

为 lsqnonlin 求解器创建选项。

options = optimoptions(@lsqnonlin,'Algorithm','levenberg-marquardt',...

'MaxFunctionEvaluations',1500)

options =

lsqnonlin options:

Options used by current Algorithm ('levenberg-marquardt'):

(Other available algorithms: 'trust-region-reflective')

Set properties:

Algorithm: 'levenberg-marquardt'

MaxFunctionEvaluations: 1500

Default properties:

CheckGradients: 0

Display: 'final'

FiniteDifferenceStepSize: 'sqrt(eps)'

FiniteDifferenceType: 'forward'

FunctionTolerance: 1.0000e-06

MaxIterations: 400

OutputFcn: []

PlotFcn: []

SpecifyObjectiveGradient: 0

StepTolerance: 1.0000e-06

TypicalX: 'ones(numberOfVariables,1)'

UseParallel: 0

Show options not used by current Algorithm ('levenberg-marquardt')

使用圆点表示法将 MaxFunctionEvaluations 增加到 2000。

options.MaxFunctionEvaluations = 2000

options =

lsqnonlin options:

Options used by current Algorithm ('levenberg-marquardt'):

(Other available algorithms: 'trust-region-reflective')

Set properties:

Algorithm: 'levenberg-marquardt'

MaxFunctionEvaluations: 2000

Default properties:

CheckGradients: 0

Display: 'final'

FiniteDifferenceStepSize: 'sqrt(eps)'

FiniteDifferenceType: 'forward'

FunctionTolerance: 1.0000e-06

MaxIterations: 400

OutputFcn: []

PlotFcn: []

SpecifyObjectiveGradient: 0

StepTolerance: 1.0000e-06

TypicalX: 'ones(numberOfVariables,1)'

UseParallel: 0

Show options not used by current Algorithm ('levenberg-marquardt')

将选项复制到另一个求解器

将 fmincon 求解器的非默认选项转移到 fminunc 求解器的选项。

为 fmincon 求解器创建非默认选项。

oldoptions = optimoptions(@fmincon,'Algorithm','sqp','MaxIterations',1500)

oldoptions =

fmincon options:

Options used by current Algorithm ('sqp'):

(Other available algorithms: 'active-set', 'interior-point', 'sqp-legacy', 'trust-region-reflective')

Set properties:

Algorithm: 'sqp'

MaxIterations: 1500

Default properties:

CheckGradients: 0

ConstraintTolerance: 1.0000e-06

Display: 'final'

FiniteDifferenceStepSize: 'sqrt(eps)'

FiniteDifferenceType: 'forward'

MaxFunctionEvaluations: '100*numberOfVariables'

ObjectiveLimit: -1.0000e+20

OptimalityTolerance: 1.0000e-06

OutputFcn: []

PlotFcn: []

ScaleProblem: 0

SpecifyConstraintGradient: 0

SpecifyObjectiveGradient: 0

StepTolerance: 1.0000e-06

TypicalX: 'ones(numberOfVariables,1)'

UseParallel: 0

Show options not used by current Algorithm ('sqp')

将适用选项迁移到 fminunc 求解器。

options = optimoptions(@fminunc,oldoptions)

options =

fminunc options:

Options used by current Algorithm ('quasi-newton'):

(Other available algorithms: 'trust-region')

Set properties:

CheckGradients: 0

FiniteDifferenceType: 'forward'

MaxIterations: 1500

OptimalityTolerance: 1.0000e-06

PlotFcn: []

SpecifyObjectiveGradient: 0

StepTolerance: 1.0000e-06

Default properties:

Algorithm: 'quasi-newton'

Display: 'final'

FiniteDifferenceStepSize: 'sqrt(eps)'

MaxFunctionEvaluations: '100*numberOfVariables'

ObjectiveLimit: -1.0000e+20

OutputFcn: []

TypicalX: 'ones(numberOfVariables,1)'

UseParallel: 0

Show options not used by current Algorithm ('quasi-newton')

找到适用于优化问题的求解器和默认选项

创建优化问题并找到默认的求解器和选项。

rng default

x = optimvar('x',3,'LowerBound',0);

expr = x'*(eye(3) + randn(3))*x - randn(1,3)*x;

prob = optimproblem('Objective',expr);

options = optimoptions(prob)

options =

quadprog options:

Options used by current Algorithm ('interior-point-convex'):

(Other available algorithms: 'active-set', 'trust-region-reflective')

Set properties:

No options set.

Default properties:

Algorithm: 'interior-point-convex'

ConstraintTolerance: 1.0000e-08

Display: 'final'

LinearSolver: 'auto'

MaxIterations: 200

OptimalityTolerance: 1.0000e-08

StepTolerance: 1.0000e-12

Show options not used by current Algorithm ('interior-point-convex')

默认求解器是 quadprog。

设置选项以使用迭代输出。查找解。

options.Display = 'iter';

sol = solve(prob,'Options',options);

Solving problem using quadprog.

Your Hessian is not symmetric. Resetting H=(H+H')/2.

Iter Fval Primal Infeas Dual Infeas Complementarity

0 2.018911e+00 0.000000e+00 2.757660e+00 6.535839e-01

1 -2.170204e+00 0.000000e+00 8.881784e-16 2.586177e-01

2 -3.405808e+00 0.000000e+00 8.881784e-16 2.244054e-03

3 -3.438788e+00 0.000000e+00 3.356690e-16 7.261144e-09

Minimum found that satisfies the constraints.

Optimization completed because the objective function is non-decreasing in

feasible directions, to within the value of the optimality tolerance,

and constraints are satisfied to within the value of the constraint tolerance.

sol.x

ans = 3×1

1.6035

0.0000

最新文章
这些ai改写标题工具你用过吗?可以帮你轻松生成各种吸引人的标题哦
咱就是说现在看推文,标题要是不够吸引人,真的难让人有看下去的欲望。 “标题党”这一词虽说报听,但是好歹也真的有用的,给平淡文字穿上了 “华丽丽” 的外衣,总是有人有着好奇心点进去的。 而且作为一个
过度依赖广告,单脚跳的谷歌还能撑多久
文 | 腾讯科技皎晗很多公司在崩盘之前,业务往往看似都在蓬勃发展,谷歌也是如此。但谷歌大厦一旦坍塌,其也将是科技行业有史以来最蔚为壮观的崩盘事件。早在谷歌还只是一个想法的时候,其创始人就认为由广告资助的搜索引擎将固有地偏向于
文章生成器-原创文章生成器
在网络营销领域,优质文章是吸引新客户和保留老客户的重要工具。然而,生成高质量且符合SEO优化的文章并不是一件容易的事情。这就是为什么网站文章生成器如今备受欢迎的原因。而在众多的文章生成工具中,147GPT批量生成文章软件是一款非常
谷歌seo是什么牌子(谷歌seo是什么牌子的)
大家好,今天小编关注到一个比较有意思的话题,就是关于谷歌seo是什么牌子的问题,于是小编就整理了2个相关介绍谷歌seo是什么牌子的解答,让我们一起看看吧。seo的全称是什么?做外贸是用阿里巴巴好还是做谷歌seo好?大家都是为什么选择的
配置IP白名单
地域云数据库公网直连上海3633.2.2.0/24117.89.250.178西南133.2.0.0/24117.89.250.178长沙4233.2.3.0/24117.89.250.178华北233.2.3.0/24117.89.250.178南昌533.2.2.0/24117.89.250.178华南233.2.0.0/24117.89.250.178青岛2033.2.1.0/24117
首发!站长解锁流量变现新径:广告联盟赚钱策略
  在当今数字化时代,流量变现已经成为许多站长关注的重要话题。而广告联盟作为一种有效的流量变现方式,正受到越来越多站长的青睐。那么,站长如何利用广告联盟赚钱呢?  站长需要明确自己的网站定位和目标受众。只有了解了自己的受众
阿里支付 java 部分退款
文章目录分布式事务1. 基础概念1.1 什么是事务1.2 本地事务1.3 分布式事务1.4 分布式事务产生的情景2. 分布式事务基础理论2.1 CAP理论2.1.1 理解CAPC - ConsistencyA - AvailabilityP - Partition tolerance2.1.2 CAP组合方式CAP的组合方式
新能源汽车的关键塑料件都在这了!(含国内最新政策一览)
2020年,虽然疫情疯狂肆虐了一把汽车市场,但是新能源汽车组我诶未来汽车类产品的主流研发方向,未来趋势依然是被看好的。虽然大家都听说过新能源汽车,但却未必知道新能源汽车中使用到什么样的材料。下面我么就一起了解一下新能源汽车的关
视频外链批量导入:优化策略与全面规划
在当今数字营销领域,视频外链建设已成为提升网站可见度和建立反向链接策略的重要组成部分。通过批量导入视频外链,企业可以有效地扩展其外链网络并提高其在搜索引擎结果页面(SERP)的排名。外链规划阶段明确定义外链规划的目标,例如增加
中国青年报:近八成受访大学生认为需要减少对算法推荐的依赖
  就读于西北师范大学的刘昊冉觉得算法无处不在,“有时仅仅是和同学聊天谈到某个话题,打开手机就会发现相关推荐已经出现在各类软件里了”。刘昊冉对这样的推荐不太满意,“感觉隐私在算法面前暴露无遗”。  近日,中国青年报·中青校
相关文章
推荐文章
发表评论
0评