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);

Answers (1)

Alan Weiss
Alan Weiss on 30 Jun 2014
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

Yes, I can run both fmincon and lsqnonlin without the Global or Multistart. The reason to use these features is to judge different local minima and get the global. The error is:
kineticsestimateglobfmin
Error using kineticsestimateglobfmin/Objective (line 82) Not enough input arguments.
Error in kineticsestimateglobfmin (line 48) problem=createOptimProblem('fmincon','objective',Objective,'A',A0,'lb',lb,'ub',ub,'Aineq',Ain,'bineq',b,'Aeq',Aeq,'beq',beq,'options',options);
I got rid of that similar "A" parameter but that does not seem to be an issue. The code is attached, the problem seems to be small but irritating.
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
Nath on 23 Jul 2014
Edited: Nath on 23 Jul 2014
Then another syntax error shows up for function handle: I'm testing in MATLAB 2013 which version have you tried, any difference?
Undefined function 'createOptimProblem' for input arguments of type 'function_handle'.
Error in kineticsestimateglobfmin (line 49) problem=createOptimProblem('fmincon','objective',@(A)Objective(wd,fd,A),'A',A0,'lb',lb,'ub',ub,'Aineq',Ain,'bineq',b,'Aeq',Aeq,'beq',beq,'options',options);
Do I report a bug on this matter?

Sign in to comment.

Asked:

on 27 Jun 2014

Commented:

on 8 Aug 2014

Community Treasure Hunt

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

Start Hunting!