1

I am working with the software, GAMS, and would appreciate some insight in a problem I am facing.

Assume that we have the following structure (grossly simplified for exposition):

Sets
      i        index
     /i1    'Index 1'
      i2    'Index 2'
      i3    'Index 3'
      i4    'Index 4'/

Variables

X(i);

Equations

EQX(i) ;

EQX(i)..  Whatever

;

From the above, we have a separate equation for each index value i1 to i4. Is there a simple way of excluding index 3 (i3) from this set of equations without redefining a new set completely? So instead of EQX(i), the Equations would be defined for EQX(i1), EQX(i2), and EQX(i4)?

Many thanks.

Kwame Brown
  • 131
  • 7

2 Answers2

2

If it is the third element of the set i you want to exclude, the previous answer will do this (you could also change the $-condition from $(ord(i) < 3 or ord(i) > 3) to $(ord(i) <> 3) to make it shorter). If you are concerned about the name i3 independent of the order of the set i, you could also do it like this to exclude exactly that element:

EQX(i)$(not sameAs(i, 'i3')).. Whatever ;
Lutz
  • 2,197
  • 1
  • 10
  • 12
1
EQX(i)$(ord(i) < 3 or ord(i) > 3)..
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
RgrSprDoc
  • 11
  • 1
  • 2
    Welcome to Stack Overflow, and thank you for contributing an answer. Would you kindly edit your answer to to include an explanation of your code? That will help future readers better understand what is going on, and especially those members of the community who are new to the language and struggling to understand the concepts. – Jeremy Caney Nov 07 '21 at 00:12