Switching model parameters for optimization problem
Show older comments
Hi everyone,
I am currently working on a classic quadratic optimization problem, which I solved with
sol = quadprog(H,f,A,b,Aeq,beq,lb,ub,x0,options)
The solution is a state of energy trajectory subject to the differential equation given below:

The state of energy dynamics are formulated as equality constraints (
,
), so I can use them for the quadprog solver.
My issue here is that the battery efficiency η switches between two values (
,
) according to the sign of the input/output
. My current solution is only based on
, no matter which sign
has, because I wasn't sure how to put such an "if-statement" in the solver.
How can I consider this in my optimization formulation? Can I still use quadprog or do I have to use some other methods?
Best Regards
Sean
2 Comments
It is not at all clear how the inputs to quadprog were derived from the parameters of your differential equation, or what the quadprog output represents. Why can't you invoke quadprog on two separatetwo sub-problems, one for each possible value of the switch?
Sean Shugar
on 26 Apr 2021
Answers (1)
I'm assuming x is unknown and u is known. Wouldn't it then just be,
Ppos=(u>=0);
Bu=nan(size(u)); %the vector B*u
Bu(Ppos)=u(Ppos)*eta;
Bu(~Ppos)=u(~Ppos)/eta;
Categories
Find more on Quadratic Programming and Cone Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!