Topic
  • 2 replies
  • Latest Post - ‏2018-07-15T09:57:18Z by Janisch
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

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

    Re: length of a sequence

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

    Hi,

    instead of

    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
    AlexFleischer
    284 Posts

    Re: length of a sequence

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

    Hi,

    instead of

    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
    Janisch
    38 Posts

    Re: length of a sequence

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

    Hi,

    instead of

    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

    Than you Alex! I completely overlooked...