s.t. flow_sum {(r,s) in E}:

sum {i in T, j in T: i <> j} x[i,j,r,s] = sum {k in T} y[k,r,s] - 1;

-s.t. train_stop {i in T, (r,s) in E}:

- b[i,r,s] = d[i,r,s] - a[i,r,s] - trackleng[r,s]/trainspeed[i,r,s];

-s.t. train_move {i in T, (r,s) in E}: b[i,r,s] >= (y[i,r,s] - 1) * M;

+s.t. link_latency {i in T, (r,s) in E}:

+ d[i,r,s] - a[i,r,s] = trackleng[r,s]/trainspeed[i,r,s];

+s.t. node_latency {i in T, (r,s) in E, (u,v) in E: u == s}:

+ a[i,u,v] - d[i,r,s] - (y[i,r,s] + y[i,u,v] - 2) * M >= 0;

+s.t. wait_lower {i in T, (r,s) in E, (u,v) in E: u == s}:

+ a[i,u,v] - d[i,r,s] + (y[i,r,s] + y[i,u,v] - 2) * M <= b[i,r,s];

+s.t. wait_upper {i in T, (r,s) in E, (u,v) in E: u == s}:

+ a[i,u,v] - d[i,r,s] - (y[i,r,s] + y[i,u,v] - 2) * M >= b[i,r,s];

# s.t. train_mileage {i in I, (s,t) in A, r in V: (r,s) in A}: