Code: Select all

```
$title Service restoration using MIP
$oneolcom
set t ,i, r, t_total;
parameter cons(i), clpu(t,i), p(r), s, h;
$if not set gdxin $set gdxin MtoG
$GDXIN %gdxin%
$load t i r cons clpu p s h t_total
$gdxin
Scalar
maxLoad / 1.20 /
peak_clpu /2.5/;
Variables
z sum of consumption;
Binary Variable u(i,t_total);
Equations
cost objective function
current_load(t_total) constraint
transition(i,t_total) constraint
exit(t_total) constraint;
cost .. z =e= sum(t_total, maxLoad*s - sum((i,r)$[ord(r)=ord(t_total)+h-1], u(i,t_total)*cons(i)*clpu(i,t)*p(r)));
current_load(t_total) .. sum((i,r)$[ord(r)=ord(t_total)+h-1], u(i,t_total)*cons(i)*clpu(i,t)*p(r)) =l= maxLoad*s;
transition(i,t_total) .. u(i,t_total)-u(i,t_total-1) =g= 0;
exit(t) .. sum(i, u(i,t_total)) =l= 26;
Model restoration /all/;
Solve restoration using mip minimizing z;
Display u.l, u.m;
```

Is there a way to do this?