How to add gradient or hessian matrix for fmincon in yalmip #1380
Unanswered
NickJay2
asked this question in
Optimization modelling
Replies: 1 comment 2 replies
-
Gradients are automatically computed and supplied to fmincon. Hessians are not supported so fmincon will use quasi-newton if it uses hessian |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a very complicated objective function, which results that the optimization not completed even after 10000 iterations. Actually, I can give the analytical solution of hessian matrix. Will accurate hessian matrix accelerate the optimization? If yes, how can I write the code to add analytical solution of the hessian matrix. Part of my cods is as below.
qx=sdpvar(N,1); qy=sdpvar(N,1); Constraints=[qx(1)==qx_I,qy(1)==qy_I,qx(N)==qx_F,qy(N)==qy_F]; for n=1:N-1 Constraints=[Constraints,((qx(n+1)-qx(n))^2+(qy(n+1)-qy(n))^2)<=(V_max*delta_t)^2]; end obj=0; for n=1:N obj=obj+sum(R_klb(a(n,:),b(n,:),gama0,H,C1,C2,B1,B2,wx,wy,qx(n),qy(n),qx_r(n),qy_r(n)).*... exp(-alpha*R_klb(a(n,:),b(n,:),gama0,H,C1,C2,B1,B2,wx,wy,qx(n),qy(n),qx_r(n),qy_r(n))))/... sum(exp(-alpha*R_klb(a(n,:),b(n,:),gama0,H,C1,C2,B1,B2,wx,wy,qx(n),qy(n),qx_r(n),qy_r(n)))); end Objective=-obj/N; ops = sdpsettings('fmincon.maxfunevals',10000,'fmincon.MaxIter',3000); sol=optimize(Constraints,Objective,ops);
Beta Was this translation helpful? Give feedback.
All reactions