Error in passing extra parameters in constraints with Fmincon

1 view (last 30 days)
Hi,
I was trying to pass extra parameters to the constraint when using fmincon function. But it always ended up with an error message saying "Too many output arguments." I am really puzzled...
Thanks in advance.
Tim
obj=@(x) -x(10);
x_ini=ones(9,1); x_ini(10)=0;
lb=[1; 1; 0;0;0; 0; 0;0;0; -Inf];
ub=[Inf ; Inf; Inf ; Inf; Inf ; 1; Inf; Inf ; Inf; Inf ];
options = optimset('Largescale','off','Display','iter');
nonlcon =@(x) opt_cons(x, tar_nodeficit , vata_nodeficit , inct_nodeficit , wL_nodeficit, D_nodeficit, t_share_nodeficit ,N,sigma,theta,eta);
x= fmincon(obj, x_ini, [],[],[],[],lb,ub,nonlcon);
The function opt_cons is specified and I have already give those extra parameters values.
  3 Comments
Stephan
Stephan on 22 Jul 2018
Hi,
as far as i know
optimset
doesnt work for
fmincon
Try optimoptions instead.
Best regards
Stephan
Tim Ji
Tim Ji on 23 Jul 2018
@Walter Roberson @Stephan Jung Thank you very much! I have figured out my problem: I mis-specified the output arguments of my function. But I still greatly appreciate your being helpful.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!