$hidden GAMS LIBINCLUDE ROUTINE DOMAIN $hidden $hidden Return the full dimensional domain defined by the non-zero $hidden structure of a parameter argument. $hidden $hidden Thomas F. Rutherford $hidden January, 2005 $hidden $hidden Usage: $hidden $libinclude domain p d $hidden $hidden Returns domain of non-zero elements in p to d $hidden $hidden p can have between 1 and 7 dimensions. $hidden $hidden $hidden Uses identifiers: d_1*d_7,p1*p7,pd_1*pd7. $hidden $version 139 $if not defined d_1 alias (d_1,d_2,d_3,d_4,d_5,d_6,d_7,*); $if not defined p_1 parameter p_1(d_1),p_2(d_1,d_2),p_3(d_1,d_2,d_3),p_4(d_1,d_2,d_3,d_4), $if not defined p_1 p_5(d_1,d_2,d_3,d_4,d_5),p_6(d_1,d_2,d_3,d_4,d_5,d_6), $if not defined p_1 p_7(d_1,d_2,d_3,d_4,d_5,d_6,d_7); $if not defined pd_1 set pd_1(d_1), pd_2(d_1,d_2), pd_3(d_1,d_2,d_3), pd_4(d_1,d_2,d_3,d_4), $if not defined pd_1 pd_5(d_1,d_2,d_3,d_4,d_5), pd_6(d_1,d_2,d_3,d_4,d_5,d_6), $if not defined pd_1 pd_7(d_1,d_2,d_3,d_4,d_5,d_6,d_7); $set p %1 $set d %2 $hidden Skip out with declarations following a blank invocation: $if "%p%"=="" $exit $if dimension 1 %p% $goto dim1 $if dimension 2 %p% $goto dim2 $if dimension 3 %p% $goto dim3 $if dimension 4 %p% $goto dim4 $if dimension 5 %p% $goto dim5 $if dimension 6 %p% $goto dim6 $if dimension 7 %p% $goto dim7 $label dim1 $if not settype %d% $abort "Error -- row domain argument is not a set: %rd%" $if not dimension 1 %d% $abort "Error -- expected a one dimensional row domain, but got %d%." $onuni p_1(d_1)=%p%(d_1); option pd_1