Correct implementation of multi start option with pre-specified starters

7 ビュー (過去 30 日間)
Hello,
I need to solve an optimization problem with multi start option in which I supply the initial points completely. However, I got stocked and I really do not understand how it works. In this regard, I havw 2 questuions. Just consider the example in MATLAB as bellow:
fun = @(x) x.^2 + 4*sin(5*x);
rng default % For reproducibility
opts = optimoptions(@fmincon,'Algorithm','sqp');
problem = createOptimProblem('fmincon','objective',...
fun,'x0',3,'lb',-5,'ub',5,'options',opts);
ms = MultiStart;
[x,f] = run(ms,problem,20)
My first question is this:
What is the meaning of number 20 in the last command [x,f] = run(ms,problem,20)? Does it mean that the
fmincon algorithm is going to try a fixed starting points x0=3, 20 times? This makes no sense to me as one try with one starter is fine. Does it mean that fmincon is going to try 20 different starting points? This also does not make sense to me since it clearly does not respect MY STARTINF point(s).
My second question:
Now, imagine that I would like to try 3 starting points x0=-4,x0=-3,x0=-2 at the same time. I troed the following
fun = @(x) x.^2 + 4*sin(5*x);
N=3;x0=[-4;-3;-2];
lb1=-5.*ones(N,1);ub1=5.*ones(N,1);
opts = optimoptions(@fmincon,'Algorithm','sqp');
problem = createOptimProblem('fmincon','objective',...
fun,'x0',x0,'lb',lb1,'ub',ub1,'options',opts);
ms = MultiStart;[x,f] = run(ms,problem,1)
I really do not get why it throws error message. I did try a to write starting points and bounds in row vector form but it failed. I did try number '3' in the last command ms = MultiStart;[x,f] = run(ms,problem,1) but this also failed. I did try different combinations of these tries which also failed. Now, I have no idea why it does not work.
I need to solve a multidimensional optimization problem using several startes which I want to choose and have no idea to correctly implement it.
Thanks for your kind help in advance!
Babak

採用された回答

Alan Weiss
Alan Weiss 2023 年 4 月 14 日
編集済み: Alan Weiss 2023 年 4 月 14 日
If you read the description of MultiStart run, you see that calling run(ms,problem,k)) uses k - 1 random points in addition to the given x0. If you want to supply your own set of start points, create a CustomStartPointSet and pass it to run. OK?
Alan Weiss
MATLAB mathematical toolbox documentation

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGlobal or Multiple Starting Point Search についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by