> I have some inventory variables defined by the following constraint set:
> 
> inventory_1{x in X, y in Y, t in 0..20}:
> INVENT_1[x,y,t] = sum{ (i,j) in set_1 : attribute_1[i] = x and 
> attribute_2[i] = y } d[t]*x[i,j];
> 
> i, referenced above, can have attribute_1:= 0,1,2 in periods t = 0,1,2; 
> but in all later periods, t>2, all i have attribute_1:= 0.
> 
> The set X:= {0,1,2} for the entire modelling horizon; the elements {1,2} 
> are redundant after t>2.
> 
> Does this adversely affect model generation time?

Yes, because corresponding array members have to be found in the symbol
table whenever they are referenced.

> 
> I feel like it would be faster if X:={0,1,2} when t<=2 and X:={0} when 
> t>2 but I can't think of anyway to do this other than make two sets of 
> constraints:
> 
> e.g.,
> inventory_1a{x in Xa , y in Y, t in 0..2 }:
> INVENT_1a etc
> 
> and
> inventory_1b{x in Xb, y in Y, t in 3..20}:
> INVENT_1b etc
> 
> This would get messy in my model.
> 
> Can anyone think of any other approaches?
> 

May be like this:

inventory_1{x in X, y in Y, t in 0..20}:
   INVENT_1[x,y,t] = sum{ (i,j) in set_1 : 
   (if i <= 2 then attribute_1[i] else 0) = x and  
   (if i <= 2 then attribute_2[i] else 0) = y } d[t]*x[i,j];
 
Please note that 'else 0' may be omitted.



_______________________________________________
Help-glpk mailing list
Help-glpk@gnu.org
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to