admin管理员组

文章数量:1123690

I have a set lall (location) that includes theoretical node names l1,l2,l4,l6,l11,l13 as defined as followed. lall.csv is just a one column csv file with l1,l2,l4,l6,l11,l13


    set lall "all locations"
    /
    $offlisting
    $include data%ds%lall.csv
    $onlisting
    / ;

I have a big model that is defined over the set l_east, which is a subset of lall. l_east includes all the locations that are on the east side of these nodes on a map. A set d consists of the two directions- "east" and "west", where l1,l2,l4 are in the east, and l6,l11,l13 are in the west. set l_east includes l1,l2,l4 and the l_west includes l6,l11,l13, both of which are defined from a csv file as well,


    set l_east(lall) "all model locations (locations in the east)"
    /
    $offlisting
    $include data%ds%l_east.csv
    $onlisting
    / ;

    set l_west(lall) "all locations NOT in model (locations in the west)"
    /
    $offlisting
    $include data%ds%l_west.csv
    $onlisting
    / ;

Because the model is defined over the set l_east, with all so many statements and constraints over it which I cannot change, I want to zero out a parameter for the locations in l_west. So what I do is:


    parameter param1(i,lall,c,b)
    /
    $offlisting
    $ondelim
    $include data%ds%param1
    $offdelim
    $onlisting
    / ;
    param1(i,l_west,c,b) = 0;

But later on, there's a statement where I need to use ord(l_east):


    alias(l_east,ll_east);
    set param2(l_east,ll_east,t);
    ...(some statement to specify params2)...
    param2(l_east,ll_east,t)$(ord(ll_east)<ord(l_east)) = no ;

I got an error:


    Set used in 'ord' or lag is not ordered.
    Hint: Some of the elements of the set were used before this was initialized and the order was different from the order used in this set. Try to initialize the set earlier.
    $offOrder allows lag operations on dynamic sets, reset with $onOrder

Is this because I defined l_east over lall? This seems simple but I can't get it to work. I tried to define l_east and l_west without (lall) but I just got domain violation error. Any suggestions on how to make this work? Thank you.

本文标签: Use of subsets in conditional statements in GAMSStack Overflow