文章目录
目录
目录
Properties属性(详情见matlab help:Global Search)
Run GlobalSearch on Multidimensional Problem
Run GlobalSearch on 1-D Problem
GlobalSearch Using Common Properties from MultiStart
Update GlobalSearch Properties
Problems That GlobalSearch and MultiStart Can Solve
How GlobalSearch and MultiStart Work
Global or Multiple Starting Point Search全局或多个起点搜索
一、GlobalSearch and MultiStart Optimization Basics
三、Techniques for Effective Search 有效搜索技术
五、Multiple Start Solver Background 多起点解算器背景
GlobalSearch
全局搜索: 查找全局最小值
Description 描述
A GlobalSearch
object contains properties (options) that affect how run
repeatedly runs a local solver to generate a GlobalOptimSolution object. When run, the solver attempts to locate a solution that has the lowest objective function value.
全局搜索对象包含的属性(选项)会影响运行如何重复运行局部求解器以生成全局优化解决方案对象。运行时,求解器将尝试查找具有最低目标函数值的解。
Creation
Syntax
gs = GlobalSearch(oldGS,Name,Value)
gs = GlobalSearch
gs = GlobalSearch(Name,Value)
gs = GlobalSearch(oldGS,Name,Value)
gs = GlobalSearch(ms)
Description 语法描述:
gs = 全局搜索创建 gs,这是一个全局搜索求解器,其属性设置为默认值。 |
gs = 全局搜索(名称,值)使用名称-值对设置属性。 |
gs = 全局搜索(oldGS,名称,值)创建oldGS全局搜索求解器的副本,并使用名称-值对设置属性。 |
gs = 全局搜索(ms) 创建 gs,即全局搜索求解器,具有来自 ms 多启动求解器的公共属性值。 |
|
|
|
|
Properties属性(详情见matlab help:Global Search)
BasinRadiusFactor—盆地半径减小系数 0.2(默认)|从0到1的标量 |
Display-命令窗口的显示级别 “final”(默认)|“iter”|“off” |
DistanceThresholdFa距离阈值因子-确定试验点的乘数在现有流域中 0.75(默认)|非负标量 |
FunctionTolerance-考虑解决方案相等时的函数值公差 1e-6(默认)|非负标量 |
MaxTime—GlobalSearch运行的最长时间(秒) Inf(默认)|正标量 |
MaxWaitCycle-算法控制参数 20(默认)|正整数 |
NumStageOnePoints-阶段1点数 200(默认)|正整数 |
NumTrialPoints—潜在起点的数量 1000(默认)|正整数 |
OutputFcn-报告解算器进度或暂停解算器 [](默认)|函数句柄|函数句柄的单元格数组 |
PenaltyThresholdFactor-惩罚阈值因子-惩罚阈值增加 0.2(默认)|正标量 |
PlotFcn-绘图求解器进度 [](默认)|函数句柄|函数句柄的单元格数组 |
StartPointsToRun-要运行的起点 “all”(默认)|“bounds”|“bonds ineqs” |
XTolerance-考虑溶液相等时的距离公差 1e-6(默认)|非负标量 |
Object Function
run |
运行多启动解算器
GS流程
流程如下:
GlobalSearch,试图找到与最低的目标函数值。全局搜索求解器首先生成基于分散搜索的试验点。然后过滤这些试验点,然后和fmincon从这些过滤点的开始进行搜索。
- 函数描述
- 建立结构体problem= createOptimProblem('fmincon','objective',...);
- 配置GlobalSearch求解器 gs=GlobalSearch
- 运行求解器run(GS,problem)
- 举例
%% problem = createOptimProblem('fmincon','objective',G,'x0',x0(1),'lb',lb,... 'ub',ub,'options',optimset('Algorithm','SQP','Disp','none')); gs = GlobalSearch; [p,G] = run(gs,problem);
Examples (MATLAB help的4个例子代码)
Run GlobalSearch
on Multidimensional Problem
rng default % For reproducibility
gs = GlobalSearch;
sixmin = @(x)(4*x(1)^2 - 2.1*x(1)^4 + x(1)^6/3 ...
+ x(1)*x(2) - 4*x(2)^2 + 4*x(2)^4);
problem = createOptimProblem('fmincon','x0',[-1,2],...
'objective',sixmin,'lb',[-3,-3],'ub',[3,3]);
x = run(gs,problem)
fval=sixmin(x)
Run GlobalSearch
on 1-D Problem
%% 对一维问题运行GlobalSearch
%要搜索全局最小值,请使用fminco“sqp”算法运行GlobalSearch。
fun=@(x) x.^2+4*sin(5*x);
fplot(fun,[-5,5]);
opts=optimoptions(@fmincon,'Algorithm','sqp');
gs=GlobalSearch;
problem=createOptimProblem('fmincon','x0',1,'objective',fun,'lb',-5,'ub',5,'options',opts);
[x,f]=run(gs,problem)
GlobalSearch
Using Common Properties from MultiStart
%使用MultiStart的公共属性进行全局搜索
clc;clear;
ms = MultiStart('FunctionTolerance',2e-4,'UseParallel',true)
%创建使用ms中可用属性的GlobalSearch对象。
gs = GlobalSearch(ms)
%gs具有与ms相同的FunctionTolerance非默认值。但gs不使用UseParallel属性。
Update GlobalSearch
Properties
%Create a GlobalSearch object with a FunctionTolerance of 1e-4.
gs = GlobalSearch('FunctionTolerance',1e-4)
gs = GlobalSearch(gs,'XTolerance',1e-3,'StartPointsToRun','bounds')
%Update the XTolerance property to 1e-3 and the StartPointsToRun property to 'bounds'.
%You can also update properties one at a time by using dot notation.
%gs.MaxTime = 1800
Problems That GlobalSearch and MultiStart Can Solve
(matlab help可以搜到)
GlobalSearch和MultiStart可以解决的问题
GlobalSearch和MultiStart解算器适用于具有平滑目标和约束函数的问题。解算器搜索全局最小值或一组局部最小值。有关要使用哪个解算器的详细信息,请参见选择解算器表。
GlobalSearch和MultiStart通过从各种起点启动局部解算器(如fmincon)来工作。通常起点是随机的。但是,对于MultiStart,您可以提供一组起点。有关详细信息,请参阅GlobalSearch和MultiStart的工作原理。
要了解如何使用这些解算器,请参见GlobalSearch和MultiStart的工作流。
How GlobalSearch and MultiStart Work
(matlab help :How GlobalSearch and MultiStart Work 可以搜到)
也可点击蓝色链接跳转到CSDN中:(GlobalSearch) 全局搜索和(MultiStart)多起点方法,里面是另一位作者比较的各种全局搜索方法
Global or Multiple Starting Point Search全局或多个起点搜索
基于梯度优化的多个起点解算器,有约束或无约束
这些解算器适用于具有光滑目标函数和约束的问题。他们运行优化工具箱™ 解算器反复尝试定位全局解决方案或多个局部解决方案。
Functions
createOptimProblem | Create optimization problem structure |
list | List start points |
run | Run multiple-start solver |
Objects
Solvers
GlobalSearch | Find global minimum |
MultiStart | Find multiple local minima |
Supporting Objects
CustomStartPointSet | Custom start points |
GlobalOptimSolution | Optimization solution |
RandomStartPointSet | Random start points |
代码模块Topic:
一、GlobalSearch and MultiStart Optimization Basics
GlobalSearch和MultiStart优化基础知识
1.1 Find Global or Multiple Local Minima
示例显示GlobalSearch返回的解决方案少于MultiStart,通常质量更高。
1.2 Maximizing Monochromatic Polarized Light Interference Patterns Using GlobalSearch and MultiStart
在具有多个局部极小值的问题中寻找全局极小值。
1.3 Optimize Using Only Feasible Start Points
演示如何避免从不可行点开始的示例。
1.4 MultiStart Using lsqcurvefit or lsqnonlin
演示如何使用MultiStart帮助查找最小平方问题的全局最小值。
二、Optimization Workflow 优化工作流
2.1 Workflow for GlobalSearch and MultiStart
如何设置和运行解算器。
提供创建问题结构的详细步骤。
描述解算器对象是什么,以及如何设置其属性。
2.4 Set Start Points for MultiStart
提供有关设置起点的方法的详细信息。
提供GlobalSearch和MultiStart的完整工作流的基本示例。
三、Techniques for Effective Search 有效搜索技术
Shows how to compute in parallel for faster searches.
演示如何并行计算以加快搜索速度。
An extended example showing ways to search for a global minimum.
一个扩展示例,显示搜索全局最小值的方法。
Examples of how to search your space effectively and efficiently.
如何高效搜索空间的示例。
Considerations in setting local solver options and global solver properties.
设置局部解算器选项和全局解算器属性时的注意事项。
How to set random seeds to reproduce results.
如何设置随机种子以重现结果。
四、Examine Results 检查结果
Describes the two types of iterative display for monitoring solver progress.
描述用于监视解算器进度的两种迭代显示类型。
Describes the types of output structures that GlobalSearch and MultiStart can return.
描述GlobalSearch和MultiStart可以返回的输出结构类型。
4.3 Visualize the Basins of Attraction
Example showing how to plot multiple initial and final points in a 2-D problem.
演示如何在二维问题中绘制多个初始点和最终点的示例。
4.4 Output Functions for GlobalSearch and MultiStart
Provides details and an example of monitoring and halting solvers by using output functions.
提供使用输出函数监视和暂停解算器的详细信息和示例。
4.5 Plot Functions for GlobalSearch and MultiStart
How to use both built-in and custom plot functions for monitoring solution progress.
如何使用内置和自定义绘图功能来监视解决方案进度。
五、Multiple Start Solver Background 多起点解算器背景
5.1 Problems That GlobalSearch and MultiStart Can Solve
GlobalSearch and MultiStart apply to smooth problems where there are multiple local solutions.
GlobalSearch和MultiStart适用于存在多个本地解决方案的平滑问题。
5.2 How GlobalSearch and MultiStart Work
Describes the solver algorithms.
描述解算器算法。
Describes the first output, usually called x, from GlobalSearch and MultiStart.
描述来自GlobalSearch和MultiStart的第一个输出,通常称为x。
Describes how to obtain multiple solutions from GlobalSearch and MultiStart, and how to change the definition of distinct solutions.
描述如何从GlobalSearch和MultiStart获取多个解决方案,以及如何更改不同解决方案的定义。
5.5 GlobalSearch and MultiStart Properties (Options)
Describes properties of GlobalSearch and MultiStart objects.
描述GlobalSearch和MultiStart对象的属性。