Multistart parameter space and fval return
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
In the link below, please see section under Multistart -> Create GlobalOptimSolution Object.
It says that after Multistart reaches a stopping condition, it "creates a vector of GlobalOptimSolution". I am using multistart using the below syntax to solve a lsqnonlin problem to fit 6 parameters.
[x fval] = run(ms,problem,k)
But after multistart finishes going through all of the 'k' points, it returns just one value , the minimum value of fval that that found from 'k' different initial points and does not return a vector called 'GlobalOptimSolution' where all the values of fval are stored.
My questions are:
a)How can I get multistart to return a vector of all fvals as described in the section in the link above.
b) Is there a way I can see the kind of initial values matlab uses for the 'k' points ? I know that there are ways to give random OR custom start points but is there a way to know the initial values being used if I just specify 'k', i.e. number of initial points within given bounds to be sampled. Does MATLAB use some special code to generate 'k' values so that I can know that it is sampling the entire parameter space.
Thank you
0 个评论
采纳的回答
Walter Roberson
2015-9-6
The solution vector you are looking for is the 5th output returned by run(), but you are only saving the first 2 outputs.
1 个评论
Alan Weiss
2015-9-8
[x,fval,exitflag,output,solutions] = run(...) returns a vector of solutions containing the distinct local minima found during the run.
Alan Weiss
MATLAB mathematical toolbox documentation
更多回答(1 个)
Abdelmoumen Bacetti
2015-11-29
Actually I didn't know that Matlab allows automatically running optim problems with different start points. This is why I wrote my own multistart by generating random vectors and applying the upper and lower bounds.
I save everything (random start points, their respective solutions and performance indicators) in matrices.
lb = [ 50, 1e-4, 1e-4, 1e-4, 1e-4, 1e-4];
ub = [ 10000, 1, 1, 1, 1, 1];
nvars = 6;
nr = 100;
r = rand(nvars,nr);
x0 = zeros(nvars,nr);
xlsq = zeros(nvars,nr);
resnorm = zeros(nr);
for i=1:nr
x0(:,i) = (ub - lb) .* r(:,i)' + lb;
[xlsq(:,i),resnorm(i)] = lsqnonlin(@(x)ObjFcn(x, Additional_param), x0(:,i),lb,ub,lsqoptions);
end
best = find(resnorm==min(resnorm));
best_xlsq = xlsq(:,best);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Global or Multiple Starting Point Search 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!