Data reduction

Top  Previous  Next

Another variant of the problem reduction strategy is to exploit the fact that GAMS skips cases where data items are zero.  Thus data can be temporarily removed from data set by setting items to zero.  Consider the following example (tranzer.gms)

 

set         origin                 /o1*o100/

         destinat         /d1*d100/;

parameter distance(origin,destinat);

 distance(origin,destinat)=120+50*ord(destinat)-10*ord(origin);

set        smallorig(origin) small set of origins for testing /o4,o47,o91/

 smalldest(destinat) small set of destinations /d3,d44,d99/;

distance(origin,destinat)

     $(not (smallorig(origin) and smalldest(destinat)))=0;

parameter cost(origin,destinat);

Cost(origin,destinat)$distance(origin,destinat)

       =3+2*distance(origin,destinat);

display cost,distance;

 

Here we have zeroed most of the distances and if the rest of model were conditioned on nonzero transportation costs, then this would greatly reduce model size.  This also illustrates strategic sub-setting.