Hello,

I am intending to formulate a convex optimization for a distribution system containing size of 13 bus of example. The variables are as such,

set: bi=bj=/bus1*bus13/;

voltage squared: v(bi)

line current: il(bi,bj)

line active power: pl(bi,bj)

line reactive power: ql(bi,bj)

line resistance: R(bi,bj)

line reactance: X(bi,bj)

connection matrix of the buses: c(bi,bj)

Now, I am trying to represent the following equation:

V_i^2 - V_j^2 = 2(P_ij*R_ij + Q_ij*X_ij) - Z_ij^2*I_ij^2

in the form of,

c(bi,bj)*(v(bi)-v(bj)) =e= c(bi,bj)*(2*(pl(bi,bj)*R(bi,bj) + ql(bi,bj)*X(bi,bj)) - (sqr(R(bi,bj))+sqr(X(bi,bj)))*il(bi,bj));

after including this constraint the GAMS solver gives me an error saying

"The problem contains both conic and non-linear constraints."

Btw, I have a conic constraint in my formulation, but I couldn't see how the aforementioned equation is non-linear and how can I resolve it. Please help me in this regard. Thank you.

## Non linear constraint in a convex optimization.

### Re: Non linear constraint in a convex optimization.

Hi

The square of a variable is non-linear, so you now have an NLP. I don't know how to make the square (approximately) linear except for using Taylor series.

Cheers

Renger

The square of a variable is non-linear, so you now have an NLP. I don't know how to make the square (approximately) linear except for using Taylor series.

Cheers

Renger

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist

### Re: Non linear constraint in a convex optimization.

Thank you sir for your reply. But I defined the squared of voltage magnitude V_i^2 with a new variable v(bi) and current squared with il(bi,bj). So, in the equation

c(bi,bj)*(v(bi)-v(bj)) =e= c(bi,bj)*(2*(pl(bi,bj)*R(bi,bj) + ql(bi,bj)*X(bi,bj)) - (sqr(R(bi,bj))+sqr(X(bi,bj)))*il(bi,bj));

there isn't any squared variable. R(bi,bj) and X(bi,bj) are parameters with fixed values not variables. That's why I was confused.

c(bi,bj)*(v(bi)-v(bj)) =e= c(bi,bj)*(2*(pl(bi,bj)*R(bi,bj) + ql(bi,bj)*X(bi,bj)) - (sqr(R(bi,bj))+sqr(X(bi,bj)))*il(bi,bj));

there isn't any squared variable. R(bi,bj) and X(bi,bj) are parameters with fixed values not variables. That's why I was confused.

### Re: Non linear constraint in a convex optimization.

Hi

In that case you should not write "the variables are such that... including X and R.

It is good practice to make a clear distinction between variables and parameters in your code (e.g. variables in capitals and parameters in lower case).

You have also a product of c * v and c * pl, so if these are variables, this is non-linear.

Cheers

Renger

In that case you should not write "the variables are such that... including X and R.

It is good practice to make a clear distinction between variables and parameters in your code (e.g. variables in capitals and parameters in lower case).

You have also a product of c * v and c * pl, so if these are variables, this is non-linear.

Cheers

Renger

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist

### Re: Non linear constraint in a convex optimization.

c(bi,bj) is also a parameter which denotes the connection between nodes. To re-write the equations as you said, variables as capital and parameters as small,

c(bi,bj)*(V(bi)-V(bj)) =e= c(bi,bj)*(2*(PL(bi,bj)*r(bi,bj) + QL(bi,bj)*x(bi,bj)) - (sqr(r(bi,bj))+sqr(x(bi,bj)))*IL(bi,bj));

Thank you.

c(bi,bj)*(V(bi)-V(bj)) =e= c(bi,bj)*(2*(PL(bi,bj)*r(bi,bj) + QL(bi,bj)*x(bi,bj)) - (sqr(r(bi,bj))+sqr(x(bi,bj)))*IL(bi,bj));

Thank you.

### Re: Non linear constraint in a convex optimization.

Hi j

Please send the complete code as attachment.

Cheers

Renger

Please send the complete code as attachment.

Cheers

Renger

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist