Index control with change of variable in MIP programming

Problems with modeling
Post Reply
User avatar
Posts: 7
Joined: 3 months ago

Index control with change of variable in MIP programming

Post by sanjadzeletovic » 1 month ago

I have a difficulties with assigning the adequate index. I want that index t starts to increment when variable u(i, t) changes state from 0 to 1 for variable i.

Code: Select all

$title Service restoration using MIP

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

 maxLoad / 1.20 /   
 peak_clpu /2.5/;  

   z         sum of consumption;

Binary Variable u(i,t_total);

  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;
I have a set clpu for all consumers (cons(i)) and I want to multiply value of consumption with the value of clpu. Since CLPU is a curve, and its intensity drops in time, I need to pick up the first value when I connect consumer i (with variable u(i,total)) and then to increment the values from this set and multiply a consumption with that.
Is there a way to do this?

Post Reply