Hello everyone, it is me again,

I have a second issue when modeling my application for the purpose of finding out the maximum power needed. My objects i are moving in a circle and need to keep a minimum distance dMin between each other at all timesteps t. I store if an object i is at a location l at a specific timestep t in a binary variable c(i,l,t). Hence, the sum over all c(i,l,t) should be 1 for a sequence of locations defined by the minimum distance dMin. So for all specific locations l*, the lower bound should be l*-dMin/2 and the upper bound should be l*+dMin/2.

- I can’t figure out how to implement lower and upper bounds. It feels like I need to use sth like

```
minDistance(l,t).. sum(i,(sum(l $ ord(l-dMin/2) to ord(l+dMin/2), c(i,l,t))) =l= 1
```

- I am trying to have dMin/2 expressed as a number of locations in positive and negative direction. But how can I go from the starting point of my circle, location 1, backwards to the ending point, location N? Does sth like location 1-4 give location N-3?

I am looking forward to any suggestions, ideas and answers!

Best regards

supra

UPDATE:

I tried further coming up with the following, still not working code (Error 125: Set is under control already):

```
minDistance(lc,t) .. sum(i,sum(lc $ (ord(lc) ge ord(lc-dMinlc) and ord(lc) le ord(lc+dMinlc)),c(i,lc,t))) =l= 1
```

I replaced set l by set lc, just beacuse it is easier to distinguish from the number 1. dMinlc is now the minimum distance measured in a number of locations lc. I understand the error message, i.e. that the set is already under control, but thats exactly my point here. I don’t know how to handle such a situation. The bounds of the sum are dependent on lc, and the whole constraint is supposed to hold for all lc.

UPDATE 2:

Found a working but not satisfying solution by hardcoding the number of lags that represent a minimum that I have to determine in advance. So I get sth like this:

```
minDistance(lc,t) .. sum(i, c(i,lc-dMinlc,t) + c(i,lc-(dMinlc-1),t) + ... + c(i,lc,t) + ... + c(i,lc+dMinlc,t)) =l= 1
```

So I am still looking forward to any suggestions on how to implement this without hardcoding all lags in advance.

Best regards

supra

Hi,

To me it seems that basically your problem is that you need to refer to different elements of set lc in the equation. One element of lc is controlled by the equation domain and then you need to sum over other elements of lc in the euqation body. The alias statement should help you to do that: https://www.gams.com/latest/docs/UG_SetDefinition.html#UG_SetDefinition_TheAliasStatementMultipleNamesForASet

I hope this helps!

Fred