迭代显示为您提供了求解器运行过程中的进度信息。
迭代显示有两种类型:
全球解算器显示
当地的解算器显示
这两种类型都出现在命令行中,具体取决于全局选项和本地选项。
通过设置,获得局部求解器迭代显示显示
选项problem.options
字段“通路”
或“iter-detailed”
与optimoptions
.有关更多信息,请参见迭代显示.
通过设置,得到全局求解器迭代显示显示
财产的GlobalSearch
或MultiStart
对象“通路”
.
全局求解器设置默认值显示
的本地求解器选项“关闭”
,除非问题结构有此选项的值。全局求解器不会覆盖您为本地选项所做的任何设置。
请注意
设置本地求解器显示
除了“关闭”
可以产生大量的产出。默认的显示
选择创建的optimoptions (@
是解算器
)“最后一次”
.
运行中描述的示例运行解算器使用GlobalSearch
与GlobalSearch
迭代显示:
% %设置随机流以获得完全相同的输出% rng(14,'twister') gs = GlobalSearch('Display','iter');选择= optimoptions (@fmincon、“算法”、“内点”);sixmin = @ (x) (4 * x (1) ^ 2 - 2.1 * (1) ^ 4 + x(1) ^ 6/3……x(1)*x(2) - 4*x(2)^2 + 4*x(2)^4;问题= createOptimProblem (fmincon, x0,[1、2],…sixmin“客观”,“磅”,[3 3],乌兰巴托,3,3,…“选项”,选择);[xm,调频,兴,outptg manyminsg] =运行(gs、问题);Num分最佳电流阈值当地当地分析F-count f (x)点球点球f (x) exitflag过程0 34 -1.032 -1.032 1初始点200 1275 -1.032 -0.2155 1第1阶段本地300 1377 -1.032 248.7 -0.2137第二阶段搜索400 1477 -1.032 278 1.134阶段2 446 1561 -1.032 1.6 2.073 -0.2155 1阶段2当地500 1615 -1.032 9.055 0.3214阶段2 Search 600 1715 -1.032 -0.7299 -0.7686 Stage 2 Search 700 1815 -1.032 0.3191 -0.7431 Stage 2 Search 800 1915 -1.032 296.4 0.4577 Stage 2 Search 900 2015 -1.032 10.68 0.5116 Stage 2 Search 1000 2115 -1.032 -0.9207 -0.9254 Stage 2 Search GlobalSearch stopped because it analyzed all the trial points. All 3 local solver runs converged with a positive local solver exit flag.
运行相同的示例GlobalSearch
反复展示,但与fmincon
迭代显示:
gs。显示= '最后';problem.options.Display =“iter”;[xm,调频,兴,outptg manyminsg] =运行(gs、问题);Iter的一阶范数f(x)可行性优化步骤0 3 -1.980435e-02 0.000e+00 1.996e+00 1 9 -6.970985e-02 0.000e+00 3.140e+00 2.533e-01 2 13 -8.662720e-02 0.000e+00 2.775e+00 1.229e-01 3 18 - 1.1769720e -01 0.000e+00 1.629e -01 4 21 -2.132377e-01 0.000e+00 2.097e-01 8.636e-02 5 24 -2.153982e-01 0.000e+00 7.701e-02 1.504e- 0130 -2.154637e-01 0.000e+00 1.222e-03 1.039e-03 8 33 -2.154638e-01 0.000e+00 1.543e-04 8.413e-05 9 36 -2.154638e-01 0.000e+00 1.543e-06 6.610e-06 10 39 -2.154638e-01 0.000e+00 1.547e-02 1.734e-03 7.751e-08满足约束条件的局部最小值。优化完成的原因是目标函数在可行方向上不减小到函数公差的选定值内,约束条件满足到约束公差的选定值内。Iter的一阶范数f(x)可行性优化步骤0 3 -1.980435e-02 0.000e+00 1.996e+00…许多迭代被删除…3 33 -1.031628e+00 0.000e+00 Optimization completed because the objective function is non-decreasing in feasible directions, to within the selected value of the function tolerance, and constraints were satisfied to within the selected value of the constraint tolerance. GlobalSearch stopped because it analyzed all the trial points. All 4 local solver runs converged with a positive local solver exit flag.
设置GlobalSearch
反复展示,以及fmincon
迭代显示,产生两种显示混合。
有关并行环境中迭代显示的示例,请参见平行MultiStart.