Topic
• 2 replies
• Latest Post - ‏2013-03-24T20:52:23Z by SystemAdmin
754 Posts

# Pinned topic Problem to convert OPL 3.x in OPL 6.x sorce code

‏2013-03-23T13:10:35Z |
Hello together,

I want to use an old small source code fragment written in OPL 3 now in OPL 6 Version:

forall (t in 1..T, j in http://t+1..T : sum (i in 1..j-1) m[i] < MRT){
CT0,j: s[j]>= u[0];}

int T = 192;
m[i] = interval length with 0.25
int MRT = 1;
constraint CT http://1..Thttp://0..T;
s [j] = condition
u [0] = condition
When i try to debug it, I get the error message, that agregations are not allowed in filter expressions. The Problem seems to be the "sum" and the Iteration http://.. in first line, but i'm a total beginner in that field and can't solve it.

Could anybody help? Thanks a lot for Ideas.
Updated on 2013-03-24T20:52:23Z at 2013-03-24T20:52:23Z by SystemAdmin
• AlexFleischer
101 Posts

#### Re: Problem to convert OPL 3.x in OPL 6.x sorce code

‏2013-03-24T18:14:29Z
Hi,

indeed

``````
forall (t in 1..T, j in t+1..T : sum (i in 1..j-1) m[i] < MRT)```
```

is not allowed because aggregators like sum are not allowed in filters, but you can rewrite into

``````
forall (t in 1..T, j in t+1..T : truthValue[j]==1)```
```

And before the subject to block you define something like

``````

int truthValue[j in 2..T]=(sum (i in 1..j-1) m[i] < MRT)?1:0;```
```

Regards