MATLAB Answers

Devin
0

How to use parallel computation in globalsearch function?

Asked by Devin
on 7 Feb 2019
Latest activity Commented on by Kailin
on 9 Aug 2019
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 Comments

Sign in to comment.

2 Answers

Answer by Kailin
on 8 Aug 2019

Global search does not have parallel functionality according to this link.
Best,
K

  0 Comments

Sign in to comment.


Answer by Alan Weiss
on 9 Aug 2019

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 Comment

Thanks a lot Alan! I am running both but now I can drop globalsearch.
Best,
K

Sign in to comment.