## **Infeasible solution

Solver related questions
gmud774
User
Posts: 4
Joined: 2 weeks ago

### **Infeasible solution

Hi,

** Infeasible solution. There are no super basic variables.
Please guide me how to solve this issue.
Here is my Formulation:

\$title Maximization of Revenue

SETS

i ’Power values in 24hours’ /i1*i24/

Scalars

SOC_max 'Maximum State of Charge' /400/
SOC_min 'Minimum State of Charge' /80/
SOC_start 'Starting State of Charge' /80/
Bp 'Battery Power limit' /80/
ita_c 'Charging efficiency' /0.8/
ita_d 'Discharging efficiency' /0.8/;

PARAMETERS

C(i) ’Power cost per hour’ /i1 59.064, i2 59.029, i3 61.85, i4 61.93, i5 60.61, i6 68.27, i7 88.04, i8 88.159, i9 94.74, i10 90.966, i11 92.4459, i12 88.46, i13 100.79, i14 98.9, i15 118.96, i16 164.34, i17 159.08, i18 94.05, i19 88.99, i20 113.5, i21 91.95, i22 72.11, i23 70.22, i24 56.059/
Pw(i) 'Forecasted Wind Power' /i1 60.416, i2 39.83, i3 37.83, i4 45.83, i5 60.416, i6 39.83, i7 57.416, i8 93.416, i9 85.083, i10 90.16, i11 84.083, i12 86.75, i13 50.416, i14 93.75, i15 82.75, i16 88.083, i17 86.583, i18 87.583, i19 76.25, i20 91.3, i21 78.916, i22 79.583, i23 71.583, i24 72.5/;

VARIABLES
z ’Objective function’
S 'Present State of Charge'
P(i) 'power generation level in MW'
Pch(i) 'power charging level in MW'
Pdch(i) 'power discharging level in MW'
Soc(i) 'State of charge of BESS' / i1.fx 80 /

POSITIVE VARIABLES

P(i) ’Energy dispatch’ / i1*i24.up 220 , i1*i24.lo 0 /
Pdch(i) ’Discharging Power' / i1*i24.up 80 , i1*i24.lo 0 /

NEGATIVE VARIABLES

Pch(i) ’Charging Power’ / i1*i24.up 0 , i1*i24.lo -80 /;

EQUATIONS

F ’Expected cost’
bal0(i) 'Power balance'
Soc_mov 'Present State of Charge'
Soc_limitu(i) 'State of charge upper limit'
Soc_limitl(i) 'State of charge lower limit'
Ch_DCh(i) 'Charging Discharging Mutually Exclusive';

F .. z=E= sum (i, C(i)*P(i) );

bal0(i) .. (Pw(i)+Pch(i)/ita_c+Pdch(i)*ita_d) =E= P(i);
Soc_limitu(i) .. Soc(i) - Pch(i) + Pdch(i) =L= Soc_max;
Soc_limitl(i) .. Soc(i) - Pch(i) + Pdch(i) =G= Soc_min;
Soc_mov(i) .. Soc(i+1) =E= Soc(i) - Pch(i) + Pdch(i);
Ch_DCh(i) .. Pch(i)*Pdch(i) =E= 0;

MODEL wfdispatch /all/ ;

SOLVE wfdispatch maximizing z using nlp ;

Display z.L, P.L;

Thank you so much.

Kind regards,
Mohyuddin
University of Wollongong
Australia

bussieck
Moderator
Posts: 68
Joined: 1 year ago

### Re: **Infeasible solution

Hi,

The constraint "Ch_DCh(i) .. Pch(i)*Pdch(i) =e= 0;" make the model non-convex and hard to debug (you need a global solver). Since the rest of the model is linear you should implement the logic with a binary variable:

Code: Select all

``````binary variable b(i);
Ch_DCh1(i) .. Pch(i) =l= b(i)*bigM;
Ch_DCh2(i) .. Pdch(i) =l= (1-b(i))*bigM;
``````
bigM is an upper bound on the max charge/discharge, you probably can get such a number from your data. With this you have model type mip.

All this is beside your original question, since you can even take out the Ch_DCh equation (and have an lp) and the model is still infeasible. Debugging infeasible models is not so easy and one needs knowledge about the application and logic of the model. Bruce McCarl has done a nice job writing up possible strategies how to deal with infeasible models: https://www.gams.com/blog/article/news/ ... e635ad1235

Hope this helps,
-Michael