Switching model parameters for optimization problem
显示 更早的评论
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
回答(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;
类别
在 帮助中心 和 File Exchange 中查找有关 Quadratic Programming and Cone Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!