Multistart parameter space and fval return
2 views (last 30 days)
Show older comments
Soham
on 5 Sep 2015
Answered: Abdelmoumen Bacetti
on 29 Nov 2015
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 Comments
Accepted Answer
Walter Roberson
on 6 Sep 2015
The solution vector you are looking for is the 5th output returned by run(), but you are only saving the first 2 outputs.
1 Comment
Alan Weiss
on 8 Sep 2015
[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
More Answers (1)
Abdelmoumen Bacetti
on 29 Nov 2015
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 Comments
See Also
Categories
Find more on Global or Multiple Starting Point Search in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!