How to set up user-supplied Hessian in fmincon for a minimization problem with nonlinear objective and nonlinear constraint?

2 views (last 30 days)
The problem I am trying to solve is a statics bar and string problem for minimization of mass under static load and self gravity.
When I try running the code, it's giving warning of the following:
The error seems to be due to the size of gceq,which is the gradient of nonlinear constraint defined in
  • gravity_nonlin_con_V20.m
However, from the structure of my case the actual size should be 6*10, where 6 is no. of members and 10 is no. of static equations. I tried to supply it experimentally with
gceq=ones(6,100)
The fmincon fails as:
These two errors are likely from the internal structure of fmincon, and currently I am not able to find the solution. Can anyone try running my code and supply with some possible solutions? Thanks!
FYI:
Main program is
  • Main_D_Bar_Gravity.m
For fmincon, I use it to solve for the force density x: unit force in each structure member. For fmincon, check
  • tenseg_equilibrium_V20.m
The nonlinear objective function with gradient as well as hessian is
  • gravity_nonlin_objec_v20.m
The nonlinear constraint function with gradient as well as hessian is
  • gravity_nonlin_con_V20.m
The user supplied hessian is
  • hessian_BAI_v20.m

Answers (2)

Matt J
Matt J on 30 Mar 2019
Edited: Matt J on 31 Mar 2019
These two errors are likely from the internal structure of fmincon,
No, not really. The second error should be very easy for you to investigate. The error message has told you that your objective function is undefined at the initial point. So, if you just test gravity_nonlin_objec_v20.m by running it at your intial point and seeing what it spits out, you should be able to discover right away what the error message is talking about.
The first error is because the length of the ceq variable that you are generating is 100, and so fmincon expects gceq to have 100 columns. You seem to think length(ceq) should be 10, but I'm betting that a test of gravity_nonlin_con_V20.m will show otherwise.
  3 Comments
Matt J
Matt J on 2 Apr 2019
Edited: Matt J on 2 Apr 2019
Do you know a feasible point that you can use for the initial guess? If so, it might help.
Incidentally, when you report Matlab screen messages here in the forum, you should probably just copy/paste them as text, rather than as an image. It consumes a lot more memory on the Answers forum if you do the latter.

Sign in to comment.


Alan Weiss
Alan Weiss on 3 Apr 2019
For general advice related to this sort of problem, see Converged to an Infeasible Point.
Alan Weiss
MATLAB mathematical toolbox documentation
  1 Comment
Xiaolong Bai
Xiaolong Bai on 5 Apr 2019
Thank you Alan!
I have checked the advice troubleshooting page earlier and tried to apply different inital values (including the theratical ones), as well as supporting with gradient and hessian information for fmincon solver. Unfortunately, the solver still won't converge once.
I couldn't find more document on detailed advice for convergence upon using Hessian in fmincon. Would you please try my codes and see if more can be supplied (I am sorry that the whole package is a bit messy)? Thank you!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!