GlobalSearch and MultiStart Syntax
이전 댓글 표시
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);
답변 (1개)
Alan Weiss
2014년 6월 30일
0 개 추천
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
Nath
2014년 7월 14일
Alan Weiss
2014년 7월 15일
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
2014년 8월 8일
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!