Matlab全局最优算法-Global Search

文章目录

目录

目录

文章目录

GlobalSearch

Description 描述

Creation

Syntax

Description 语法描述: 

Properties属性(详情见matlab help:Global Search)

Object Function 

GS流程

流程如下:

Examples (MATLAB help的4个例子代码)

        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全局或多个起点搜索

Functions

Objects

代码模块Topic:

一、GlobalSearch and MultiStart Optimization Basics      

          GlobalSearch和MultiStart优化基础知识

二、Optimization Workflow        优化工作流

三、Techniques for Effective Search        有效搜索技术

四、Examine Results 检查结果

五、Multiple Start Solver Background        多起点解算器背景



GlobalSearch

全局搜索: 查找全局最小值

Description 描述

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

gs = GlobalSearch(Name,Value)

gs = GlobalSearch(oldGS,Name,Value)

gs = GlobalSearch(ms)

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 多启动求解器的公共属性值。

example

gs = GlobalSearch creates gs, a GlobalSearch solver with its properties set to the defaults.

example

gs = GlobalSearch(Name,Value) sets properties using name-value pairs.

example

gs = GlobalSearch(oldGS,Name,Value) creates a copy of the oldGS GlobalSearch solver, and sets properties using name-value pairs.

example

gs = GlobalSearch(ms) creates gs, a GlobalSearch solver, with common property values from the ms MultiStartsolver.

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从这些过滤点的开始进行搜索。

  1. 函数描述
  2. 建立结构体problem= createOptimProblem('fmincon','objective',...);
  3. 配置GlobalSearch求解器 gs=GlobalSearch
  4. 运行求解器run(GS,problem)
  5. 举例
        %% 
         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

createOptimProblemCreate optimization problem structure
listList start points
runRun multiple-start solver

Objects

Solvers

GlobalSearchFind global minimum
MultiStartFind multiple local minima

Supporting Objects

CustomStartPointSetCustom start points
GlobalOptimSolutionOptimization solution
RandomStartPointSetRandom 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.2 Create Problem Structure

提供创建问题结构的详细步骤。

2.3 Create Solver Object

描述解算器对象是什么,以及如何设置其属性。

2.4 Set Start Points for MultiStart

提供有关设置起点的方法的详细信息。

2.5 Run the Solver

提供GlobalSearch和MultiStart的完整工作流的基本示例。

三、Techniques for Effective Search        有效搜索技术

3.1 Parallel MultiStart

Shows how to compute in parallel for faster searches.

演示如何并行计算以加快搜索速度。

3.2 Isolated Global Minimum

An extended example showing ways to search for a global minimum.

一个扩展示例,显示搜索全局最小值的方法。

3.3 Refine Start Points

Examples of how to search your space effectively and efficiently.

如何高效搜索空间的示例。

3.4 Change Options

Considerations in setting local solver options and global solver properties.

设置局部解算器选项和全局解算器属性时的注意事项。

3.5 Reproduce Results

How to set random seeds to reproduce results.

如何设置随机种子以重现结果。

四、Examine Results 检查结果

4.1 Iterative Display

Describes the two types of iterative display for monitoring solver progress.

描述用于监视解算器进度的两种迭代显示类型。

4.2 Global Output Structures

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.

描述解算器算法。

5.3 Single Solution

Describes the first output, usually called x, from GlobalSearch and MultiStart.

描述来自GlobalSearch和MultiStart的第一个输出,通常称为x。

5.4 Multiple Solutions

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对象的属性。

  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
matlab最优化程序包括:无约束一维极值问题、进退法、黄金分割法、斐波那契法、牛顿法基本牛顿法、全局牛顿法、割线法、抛物线法、三次插值法、可接受搜索法、Goidstein法、Wolfe Powell法、单纯形搜索法、Powell法、最速下降法、共轭梯度法、牛顿法、修正牛顿法、拟牛顿法、信赖域法、显式最速下降法、Rosen梯度投影法、罚函数法、外点罚函数法、內点罚函数法、混合罚函数法、乘子法、G-N法、修正G-N法、L-M法、线性规划、单纯形法、修正单纯形法、大M法、变量有界单纯形法、整数规划、割平面法、分支定界法、0-1规划、二次规划、拉格朗曰法、起作用集算法、路径跟踪法、粒子群优化算法、基本粒子群算法、带压缩因子的粒子群算法、权重改进的粒子群算法、线性递减权重法、自适应权重法、随机权重法、变学习因子的粒子群算法、同步变化的学习因子、异步变化的学习因子、二阶粒子群算法、二阶振荡粒子群算法 (matlab optimization process includes Non-binding one-dimensional extremum problems Advance and retreat method Golden Section Fibonacci method of basic Newton s method Newton s method Newton s Law of the global secant method parabola method acceptable to the three interpolation search method Goidstein France Wolfe.Powell France Simplex search method Powell steepest descent method Conjugate gradient method Newton s method Newton s method to amend Quasi-Newton Method trust region method explicitly steepest descent method, Rosen gradient projection method Penalty function method outside the penalty function method within the penalty function method Mixed penalty function multiplier method G-N was amended in G-N method L-M method Of linear programming simplex method, revised simplex method Big M method variables bounded simplex method, Cutting Plane Method integer programming branch and bound method 0-1 programming quadratic programming )
MATLAB全局对象是指在MATLAB环境中被声明为全局变量的对象。全局对象和全局变量一样,可以在MATLAB的不同函数或脚本中共享和访问。通过将变量声明为全局变量,可以使其在多个函数中保持相同的值,并且在对该变量进行更改时,更改会在所有使用该全局对象的函数中生效。这样可以方便地在不同的代码段中共享和传递数据。 在MATLAB中,可以使用关键字"global"将特定的变量声明为全局变量。通过将变量定义为"global",可以将其作为全局对象在不同的函数中使用。全局对象的值可以在不同的函数中进行修改,并且这些修改会在使用该全局对象的所有函数中得到反映。 使用全局对象有助于简化代码的编写和维护,特别是在有多个函数需要共享数据时。然而,过度使用全局对象可能会导致代码的可读性和可维护性降低,所以需要谨慎使用。 综上所述,MATLAB全局对象是在MATLAB环境中声明为全局变量的对象,可以在不同的函数中共享和访问,并且在对其进行更改时,更改会在所有使用该全局对象的函数中生效。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Matlab全局最优算法-Global Search](https://blog.csdn.net/weixin_52375817/article/details/127347277)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [MATLAB矩阵基础操作,提供一些基础操作示例](https://download.csdn.net/download/li171049/88249335)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Matlab 全局变量定义与使用](https://blog.csdn.net/baidu_41922078/article/details/123324125)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值