Modelling index operations in parameter subscript

Hey guys,
I´m currently working on optimization model for my master thesis.
after the first compile i was able to fix some errors. However, I do not know how to deal with the following problem:

In my model I use some running parameters to describe planes in the 2 dimensional space. With an specific origin, the plane is supposed to spread out in x and y dimension.
therefore, I have developed this snipped of code:

         sum(x,
                 sum(y,
                         sum(aa$(ord(aa) <= Start_Mach_Hor(m)),
                                 sum(bb$(ord(bb)<=Start_Mach_Vert(m)),
                                         Start_Mach_Pos(x,y,m)*Occ_Fac(k,x+aa-1,y+bb-1)
                                 )
                         )
                 )
             )

I aimed to use the alias sets aa for x and bb for y to describe the plane (in specific, this part tests whether the point (x+aa-1,y+bb-1) is occupied by the plane, if the bottom left corner is located at (x,y)); if you need more context, let me know.

Apparently it is not allowed, to have more than one set in the subset of the parameter Occ_Fac… What other options do I have to model this type of issue in GAMS?

Error Messages

  8  ')' expected
133  Incompatible operands for addition
147  Real value for lag operator expected
148  Dimension different - The symbol is referenced with more/less
        indices as declared
201  Invalid argument for function
408  Too many ),] or }
409  Unrecognizable item - skip to find a new statement
       looking for a ';' or a key word to get started again

I would be grateful for any kind of ideas and input.

Best,
Patrick

Hi Patrick,

aa and bb are sets (or aliases). Set elements are strings (even if you use numbers). Hence, something like

Occ_Fac(k,x+aa-1,y+bb-1)

is not possible. Maybe the ord operator or the .val attribute is useful for you.

In general, helping becomes easier if you share code that can be executed to reproduce the problem.

Best,
Fred

Hi Fred,

thank you for you Response!
In the mean time I was able to solve the Problem by adding some conditions to the summation in order to consider the correct Indexes.

Regards
Patrick