Topic
• 2 replies
• Latest Post - ‏2018-07-15T09:57:18Z by Janisch
Janisch
38 Posts

# Pinned topic length of a sequence

‏2018-07-14T09:04:57Z |

Hello,

is there a way to limit the length of a sequence? In the attached picture I tried to graph my problem. Each of these sequences should be less than or equal to N * 120.

This is my attempt. But it doesn´t work:

forall(s in 1..S){
min(i in 1..N) startOf(station[i][s][1])-max(i in 1..N) endOf(station[i][s][1])<=c*N; //my attempt to integrate this constraint into the model
min(i in 1..N) startOf(station[i][s][2])-max(i in 1..N) endOf(station[i][s][2])<=c*N;
}

I also attached my model and an example dat file.

regards

#### Attachments

Updated on 2018-07-14T14:53:56Z at 2018-07-14T14:53:56Z by Janisch
• AlexFleischer
292 Posts

#### Re: length of a sequence

‏2018-07-15T09:33:02Z

Hi,

min(i in 1..N) startOf(station[i][s][1])-max(i in 1..N) endOf(station[i][s][1])<=c*N;

have you tried

max(i in 1..N) endOf(station[i][s][1])-min(i in 1..N) startOf(station[i][s][1])<=c*N;

?

regards

• AlexFleischer
292 Posts

#### Re: length of a sequence

‏2018-07-15T09:33:02Z

Hi,

min(i in 1..N) startOf(station[i][s][1])-max(i in 1..N) endOf(station[i][s][1])<=c*N;

have you tried

max(i in 1..N) endOf(station[i][s][1])-min(i in 1..N) startOf(station[i][s][1])<=c*N;

?

regards

• Janisch
38 Posts

#### Re: length of a sequence

‏2018-07-15T09:57:18Z

Hi,