sets t trains/17/ s stations/110/; t1 trains/12/ t2 trains/2/; ts train.station/1.1,1.2,1.3,2.1,2.2,2.3/ *tts H/t1.t2.s1,t1.t2.s2,t1.t2.s3/;

parameters table p(t,s) ideal departure time of t from s

  1       2       3       4       5       6      7       8      9

1 5.50 5.53 5.60 5.65 5.68 5.71 5.75 5.80 5.83 2 5.64 5.67 5.74 5.79 5.82 5.85 5.89 5.94 5.97 3 5.78 5.81 5.88 5.93 5.96 6.99 6.03 6.08 6.11 4 5.92 5.95 6.02 6.07 6.10 6.13 6.17 6.22 6.25 5 6.06 6.09 6.16 6.21 6.24 6.27 6.31 6.36 6.39 6 6.20 6.23 6.30 6.35 6.38 6.31 6.44 6.50 6.53 7 6.34 6.37 6.44 6.49 6.52 6.45 6.58 6.64 6.67; 8 * 6.45 6.48 6.55 * 6.60 * 6.67 * 6.70 * 6.71 * 6.74 * 6.79 * 6.83 9 * 6.56 6.59 6.66 6.71 6.78 6.81 6.82 6.85 6.90 6.94 10 * 6.67 6.70 6.77 6.82 6.89 6.92 6.93 6.96 7.01 7.05 11 * 6.78 6.81 6.88 6.93 7.00 7.03 7.04 7.07 7.12 7.16 12 6.89 6.92 6.99 7.04 7.11 7.14 7.15 7.18 7.23 7.27 13 7.00 7.03 7.10 7.15 7.22 7.25 7.26 7.29 7.34 7.38 14 7.11 7.14 7.21 7.26 7.33 7.36 7.37 7.40 7.45 7.49 15 7.22 7.25 7.32 7.37 7.44 7.47 7.48 7.51 7.56 7.60;

parameters table o(t,s) ideal travel time of t from s

1       2       3        4         5        6        7       8       9

1 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 2 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 3 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 4 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 5 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 6 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 7 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05; 8 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 9 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 10 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 11 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 12 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 13 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 14 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 15 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05;

parameters k(s) headway for consecutive trains in each station

/1 0.14 2 0.14 3 0.14 4 0.14 5 0.14 6 0.14 7 0.14 /; 8 9 10 11 12 13 14 15

parameters m/1000000000000000000/;

parameters table l(t,s) standing time of t at s

1       2      3      4      5      6      7      8       9

1 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 2 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 3 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 4 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 5 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 6 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 7 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008;

variables min"minimize sum of all delays,advances" ;

positive variables d(t,s) a(t,s) v(t,s) y(t,s) f(t,s); binary variables x(t,t,s);

equations

obj "define objective function" departure travel arrival stop first second third forth;

obj .. min =e= sum ((t,s),y(t,s)+f(t,s)); departure(t,s) .. d(t,s)=e=p(t,s)+y(t,s); travel(t,s) .. v(t,s)=e=o(t,s)+f(t,s); arrival(t,s) .. a(t,s+1)=e=d(t,s)+v(t,s); stop(t,s) .. d(t,s)-a(t,s)=G=l(t,s); first(t,s) .. d(t,s)-d(t+1,s)+mx(t,t+1,s)=G=k(s); second(t,s) .. -d(t,s)+d(t+1,s)+m(1-x(t,t+1,s))=G=k(s); third(t,s) .. a(t,s+1)-a(t+1,s+1)+mx(t,t+1,s)=G=k(s+1); forth(t,s) .. -a(t,s+1)+a(t+1,s+1)+m(1-x(t,t+1,s))=G=k(s+1);

model SADAF/all/;

if (d(t,s)<d(t+1,s), x(t,t,s)=1; else x(t,t,s)=0; *);

solve SADAF using MIP minimizing min;

display d.l,v.l,a.l,y.l,f.l,x.l,min.l;

GAMS 24.2.2 r44857 Released Mar 4, 2014 WIN-VS8 x86/MS Windows 07/12/14 20:29:15 Page 1 G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m C o m p i l a t i o n

1 sets 2 t trains/17/ 3 s stations/110/; 4 t1 trains/12/ 5 t2 trains/2/; 6 ts train.station/1.1,1.2,1.3,2.1,2.2,2.3/ 7 tts H/t1.t2.s1,t1.t2.s2,t1.t2.s3/; 8
9
10 parameters 11 table 12 p(t,s)
ideal departure time of t from s 13
14 1 2 3 4 5 6 7 8 9 15 1 5.50 5.53 5.60 5.65 5.68 5.71 5.75 5.80 5.83 16 2 5.64 5.67 5.74 5.79 5.82 5.85 5.89 5.94 5.97 17 3 5.78 5.81 5.88 5.93 5.96 6.99 6.03 6.08 6.11 18 4 5.92 5.95 6.02 6.07 6.10 6.13 6.17 6.22 6.25 19 5 6.06 6.09 6.16 6.21 6.24 6.27 6.31 6.36 6.39 20 6 6.20 6.23 6.30 6.35 6.38 6.31 6.44 6.50 6.53 21 7 6.34 6.37 6.44 6.49 6.52 6.45 6.58 6.64 6.67; 22 * 8 * 6.45 6.48 6.55 * 6.60 * 6.67 * 6.70 * 6.71 * 6.74 * 6.79 * 6.83 23 * 9 * 6.56 6.59 6.66 6.71 6.78 6.81 6.82 6.85 6.90 6.94 24
10 * 6.67 6.70 6.77 6.82 6.89 6.92 6.93 6.96 7.01 7.05 25 11 * 6.78 6.81 6.88 6.93 7.00 7.03 7.04 7.07 7.12 7.16 26 12 6.89 6.92 6.99 7.04 7.11 7.14 7.15 7.18 7.23 7.27 27 13 7.00 7.03 7.10 7.15 7.22 7.25 7.26 7.29 7.34 7.38 28 14 7.11 7.14 7.21 7.26 7.33 7.36 7.37 7.40 7.45 7.49 29 15 7.22 7.25 7.32 7.37 7.44 7.47 7.48 7.51 7.56 7.60; 30
31
32 parameters 33 table 34 o(t,s)
ideal travel time of t from s 35
36 1 2 3 4 5 6 7 8 9 37 1 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 38 2 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 39 3 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 40 4 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 41 5 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 42 6 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 43 7 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05; 44 * 8 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 45 * 9 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 46 * 10 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 47 * 11 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 48 * 12 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 49 * 13 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 50 * 14 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 51 * 15 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05; 52
53 parameters 54 k(s)
headway for consecutive trains in each station 55
56 /1 0.14 57 2 0.14 58 3 0.14 59 4 0.14 60 5 0.14 61 6 0.14 62 7 0.14 63 /; 64 * 8 65 * 9 66 * 10 67 * 11 68 * 12 69 * 13 70 * 14 71 * 15 72
73 parameters 74 m/1000000000000000000/; 75
76 parameters 77 table 78 l(t,s)
standing time of t at s 79
80 1 2 3 4 5 6 7 8 9 81 1 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 82 2 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 83 3 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 84 4 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 85 5 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 86 6 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 87 7 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008; 88
89 variables 90 min"minimize sum of all delays,advances" ; 91
92 positive variables 93 d(t,s) 94 a(t,s) 95 v(t,s) 96 y(t,s) 97 f(t,s); 98 binary variables 99 x(t,t,s); 100
101
102 equations 103
104 obj "define objective function" 105 departure 106 travel 107 arrival 108 stop 109 first 110 second 111 third 112 forth; 113
114
115
116 obj .. min =e= sum ((t,s),y(t,s)+f(t,s)); 117 departure(t,s) .. d(t,s)=e=p(t,s)+y(t,s); 118 travel(t,s) .. v(t,s)=e=o(t,s)+f(t,s); 119 arrival(t,s) .. a(t,s+1)=e=d(t,s)+v(t,s); 120 stop(t,s) .. d(t,s)-a(t,s)=G=l(t,s); 121 first(t,s) .. d(t,s)-d(t+1,s)+m
x(t,t+1,s)=G=k(s); 122 second(t,s) .. -d(t,s)+d(t+1,s)+m(1-x(t,t+1,s))=G=k(s); 123 third(t,s) .. a(t,s+1)-a(t+1,s+1)+mx(t,t+1,s)=G=k(s+1); 124 forth(t,s) .. -a(t,s+1)+a(t+1,s+1)+m(1-x(t,t+1,s))=G=k(s+1); 125
126
127
128
129
130
131
132
133
134
135 model SADAF/all/; 136
137
138
if (d(t,s)<d(t+1,s), 139 * x(t,t,s)=1; 140 * else 141 * x(t,t,s)=0; 142 *); 143
144
145
146
147
148
149 solve SADAF using MIP minimizing min; 150
151
152
153 display d.l,v.l,a.l,y.l,f.l,x.l,min.l; 154
155
156
157

COMPILATION TIME = 0.000 SECONDS 3 MB 24.2.2 r44857 WIN-VS8

The out put:GAMS 24.2.2 r44857 Released Mar 4, 2014 WIN-VS8 x86/MS Windows 07/12/14 20:29:15 Page 2 G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m Equation Listing SOLVE SADAF Using MIP From line 149

---- obj =E= define objective function

obj.. min - y(1,1) - y(1,2) - y(1,3) - y(1,4) - y(1,5) - y(1,6) - y(1,7)

  - y(1,8) - y(1,9) - y(1,10) - y(2,1) - y(2,2) - y(2,3) - y(2,4) - y(2,5)

  - y(2,6) - y(2,7) - y(2,8) - y(2,9) - y(2,10) - y(3,1) - y(3,2) - y(3,3)

  - y(3,4) - y(3,5) - y(3,6) - y(3,7) - y(3,8) - y(3,9) - y(3,10) - y(4,1)

  - y(4,2) - y(4,3) - y(4,4) - y(4,5) - y(4,6) - y(4,7) - y(4,8) - y(4,9)

  - y(4,10) - y(5,1) - y(5,2) - y(5,3) - y(5,4) - y(5,5) - y(5,6) - y(5,7)

  - y(5,8) - y(5,9) - y(5,10) - y(6,1) - y(6,2) - y(6,3) - y(6,4) - y(6,5)

  - y(6,6) - y(6,7) - y(6,8) - y(6,9) - y(6,10) - y(7,1) - y(7,2) - y(7,3)

  - y(7,4) - y(7,5) - y(7,6) - y(7,7) - y(7,8) - y(7,9) - y(7,10) - f(1,1)

  - f(1,2) - f(1,3) - f(1,4) - f(1,5) - f(1,6) - f(1,7) - f(1,8) - f(1,9)

  - f(1,10) - f(2,1) - f(2,2) - f(2,3) - f(2,4) - f(2,5) - f(2,6) - f(2,7)

  - f(2,8) - f(2,9) - f(2,10) - f(3,1) - f(3,2) - f(3,3) - f(3,4) - f(3,5)

  - f(3,6) - f(3,7) - f(3,8) - f(3,9) - f(3,10) - f(4,1) - f(4,2) - f(4,3)

  - f(4,4) - f(4,5) - f(4,6) - f(4,7) - f(4,8) - f(4,9) - f(4,10) - f(5,1)

  - f(5,2) - f(5,3) - f(5,4) - f(5,5) - f(5,6) - f(5,7) - f(5,8) - f(5,9)

  - f(5,10) - f(6,1) - f(6,2) - f(6,3) - f(6,4) - f(6,5) - f(6,6) - f(6,7)

  - f(6,8) - f(6,9) - f(6,10) - f(7,1) - f(7,2) - f(7,3) - f(7,4) - f(7,5)

  - f(7,6) - f(7,7) - f(7,8) - f(7,9) - f(7,10) =E= 0 ; (LHS = 0)

---- departure =E=

departure(1,1).. d(1,1) - y(1,1) =E= 5.5 ; (LHS = 0, INFES = 5.5 ****)

departure(1,2).. d(1,2) - y(1,2) =E= 5.53 ; (LHS = 0, INFES = 5.53 ****)

departure(1,3).. d(1,3) - y(1,3) =E= 5.6 ; (LHS = 0, INFES = 5.6 ****)

REMAINING 67 ENTRIES SKIPPED

---- travel =E=

travel(1,1).. v(1,1) - f(1,1) =E= 0.03 ; (LHS = 0, INFES = 0.03 ****)

travel(1,2).. v(1,2) - f(1,2) =E= 0.07 ; (LHS = 0, INFES = 0.07 ****)

travel(1,3).. v(1,3) - f(1,3) =E= 0.05 ; (LHS = 0, INFES = 0.05 ****)

REMAINING 67 ENTRIES SKIPPED

---- arrival =E=

arrival(1,1).. - d(1,1) + a(1,2) - v(1,1) =E= 0 ; (LHS = 0)

arrival(1,2).. - d(1,2) + a(1,3) - v(1,2) =E= 0 ; (LHS = 0)

arrival(1,3).. - d(1,3) + a(1,4) - v(1,3) =E= 0 ; (LHS = 0)

REMAINING 67 ENTRIES SKIPPED

---- stop =G=

stop(1,1).. d(1,1) - a(1,1) =G= 0.008 ; (LHS = 0, INFES = 0.008 ****)

stop(1,2).. d(1,2) - a(1,2) =G= 0.008 ; (LHS = 0, INFES = 0.008 ****)

stop(1,3).. d(1,3) - a(1,3) =G= 0.008 ; (LHS = 0, INFES = 0.008 ****)

REMAINING 67 ENTRIES SKIPPED

---- first =G=

first(1,1).. d(1,1) - d(2,1) + 1E18*x(1,2,1) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

first(1,2).. d(1,2) - d(2,2) + 1E18*x(1,2,2) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

first(1,3).. d(1,3) - d(2,3) + 1E18*x(1,2,3) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

REMAINING 67 ENTRIES SKIPPED

---- second =G=

second(1,1).. - d(1,1) + d(2,1) - 1E18*x(1,2,1) =G= -1E18 ; (LHS = 0)

second(1,2).. - d(1,2) + d(2,2) - 1E18*x(1,2,2) =G= -1E18 ; (LHS = 0)

second(1,3).. - d(1,3) + d(2,3) - 1E18*x(1,2,3) =G= -1E18 ; (LHS = 0)

REMAINING 67 ENTRIES SKIPPED

---- third =G=

third(1,1).. a(1,2) - a(2,2) + 1E18*x(1,2,1) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

third(1,2).. a(1,3) - a(2,3) + 1E18*x(1,2,2) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

third(1,3).. a(1,4) - a(2,4) + 1E18*x(1,2,3) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

REMAINING 66 ENTRIES SKIPPED

---- forth =G=

forth(1,1).. - a(1,2) + a(2,2) - 1E18*x(1,2,1) =G= -1E18 ; (LHS = 0)

forth(1,2).. - a(1,3) + a(2,3) - 1E18*x(1,2,2) =G= -1E18 ; (LHS = 0)

forth(1,3).. - a(1,4) + a(2,4) - 1E18*x(1,2,3) =G= -1E18 ; (LHS = 0)

REMAINING 66 ENTRIES SKIPPED

GAMS 24.2.2 r44857 Released Mar 4, 2014 WIN-VS8 x86/MS Windows 07/12/14 20:29:15 Page 3 G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m Column Listing SOLVE SADAF Using MIP From line 149

---- min minimize sum of all delays,advances

min (.LO, .L, .UP, .M = -INF, 0, +INF, 0) 1 obj

---- d

d(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 departure(1,1) -1 arrival(1,1) 1 stop(1,1) 1 first(1,1) -1 second(1,1)

d(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 departure(1,2) -1 arrival(1,2) 1 stop(1,2) 1 first(1,2) -1 second(1,2)

d(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 departure(1,3) -1 arrival(1,3) 1 stop(1,3) 1 first(1,3) -1 second(1,3)

REMAINING 67 ENTRIES SKIPPED

---- a

a(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 stop(1,1)

a(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 arrival(1,1) -1 stop(1,2) 1 third(1,1) -1 forth(1,1)

a(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 arrival(1,2) -1 stop(1,3) 1 third(1,2) -1 forth(1,2)

REMAINING 67 ENTRIES SKIPPED

---- v

v(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 travel(1,1) -1 arrival(1,1)

v(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 travel(1,2) -1 arrival(1,2)

v(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 travel(1,3) -1 arrival(1,3)

REMAINING 67 ENTRIES SKIPPED

---- y

y(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 departure(1,1)

y(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 departure(1,2)

y(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 departure(1,3)

REMAINING 67 ENTRIES SKIPPED

---- f

f(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 travel(1,1)

f(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 travel(1,2)

f(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 travel(1,3)

REMAINING 67 ENTRIES SKIPPED

---- x

x(1,2,1) (.LO, .L, .UP, .M = 0, 0, 1, 0) 1.000000E+18 first(1,1) -1.00000E+18 second(1,1) 1.000000E+18 third(1,1) -1.00000E+18 forth(1,1)

x(1,2,2) (.LO, .L, .UP, .M = 0, 0, 1, 0) 1.000000E+18 first(1,2) -1.00000E+18 second(1,2) 1.000000E+18 third(1,2) -1.00000E+18 forth(1,2)

x(1,2,3) (.LO, .L, .UP, .M = 0, 0, 1, 0) 1.000000E+18 first(1,3) -1.00000E+18 second(1,3) 1.000000E+18 third(1,3) -1.00000E+18 forth(1,3)

REMAINING 57 ENTRIES SKIPPED GAMS 24.2.2 r44857 Released Mar 4, 2014 WIN-VS8 x86/MS Windows 07/12/14 20:29:15 Page 4 G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m Model Statistics SOLVE SADAF Using MIP From line 149

MODEL STATISTICS

BLOCKS OF EQUATIONS 9 SINGLE EQUATIONS 559 BLOCKS OF VARIABLES 7 SINGLE VARIABLES 411 NON ZERO ELEMENTS 1,498 DISCRETE VARIABLES 60

* THE MODEL EXCEEDS THE DEMO LIMITS MAX MATRIX ROWS 300 * MAX MATRIX COLUMNS 300 MAX NON ZERO ELEMENTS 2000 * MAX NON LINEAR N-Z 1000 MAX DISCRETE VARIABLES 50 *** Terminated due to a licensing error

 GAMS Development Corporation, Washington, DC   G871201/0000CA-ANY
 Free Demo,  202-342-0180,  sales@gams.com,  www.gams.com         
 10501994000S                                                   00
 01234567000000                                                   
 DC0000       Ref: Generated by Base            A Demo            sets

t trains/17/ s stations/110/; t1 trains/12/ t2 trains/2/; ts train.station/1.1,1.2,1.3,2.1,2.2,2.3/ *tts H/t1.t2.s1,t1.t2.s2,t1.t2.s3/;

parameters table p(t,s) ideal departure time of t from s

  1       2       3       4       5       6      7       8      9

1 5.50 5.53 5.60 5.65 5.68 5.71 5.75 5.80 5.83 2 5.64 5.67 5.74 5.79 5.82 5.85 5.89 5.94 5.97 3 5.78 5.81 5.88 5.93 5.96 6.99 6.03 6.08 6.11 4 5.92 5.95 6.02 6.07 6.10 6.13 6.17 6.22 6.25 5 6.06 6.09 6.16 6.21 6.24 6.27 6.31 6.36 6.39 6 6.20 6.23 6.30 6.35 6.38 6.31 6.44 6.50 6.53 7 6.34 6.37 6.44 6.49 6.52 6.45 6.58 6.64 6.67; 8 * 6.45 6.48 6.55 * 6.60 * 6.67 * 6.70 * 6.71 * 6.74 * 6.79 * 6.83 9 * 6.56 6.59 6.66 6.71 6.78 6.81 6.82 6.85 6.90 6.94 10 * 6.67 6.70 6.77 6.82 6.89 6.92 6.93 6.96 7.01 7.05 11 * 6.78 6.81 6.88 6.93 7.00 7.03 7.04 7.07 7.12 7.16 12 6.89 6.92 6.99 7.04 7.11 7.14 7.15 7.18 7.23 7.27 13 7.00 7.03 7.10 7.15 7.22 7.25 7.26 7.29 7.34 7.38 14 7.11 7.14 7.21 7.26 7.33 7.36 7.37 7.40 7.45 7.49 15 7.22 7.25 7.32 7.37 7.44 7.47 7.48 7.51 7.56 7.60;

parameters table o(t,s) ideal travel time of t from s

1       2       3        4         5        6        7       8       9

1 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 2 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 3 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 4 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 5 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 6 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 7 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05; 8 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 9 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 10 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 11 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 12 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 13 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 14 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05 15 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0.05;

parameters k(s) headway for consecutive trains in each station

/1 0.14 2 0.14 3 0.14 4 0.14 5 0.14 6 0.14 7 0.14 /; 8 9 10 11 12 13 14 15

parameters m/1000000000000000000/;

parameters table l(t,s) standing time of t at s

1       2      3      4      5      6      7      8       9

1 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 2 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 3 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 4 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 5 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 6 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 7 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008;

variables min"minimize sum of all delays,advances" ;

positive variables d(t,s) a(t,s) v(t,s) y(t,s) f(t,s); binary variables x(t,t,s);

equations

obj "define objective function" departure travel arrival stop first second third forth;

obj .. min =e= sum ((t,s),y(t,s)+f(t,s)); departure(t,s) .. d(t,s)=e=p(t,s)+y(t,s); travel(t,s) .. v(t,s)=e=o(t,s)+f(t,s); arrival(t,s) .. a(t,s+1)=e=d(t,s)+v(t,s); stop(t,s) .. d(t,s)-a(t,s)=G=l(t,s); first(t,s) .. d(t,s)-d(t+1,s)+mx(t,t+1,s)=G=k(s); second(t,s) .. -d(t,s)+d(t+1,s)+m(1-x(t,t+1,s))=G=k(s); third(t,s) .. a(t,s+1)-a(t+1,s+1)+mx(t,t+1,s)=G=k(s+1); forth(t,s) .. -a(t,s+1)+a(t+1,s+1)+m(1-x(t,t+1,s))=G=k(s+1);

model SADAF/all/;

if (d(t,s)<d(t+1,s), x(t,t,s)=1; else x(t,t,s)=0; *);

solve SADAF using MIP minimizing min;

display d.l,v.l,a.l,y.l,f.l,x.l,min.l;

GAMS 24.2.2 r44857 Released Mar 4, 2014 WIN-VS8 x86/MS Windows 07/12/14 20:29:15 Page 1 G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m C o m p i l a t i o n

1 sets 2 t trains/17/ 3 s stations/110/; 4 t1 trains/12/ 5 t2 trains/2/; 6 ts train.station/1.1,1.2,1.3,2.1,2.2,2.3/ 7 tts H/t1.t2.s1,t1.t2.s2,t1.t2.s3/; 8
9
10 parameters 11 table 12 p(t,s)
ideal departure time of t from s 13
14 1 2 3 4 5 6 7 8 9 15 1 5.50 5.53 5.60 5.65 5.68 5.71 5.75 5.80 5.83 16 2 5.64 5.67 5.74 5.79 5.82 5.85 5.89 5.94 5.97 17 3 5.78 5.81 5.88 5.93 5.96 6.99 6.03 6.08 6.11 18 4 5.92 5.95 6.02 6.07 6.10 6.13 6.17 6.22 6.25 19 5 6.06 6.09 6.16 6.21 6.24 6.27 6.31 6.36 6.39 20 6 6.20 6.23 6.30 6.35 6.38 6.31 6.44 6.50 6.53 21 7 6.34 6.37 6.44 6.49 6.52 6.45 6.58 6.64 6.67; 22 * 8 * 6.45 6.48 6.55 * 6.60 * 6.67 * 6.70 * 6.71 * 6.74 * 6.79 * 6.83 23 * 9 * 6.56 6.59 6.66 6.71 6.78 6.81 6.82 6.85 6.90 6.94 24
10 * 6.67 6.70 6.77 6.82 6.89 6.92 6.93 6.96 7.01 7.05 25 11 * 6.78 6.81 6.88 6.93 7.00 7.03 7.04 7.07 7.12 7.16 26 12 6.89 6.92 6.99 7.04 7.11 7.14 7.15 7.18 7.23 7.27 27 13 7.00 7.03 7.10 7.15 7.22 7.25 7.26 7.29 7.34 7.38 28 14 7.11 7.14 7.21 7.26 7.33 7.36 7.37 7.40 7.45 7.49 29 15 7.22 7.25 7.32 7.37 7.44 7.47 7.48 7.51 7.56 7.60; 30
31
32 parameters 33 table 34 o(t,s)
ideal travel time of t from s 35
36 1 2 3 4 5 6 7 8 9 37 1 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 38 2 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 39 3 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 40 4 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 41 5 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 42 6 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05 43 7 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03 0 .05; 44 * 8 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 45 * 9 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 46 * 10 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 47 * 11 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 48 * 12 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 49 * 13 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 50 * 14 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05 51 * 15 0.03 0.07 0.05 0.03 0.03 0.04 0.05 0.03

0.05; 52
53 parameters 54 k(s)
headway for consecutive trains in each station 55
56 /1 0.14 57 2 0.14 58 3 0.14 59 4 0.14 60 5 0.14 61 6 0.14 62 7 0.14 63 /; 64 * 8 65 * 9 66 * 10 67 * 11 68 * 12 69 * 13 70 * 14 71 * 15 72
73 parameters 74 m/1000000000000000000/; 75
76 parameters 77 table 78 l(t,s)
standing time of t at s 79
80 1 2 3 4 5 6 7 8 9 81 1 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 82 2 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 83 3 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 84 4 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 85 5 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 86 6 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 87 7 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008 0.008; 88
89 variables 90 min"minimize sum of all delays,advances" ; 91
92 positive variables 93 d(t,s) 94 a(t,s) 95 v(t,s) 96 y(t,s) 97 f(t,s); 98 binary variables 99 x(t,t,s); 100
101
102 equations 103
104 obj "define objective function" 105 departure 106 travel 107 arrival 108 stop 109 first 110 second 111 third 112 forth; 113
114
115
116 obj .. min =e= sum ((t,s),y(t,s)+f(t,s)); 117 departure(t,s) .. d(t,s)=e=p(t,s)+y(t,s); 118 travel(t,s) .. v(t,s)=e=o(t,s)+f(t,s); 119 arrival(t,s) .. a(t,s+1)=e=d(t,s)+v(t,s); 120 stop(t,s) .. d(t,s)-a(t,s)=G=l(t,s); 121 first(t,s) .. d(t,s)-d(t+1,s)+m
x(t,t+1,s)=G=k(s); 122 second(t,s) .. -d(t,s)+d(t+1,s)+m(1-x(t,t+1,s))=G=k(s); 123 third(t,s) .. a(t,s+1)-a(t+1,s+1)+mx(t,t+1,s)=G=k(s+1); 124 forth(t,s) .. -a(t,s+1)+a(t+1,s+1)+m(1-x(t,t+1,s))=G=k(s+1); 125
126
127
128
129
130
131
132
133
134
135 model SADAF/all/; 136
137
138
if (d(t,s)<d(t+1,s), 139 * x(t,t,s)=1; 140 * else 141 * x(t,t,s)=0; 142 *); 143
144
145
146
147
148
149 solve SADAF using MIP minimizing min; 150
151
152
153 display d.l,v.l,a.l,y.l,f.l,x.l,min.l; 154
155
156
157

COMPILATION TIME = 0.000 SECONDS 3 MB 24.2.2 r44857 WIN-VS8

The out put:GAMS 24.2.2 r44857 Released Mar 4, 2014 WIN-VS8 x86/MS Windows 07/12/14 20:29:15 Page 2 G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m Equation Listing SOLVE SADAF Using MIP From line 149

---- obj =E= define objective function

obj.. min - y(1,1) - y(1,2) - y(1,3) - y(1,4) - y(1,5) - y(1,6) - y(1,7)

  - y(1,8) - y(1,9) - y(1,10) - y(2,1) - y(2,2) - y(2,3) - y(2,4) - y(2,5)

  - y(2,6) - y(2,7) - y(2,8) - y(2,9) - y(2,10) - y(3,1) - y(3,2) - y(3,3)

  - y(3,4) - y(3,5) - y(3,6) - y(3,7) - y(3,8) - y(3,9) - y(3,10) - y(4,1)

  - y(4,2) - y(4,3) - y(4,4) - y(4,5) - y(4,6) - y(4,7) - y(4,8) - y(4,9)

  - y(4,10) - y(5,1) - y(5,2) - y(5,3) - y(5,4) - y(5,5) - y(5,6) - y(5,7)

  - y(5,8) - y(5,9) - y(5,10) - y(6,1) - y(6,2) - y(6,3) - y(6,4) - y(6,5)

  - y(6,6) - y(6,7) - y(6,8) - y(6,9) - y(6,10) - y(7,1) - y(7,2) - y(7,3)

  - y(7,4) - y(7,5) - y(7,6) - y(7,7) - y(7,8) - y(7,9) - y(7,10) - f(1,1)

  - f(1,2) - f(1,3) - f(1,4) - f(1,5) - f(1,6) - f(1,7) - f(1,8) - f(1,9)

  - f(1,10) - f(2,1) - f(2,2) - f(2,3) - f(2,4) - f(2,5) - f(2,6) - f(2,7)

  - f(2,8) - f(2,9) - f(2,10) - f(3,1) - f(3,2) - f(3,3) - f(3,4) - f(3,5)

  - f(3,6) - f(3,7) - f(3,8) - f(3,9) - f(3,10) - f(4,1) - f(4,2) - f(4,3)

  - f(4,4) - f(4,5) - f(4,6) - f(4,7) - f(4,8) - f(4,9) - f(4,10) - f(5,1)

  - f(5,2) - f(5,3) - f(5,4) - f(5,5) - f(5,6) - f(5,7) - f(5,8) - f(5,9)

  - f(5,10) - f(6,1) - f(6,2) - f(6,3) - f(6,4) - f(6,5) - f(6,6) - f(6,7)

  - f(6,8) - f(6,9) - f(6,10) - f(7,1) - f(7,2) - f(7,3) - f(7,4) - f(7,5)

  - f(7,6) - f(7,7) - f(7,8) - f(7,9) - f(7,10) =E= 0 ; (LHS = 0)

---- departure =E=

departure(1,1).. d(1,1) - y(1,1) =E= 5.5 ; (LHS = 0, INFES = 5.5 ****)

departure(1,2).. d(1,2) - y(1,2) =E= 5.53 ; (LHS = 0, INFES = 5.53 ****)

departure(1,3).. d(1,3) - y(1,3) =E= 5.6 ; (LHS = 0, INFES = 5.6 ****)

REMAINING 67 ENTRIES SKIPPED

---- travel =E=

travel(1,1).. v(1,1) - f(1,1) =E= 0.03 ; (LHS = 0, INFES = 0.03 ****)

travel(1,2).. v(1,2) - f(1,2) =E= 0.07 ; (LHS = 0, INFES = 0.07 ****)

travel(1,3).. v(1,3) - f(1,3) =E= 0.05 ; (LHS = 0, INFES = 0.05 ****)

REMAINING 67 ENTRIES SKIPPED

---- arrival =E=

arrival(1,1).. - d(1,1) + a(1,2) - v(1,1) =E= 0 ; (LHS = 0)

arrival(1,2).. - d(1,2) + a(1,3) - v(1,2) =E= 0 ; (LHS = 0)

arrival(1,3).. - d(1,3) + a(1,4) - v(1,3) =E= 0 ; (LHS = 0)

REMAINING 67 ENTRIES SKIPPED

---- stop =G=

stop(1,1).. d(1,1) - a(1,1) =G= 0.008 ; (LHS = 0, INFES = 0.008 ****)

stop(1,2).. d(1,2) - a(1,2) =G= 0.008 ; (LHS = 0, INFES = 0.008 ****)

stop(1,3).. d(1,3) - a(1,3) =G= 0.008 ; (LHS = 0, INFES = 0.008 ****)

REMAINING 67 ENTRIES SKIPPED

---- first =G=

first(1,1).. d(1,1) - d(2,1) + 1E18*x(1,2,1) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

first(1,2).. d(1,2) - d(2,2) + 1E18*x(1,2,2) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

first(1,3).. d(1,3) - d(2,3) + 1E18*x(1,2,3) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

REMAINING 67 ENTRIES SKIPPED

---- second =G=

second(1,1).. - d(1,1) + d(2,1) - 1E18*x(1,2,1) =G= -1E18 ; (LHS = 0)

second(1,2).. - d(1,2) + d(2,2) - 1E18*x(1,2,2) =G= -1E18 ; (LHS = 0)

second(1,3).. - d(1,3) + d(2,3) - 1E18*x(1,2,3) =G= -1E18 ; (LHS = 0)

REMAINING 67 ENTRIES SKIPPED

---- third =G=

third(1,1).. a(1,2) - a(2,2) + 1E18*x(1,2,1) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

third(1,2).. a(1,3) - a(2,3) + 1E18*x(1,2,2) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

third(1,3).. a(1,4) - a(2,4) + 1E18*x(1,2,3) =G= 0.14 ;

  (LHS = 0, INFES = 0.14 ****)

REMAINING 66 ENTRIES SKIPPED

---- forth =G=

forth(1,1).. - a(1,2) + a(2,2) - 1E18*x(1,2,1) =G= -1E18 ; (LHS = 0)

forth(1,2).. - a(1,3) + a(2,3) - 1E18*x(1,2,2) =G= -1E18 ; (LHS = 0)

forth(1,3).. - a(1,4) + a(2,4) - 1E18*x(1,2,3) =G= -1E18 ; (LHS = 0)

REMAINING 66 ENTRIES SKIPPED

GAMS 24.2.2 r44857 Released Mar 4, 2014 WIN-VS8 x86/MS Windows 07/12/14 20:29:15 Page 3 G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m Column Listing SOLVE SADAF Using MIP From line 149

---- min minimize sum of all delays,advances

min (.LO, .L, .UP, .M = -INF, 0, +INF, 0) 1 obj

---- d

d(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 departure(1,1) -1 arrival(1,1) 1 stop(1,1) 1 first(1,1) -1 second(1,1)

d(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 departure(1,2) -1 arrival(1,2) 1 stop(1,2) 1 first(1,2) -1 second(1,2)

d(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 departure(1,3) -1 arrival(1,3) 1 stop(1,3) 1 first(1,3) -1 second(1,3)

REMAINING 67 ENTRIES SKIPPED

---- a

a(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 stop(1,1)

a(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 arrival(1,1) -1 stop(1,2) 1 third(1,1) -1 forth(1,1)

a(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 arrival(1,2) -1 stop(1,3) 1 third(1,2) -1 forth(1,2)

REMAINING 67 ENTRIES SKIPPED

---- v

v(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 travel(1,1) -1 arrival(1,1)

v(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 travel(1,2) -1 arrival(1,2)

v(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) 1 travel(1,3) -1 arrival(1,3)

REMAINING 67 ENTRIES SKIPPED

---- y

y(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 departure(1,1)

y(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 departure(1,2)

y(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 departure(1,3)

REMAINING 67 ENTRIES SKIPPED

---- f

f(1,1) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 travel(1,1)

f(1,2) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 travel(1,2)

f(1,3) (.LO, .L, .UP, .M = 0, 0, +INF, 0) -1 obj -1 travel(1,3)

REMAINING 67 ENTRIES SKIPPED

---- x

x(1,2,1) (.LO, .L, .UP, .M = 0, 0, 1, 0) 1.000000E+18 first(1,1) -1.00000E+18 second(1,1) 1.000000E+18 third(1,1) -1.00000E+18 forth(1,1)

x(1,2,2) (.LO, .L, .UP, .M = 0, 0, 1, 0) 1.000000E+18 first(1,2) -1.00000E+18 second(1,2) 1.000000E+18 third(1,2) -1.00000E+18 forth(1,2)

x(1,2,3) (.LO, .L, .UP, .M = 0, 0, 1, 0) 1.000000E+18 first(1,3) -1.00000E+18 second(1,3) 1.000000E+18 third(1,3) -1.00000E+18 forth(1,3)

REMAINING 57 ENTRIES SKIPPED GAMS 24.2.2 r44857 Released Mar 4, 2014 WIN-VS8 x86/MS Windows 07/12/14 20:29:15 Page 4 G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m Model Statistics SOLVE SADAF Using MIP From line 149

MODEL STATISTICS

BLOCKS OF EQUATIONS 9 SINGLE EQUATIONS 559 BLOCKS OF VARIABLES 7 SINGLE VARIABLES 411 NON ZERO ELEMENTS 1,498 DISCRETE VARIABLES 60

* THE MODEL EXCEEDS THE DEMO LIMITS MAX MATRIX ROWS 300 * MAX MATRIX COLUMNS 300 MAX NON ZERO ELEMENTS 2000 * MAX NON LINEAR N-Z 1000* MAX DISCRETE VARIABLES 50

**** Terminated due to a licensing error

1.what is this sentence meaninig?**** Terminated due to a licensing error 2.what should i do to get my answer and output?is it related to its licence? please help me.

This question is marked "community wiki".

asked 12 Jul '14, 13:06

sadaf's gravatar image

sadaf
1124
accept rate: 0%


After skimming through briefly (assuming you have a license), try adding the following:

option mip = SOLVER

link

answered 12 Jul '14, 13:22

Pavan's gravatar image

Pavan
3002621
accept rate: 0%

3

"THE MODEL EXCEEDS THE DEMO LIMITS" means that (a) you do not have a license, or (b) GAMS does not find your license file. @sadaf, this is not a hotline where your general GAMS problems and questions are answered, but we are happy to help you with specific and precisely-posed questions.

(12 Jul '14, 14:47) Marco Luebbecke ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×51

Asked: 12 Jul '14, 13:06

Seen: 6,086 times

Last updated: 12 Jul '14, 14:47

OR-Exchange! Your site for questions, answers, and announcements about operations research.