Change the Form of Formula

(zhangQK) #1

E-(E^2-2*R*C*E*P)^0.5<=I*R*(2*C*E)^0.5;and variables are E and P.
Many articles show this formula is convex,but it can not be accepted by cvx.
So I want to know how I can change the form of the formula so that cvx can accept it.
Thank you.

(Mark L. Stone) #2

Please show us the proof that this constraint is convex. If it is convex, is there a rotated second order (Lorentz) cone representation?

(Michal Adamaszek) #3

To simplify notation a bit I wrote x-\sqrt{x^2-axy}\leq b\sqrt{x} with variables x,y and constants a,b. After rearranging, squaring, cancellation etc. I got some equivalent Lorentz cone formulations, for example 4b^2(x-ay)\geq (ay-b^2)^2.

(zhangQK) #4

Thank you,Michal_Adamaszek. Could you give me the process?Because I have some other similar formulas.

(Michal Adamaszek) #5

x\leq \sqrt{x^2-axy}+b\sqrt{x}

x^2\leq x^2-axy+2bx\sqrt{x-ay}+b^2x


I guess I assumed x\geq 0 along the way.

(zhangQK) #6

Thank you very much.
dE(t)/dt<=-(E-(E^2-E*P)^0.5);and variables are E and P. And dE(t)/dt is derivative.
I do not know how to deal with dE(t)/dt. So I want to know how to change the form of this formula so that cvx can accept it. Does derivative have properties of the convex function?

(Mark L. Stone) #7

CVX doesn’t “know” anything about derivatives. Do you have an explicit formula for the derivative? You will need to use that. Presumably the E on the ightr-hand side is also a function of t? But you don’t show that.

(zhangQK) #8

Yes,E and P both are functions of ‘t’ (E(t) and P(t)).
In addition,E(t)=(V(t))^2, and V(t) is a function of ‘t’ .
V(t)=a*SOC(t)+b,and SOC(t) is a function of ‘t’.
But there is not explicit formula for SOC(t).
But in cvx,E is the variable,so I do not think it need the formula of E(t)=(V(t))^2.

(Mark L. Stone) #9

You need explicit formulas for everything in CVX. You need an explicit formula for \frac{dE}{dT} Perhaps t needs to be your CVX variable. And if that doesn’t wind up being convex, you can not use CVX.

(zhangQK) #10

Because t is time(such as 1s,2s,3s,4s…),I can not let it become a cvx variable and I also can not disturb it.

(Mark L. Stone) #11

One way or another, you need an explicitt formulation for your optimization problem. If you can not do that, you can not use CVX for that problem.

(zhangQK) #12

Hi,Mark. dE(t)/dt can be replaced by discretization,just like E(k+1)-E(k) (and k is discrete time,such as 1s,2s,3s,4s…). So the formula of dE(t)/dt<=-(E-(E^2-E*P)^0.5) can become
the form of E(k+1)-E(k)<=-(E(k)-(E(k)^2-E(k)*P(k))^0.5).
So I want to know how to change the form of E(k+1)-E(k)<=-(E(k)-(E(k)^2-E(k)*P(k))^0.5) so that cvx can accept it.
Thank you.

(Michal Adamaszek) #14

That seems to be a rotated quadratic cone again:


(zhangQK) #15

Thank you,Michal_Adamaszek.
But the formula of E(k)(E(k)-P(k))>=E(k+1)^2 can not be accepted by cvx,because cvx does not allow multiplication of variables,although it is convex.

(Michal Adamaszek) #16

rotated_lorentz in

(zhangQK) #17

But the formula of E(k) *(E(k)-P(k))>=E(k+1)^2 can not be accepted by cvx,because cvx does not allow multiplication of variables.
So I want to know how I should do?
Thank you.

(Erling D.Andersen) #18

You have not understood the rotated lorentz cone. Indeed you have y=E(k) and z=E(k)-P(k) and x=E(k+1) so the multiplication is build into the cone the definition. You do not do it.

(Michal Adamaszek) #19

If you’re asking what the syntax is then probably {x, y, z} == rotated_lorentz(3)

(zhangQK) #20

Thank you very much,Michal_Adamaszek.
But in fact ,the formula of E(k+1)-E(k)<=-(E(k)-(E(k)^2-E(k)P(k))^0.5) is a simplified formula,and it have some constants which I do not show.
The real formula is the form of
(E(k)-(E(k)^2-c*E(k)*P(k))^0.5),and a,b and c are constants(b=0.1206, a=422.64, c=146.8).
So I want to know how to let the formula become a rotated quadratic cone.
Thank you.