Optimization using fmincon with respect to 2 variables

3 views (last 30 days)
Hello, I'm trying to implement this optimization problem by using fmincon in Matlab . I'm struggling to adapt my constrained conditions in the attached figure to parameters A,b,Aeq,beq, lb,ub,nonIcon in fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon). Like you can also notice,my function depends on 2 variables HatAlpha and HatC. Please note that HatAlpha is a (m+1 x 1)vector and HatC is a (m+1 x m+1) matrix. This is why I'm also wondering if I have to create a new function variable that contains both of them for fmincon. Thank you for any tipp

Accepted Answer

Alan Weiss
Alan Weiss on 21 Dec 2021
I think that you would find it much easier to use the problem-based approach rather than fmincon directly. The reason is that with fmincon you have to put all of the control variables into one vector, typically called x. This x would contain both HatAlpha and HatC. With the problem-based approach, you are free to use the variables that are most natural for your problem.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Alan Weiss
Alan Weiss on 2 Mar 2022
I stand by my previous comments. It is clear from the exit message that, as far as fmincon is concerned, the constraints are satisfied at the end. If you disagree, it is because you have a different notion of constraint satisfaction.
I told you earlier that your initial constraint function value was extremely large. That has come back to cause you issues now. I suggest again that you rerun the solver from the final point to get your constraint infeasibility to a better value. You culd also scale your constraint infeasibility by, say, taking a nonlinear transformation such as
consval = 1e3*tanh(consval/1e3);
before you return the value.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by