# How to use parallel computation in globalsearch function?

18 ビュー (過去 30 日間)
Devin 2019 年 2 月 7 日
Commented: Kailin 2019 年 8 月 9 日
Greetings,
Currently, I am working on a constraint nonlinear optimization problem and expect to find the feasible global minimum solution.
I try to creat a GlobalSearch object with MultiStart and use parallel computation to find global optimal solution. But I feel confused about documents. In this document (https://www.mathworks.com/help/gads/globalsearch-and-multistart-properties-options.html#bsdkk6), it mentions that I can creat GlobalSearch object with MultiStart.
In another document, it mentioned that MultiStart can use parallel computation (https://www.mathworks.com/help/gads/example-parallel-multistart.html). However, in another documentation (https://www.mathworks.com/help/gads/how-solvers-compute-in-parallel.html#bsc7xyp), it mentioned that GlobalSearch function cannot use parallel computation. How can I use multiStart with parallel computation to find global minimum?
I find this following code does not work.
ms = MultiStart('FunctionTolerance',1e-4,'UseParallel',true,'XTolerance',1e-4,'Display','iter',...
'StartPointsToRun','all','options',optimoptions(@fminunc,'UseParallel',true));
gs = GlobalSearch(ms);
problem = createOptimProblem('fmincon','x0',uInit,...
'objective',@ocp.cost,'Aineq',ocp.opt.A,'bineq',ocp.opt.b,'lb',ocp.opt.lb,'ub',ocp.opt.ub);
u = run(gs,problem);
I got error:
Error using AbstractGlobalSolver (line 187)
No public property options exists for MultiStart.
Error in MultiStart (line 111)
ms = ms@AbstractGlobalSolver(varargin{:});
If I use this code. It works but it is slow and seems that parallel computation does not work.
ms = MultiStart('FunctionTolerance',1e-4,'UseParallel',true,'XTolerance',1e-4,'Display','iter',...
'StartPointsToRun','all');
gs = GlobalSearch(ms);
problem = createOptimProblem('fmincon','x0',uInit,...
'objective',@ocp.cost,'Aineq',ocp.opt.A,'bineq',ocp.opt.b,'lb',ocp.opt.lb,'ub',ocp.opt.ub);
u = run(gs,problem);
How can I use multiStart with parallel computation to find global minimum; Or how can I find global minimum quickly?

#### 0 件のコメント

サインイン to comment.

### 件の回答 (2)

Kailin 2019 年 8 月 8 日
Global search does not have parallel functionality according to this link.
Best,
K

#### 0 件のコメント

サインイン to comment.

Alan Weiss 2019 年 8 月 9 日
I think that you are confused about what GlobalSearch and MultiStart do. Bottom line: I think that you should not use GlobalSearch at all, and instead should just use MultiStart.
Details: GlobalSearch is a heuristic algorithm that does not promise to find a global solution. It is worthwhile if your objective function is not very expensive, and if the basins of attraction in your problem are roughly spherical.
MultiStart is well described by its name: it starts a local solver (often fmincon) multiple times from different start points. Obviously, this does not guarantee that you get a global solution, but the longer you run, the more likely you are to get one. MultiStart can run in parallel, but GlobalSearch cannot.
I hope that I have convinced you that GlobalSearch is not the right choice for you, and you should ignore it.
Alan Weiss
MATLAB mathematical toolbox documentation

#### 1 件のコメント

Kailin 2019 年 8 月 9 日
Thanks a lot Alan! I am running both but now I can drop globalsearch.
Best,
K

サインイン to comment.

サインイン してこの質問に回答します。

R2018a

Translated by