```
positive variables var1, var3
integer variable var2
c1.. var2 <= 20
c2.. var1 = parameter1 - var2
c3.. var3 = var1 + parameter2
c4.. 0 >= var2 >= -5, if var1(i) = var3(k), i and k are alias
c5.. var1 = parameter1 - var2, if var1(i) = var3(k), i and k are alias
```

in c5, I want to use var2 with new boundary to update var1 value.

how to change the bound of var2 if var1(i) = var3(k), should be solved in linear. So, if I choose to write it on condition, it result with endogenous.

Thanks for any guide,

I assume this is sort of a pseudo code. There are several issues with it.

- If var1 is defined as var1, you cannot use it as var1(i)
- If c5 is defined without any index such as c5(i), you don’t know what is i and k for that constraint. Therefore, var1(i) = var1(k) is incorrect.

3, When you define constraints, there is no such things as ‘update’ because all constraints are considered simultaneously. As this is not a sequential code, GAMS does not let you put $ condition on variables resulting in endogenous error.
- It is not clear to me why alias is needed in c4. Please look at big-M formulations for this purpose. You should first define something like var1 > var3. Then you can write

var2 >= -M(var1-var3)

var2 <= 5+M(var1-var3)

This way if var1 and var3 are equal, you get your bounds. If they are not equal, var2 is between -M and M. If M is large enough (not too large) this serves your purpose.
- c5 does not make sense because it says if var1 = var3, then set the value of var1 to something. It should be clarified if you want to set this condition after solve or in the formulation.

Also, please clarify what is your objective.