GlobalSearch and MultiStart Syntax
Show older comments
Hi There
I want to use GlobalSearch and MultiStart for a parameter estimation problem using fmincon and lsqnonlin. The question is regarding the syntax. Both GlobalSearch for fmincon and MultiStart for lsqnonlin give the "not enough input argument " error. The objective function "Objective" that returns a value to fmincon has another function nested in it that gives the results of a set of ODEs. How do we add that in the createproblem of globalsearch or multistart, because the error point to that ode output function? Part of the code is written below.
Thanx
options=optimset('Algorithm','sqp','DiffMinChange',5,'MaxIter',7000,'MaxFunEvals',7000,'TolX',1e-10,'TolFun',1e-10,'ObjectiveLimit',1e-12);
lb=[0 0 0 0 0 0 0 0 0 0 0 0 0 0];
ub=[inf inf inf inf inf inf inf inf inf inf inf inf inf inf];
A=[];
b=[];
Aeq=[];
beq=[];
problem=createOptimProblem('fmincon','objective',Objective,'A',A0,'lb',lb,'ub',ub,'Aineq',A,'bineq',b,'Aeq',Aeq,'beq',beq,'options',options);
gs = GlobalSearch;
[xmin,Fmin] = run(gs,problem)
[Parameters,fval,exitflag,output]=fmincon(@(A) Objective (wd,fd,A),A0,A,b,Aeq,beq,lb,ub,nonlcon,options);
Answers (1)
Alan Weiss
on 30 Jun 2014
0 votes
Can you run fmincon alone without a syntax error? If not, get that debugged first. If so, then please show us exactly what MATLAB returns as the error when you try to run GlobalSearch or MultiStart, and exactly what Objective is in the createOptimProblem argument.
One other thing. It seems that you use A as both the anonymous function parameter and the linear inequality matrix. Perhaps this is an error, but perhaps not.
Alan Weiss
MATLAB mathematical toolbox documentation
4 Comments
Nath
on 14 Jul 2014
Alan Weiss
on 15 Jul 2014
Thank you for including your code. Your function 'Objective' takes 3 input arguments. When you ran fmincon alone, you called 'Objective' using the correct syntax @(A) Objective(wd,fd,A).
However, when you encoded the problem for MultiStart, you call 'Objective' alone. Instead, you should call it as @(A) Objective(wd,fd,A):
problem = createOptimProblem('fmincon','objective',@(A)Objective(wd,fd,A),...
You have some other minor deficiencies in your code, too, but they are not fatal.
- Do not set the 'LargeScale' option for fmincon.
- Do you really want DiffMinChange to be 5? If so, then set DiffMaxChange to be even larger.
- You do not have to pass UB as all infs. You can just pass UB as [].
Alan Weiss
MATLAB mathematical toolbox documentation
Nath
on 8 Aug 2014
Categories
Find more on Global or Multiple Starting Point Search in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!