Can you help me figure out if this formulation constitutes a non-linear problem? I believe It is a linear problem but my solver (GAMS) is unable to produce a acceptable solution.
$x,y$ and $\text{state}$ are variables and the rest are parameters.
$\sum\limits_{n=1}^{N}\left[\sum\limits_{i=1}^{T}x_{n,i}\cdot p_{i}-y_{n,i}\cdot p_{i}\right]$
$ \forall_{n} \forall_{i} x_{n,i},y_{n,i}\geq 0 \wedge x_{n,i},y_{n,i}\leq M_{n} $
$\forall_{n} \forall_{i} \text{state}_{n,i}=\text{state}_{n,i-1}+y_{n,i}-x_{n,i}$
$ \forall_{n} \forall_{i} \text{statemin}_{n} \leq \text{state}_{n,i} \leq \text{statemax}_{n}$
$ \text{flow}_{l,i} = A \cdot K_{i}$
$ \text{flow}_{l,i} \leq \text{fmax}_{l}$
$ K_{i} = L_{i} - (G_{i} + y_{i} - x_{i})$
Where $A$ is an $N \times N$ matrix. Any feedback is appreciated,
The GAMS code is the following:
** Define the structure to connect with the matlab code
*$onempty
$include matglobs.gms
set t /1*%timeSteps%/,
b /1*%bus%/,
l /1*%lines%/
;
Positive Variable x(b,t),
y(b,t)
state(b,t)
;
Free Variable res, unit(b), revenue, flow(l,t), K(b,t);
parameters size(b), rate(b), fmax(l), P(b,t), A(l,b), price(t);
$if exist matdata.gms $include matdata.gms
Equations
stateCalc1(b,t)
stateCalc2(b,t)
Initial_y(b,t)
Initial_x(b,t)
stateMax(b,t)
stateMin(b,t)
max_x(b,t)
max_y(b,t)
K_Calc(b,t)
flow_Calc(l,t)
lim_K(l,t)
Con10(b)
Con11
Obj
;
stateCalc1(b,t)$(ord(t)=1).. state(b,t) =e= size(b)/2;
stateCalc2(b,t)$(ord(t)>1).. state(b,t) =e= state(b,t-1) + y(b,t) - x(b,t);
Initial_y(b,t)$(ord(t)=1).. y(b,t) =e= 0;
Initial_x(b,t)$(ord(t)=1).. x(b,t) =e= 0;
stateMax(b,t).. state(b,t) =l= size(b);
stateMin(b,t).. state(b,t) =g= 0;
max_x(b,t).. x(b,t) =l= rate(b)*size(b);
max_y(b,t).. y(b,t) =l= rate(b)*size(b);
K_Calc(b,t).. K(b,t) =e= P(b,t)+y(b,t)-x(b,t);
flow_Calc(l,t).. flow(l,t) =e= sum(b, A(l,b)*K(b,t));
lim_K(l,t).. flow(l,t) =l= fmax(l);
Con10(b).. sum(t, x(b,t)*price(t) - y(b,t)*price(t)) =e= unit(b);
Con11.. sum(b, unit(b)) =e= revenue;
Obj.. revenue =e= res;
Model Opt_Bat /all/;
Solve Opt_Bat using LP maximazing res;
Display state.l, size;
$libinclude matout res.l
To be noted that $M_{n} = size_{n} * rate_{n}$.