Module OptSeqExample
[hide private]
[frames] | no frames]

Source Code for Module OptSeqExample

   1  from optseq2 import * 
   2       
3 -def Example1():
4 """ 5 Example 1 6 PERT 7 file name: Example1.py 8 Copyright Log Opt Co., Ltd. 9 10 Consider a 5-activity problem with precedence constraints between the activities. 11 Such a problem is called PERT (Program Evaluation and Review Technique). 12 The processing times (durations) of the activities are kept in the dictionary 13 duration ={1:13, 2:25, 3:15, 4:27, 5:22 }. 14 Precedence constraints are given by: 15 Activity 1 -> Activity 3; Activity 2 -> Activity 4; 16 Activity 3 -> Activity 4; and Activity 3 -> Activity 5. 17 The objective is to find the maximum completion time (makespan) for all 5 activities. 18 """ 19 m1=Model() 20 duration ={1:13, 2:25, 3:15, 4:27, 5:22 } 21 act={} 22 mode={} 23 for i in duration: 24 act[i]=m1.addActivity("Act[%s]"%i) 25 mode[i]=Mode("Mode[%s]"%i,duration[i]) 26 act[i].addModes(mode[i]) 27 28 #temporal (precedense) constraints 29 m1.addTemporal(act[1],act[3]) 30 m1.addTemporal(act[2],act[4]) 31 m1.addTemporal(act[2],act[5]) 32 m1.addTemporal(act[3],act[4]) 33 34 m1.Params.TimeLimit=1 35 m1.Params.OutputFlag=True 36 m1.Params.Makespan=True 37 m1.optimize() 38 m1.write("chart1.txt")
39 40 ##output: 41 ##activity Act[1] 42 ##mode duration 13 43 ##activity Act[2] 44 ##mode duration 25 45 ##activity Act[3] 46 ##mode duration 15 47 ##activity Act[4] 48 ##mode duration 27 49 ##activity Act[5] 50 ##mode duration 22 51 ## 52 ##temporal Act[1] Act[3] type CS delay 0 53 ##temporal Act[2] Act[4] type CS delay 0 54 ##temporal Act[2] Act[5] type CS delay 0 55 ##temporal Act[3] Act[4] type CS delay 0 56 ## 57 ##activity sink duedate 0 58 ## 59 ### reading data ... done: 0.00(s) 60 61 ### random seed: 1 62 63 ### tabu tenure: 0 64 65 ### cpu time limit: 1.00(s) 66 67 ### iteration limit: 1073741823 68 69 ### computing all-pairs longest paths and strongly connected components ... done 70 71 ###scc 7 72 73 ##objective value = 55 (cpu time = 0.00(s), iteration = 0) 74 75 ##0: 0.00(s): 55/55 76 77 ##--- best activity list --- 78 79 ##source Act[2] Act[5] Act[1] Act[3] Act[4] sink 80 81 ## 82 83 ##--- best solution --- 84 85 ##source,---, 0 0 86 87 ##sink,---, 55 55 88 89 ##Act[1],---, 0 0--13 13 90 91 ##Act[2],---, 0 0--25 25 92 93 ##Act[3],---, 13 13--28 28 94 95 ##Act[4],---, 28 28--55 55 96 97 ##Act[5],---, 25 25--47 47 98 99 ##--- tardy activity --- 100 101 ##sink: 55 102 103 ##--- resource residuals --- 104 105 ## 106 107 ##objective value = 55 108 109 ##cpu time = 0.00/1.00(s) 110 111 ##iteration = 1/14299 112 113 ## 114 ## 115 ##source --- 0 0 116 ##sink --- 55 55 117 ##Act[1] --- 0 13 118 ##Act[2] --- 0 25 119 ##Act[3] --- 13 28 120 ##Act[4] --- 28 55 121 ##Act[5] --- 25 47 122 ##planning horizon= 55 123 124 #chart1.txt 125 ##activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55| 126 ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 127 ## Act[1] Mode[1] 13 |==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 128 ## Act[2] Mode[2] 25 |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 129 ## Act[3] Mode[3] 15 | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | 130 ## Act[4] Mode[4] 27 | | | | | | | | | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| 131 ## Act[5] Mode[5] 22 | | | | | | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | 132 ##--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 133 ## resource usage/capacity | 134 ##--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 135
136 -def Example2():
137 """ 138 Example 2 139 PERT with resource constraint 140 file name: Example2.py 141 Copyright Log Opt Co., Ltd. 142 143 Consider a 5-activity problem with precedence constraints between the activities. 144 The processing times (durations) of the activities are kept in the dictionary 145 duration ={1:13, 2:25, 3:15, 4:27, 5:22 }. 146 Precedence constraints are given by: 147 Activity 1 -> Activity 3; Activity 2 -> Activity 4; 148 Activity 3 -> Activity 4; and Activity 3 -> Activity 5. 149 Each activity requires one unit of worker resource whose capacity (maximum amount of availability for each time period) is 1. 150 The objective is to find the maximum completion time (makespan) for all 5 activities 151 """ 152 m1=Model() 153 duration ={1:13, 2:25, 3:15, 4:27, 5:22 } 154 res=m1.addResource("worker",capacity={(0,"inf"):1}) 155 act={} 156 mode={} 157 for i in duration: 158 act[i]=m1.addActivity("Act[%s]"%i) 159 mode[i]=Mode("Mode[%s]"%i,duration[i]) 160 mode[i].addResource(res,{(0,"inf"):1}) 161 act[i].addModes(mode[i]) 162 163 #temporal (precedense) constraints 164 m1.addTemporal(act[1],act[3]) 165 m1.addTemporal(act[2],act[4]) 166 m1.addTemporal(act[2],act[5]) 167 m1.addTemporal(act[3],act[4]) 168 169 m1.Params.TimeLimit=1 170 m1.Params.OutputFlag=True 171 m1.Params.Makespan=True 172 m1.optimize() 173 m1.write("chart2.txt")
174 175 ##output: 176 ##resource worker 177 ## interval 0 inf capacity 1 178 ##activity Act[1] 179 ##mode duration 13 180 ## worker interval 0 inf requirement 1 181 ##activity Act[2] 182 ##mode duration 25 183 ## worker interval 0 inf requirement 1 184 ##activity Act[3] 185 ##mode duration 15 186 ## worker interval 0 inf requirement 1 187 ##activity Act[4] 188 ##mode duration 27 189 ## worker interval 0 inf requirement 1 190 ##activity Act[5] 191 ##mode duration 22 192 ## worker interval 0 inf requirement 1 193 ## 194 ##temporal Act[1] Act[3] type CS delay 0 195 ##temporal Act[2] Act[4] type CS delay 0 196 ##temporal Act[2] Act[5] type CS delay 0 197 ##temporal Act[3] Act[4] type CS delay 0 198 ## 199 ##activity sink duedate 0 200 ## 201 ### reading data ... done: 0.00(s) 202 203 ### random seed: 1 204 205 ### tabu tenure: 0 206 207 ### cpu time limit: 1.00(s) 208 209 ### iteration limit: 1073741823 210 211 ### computing all-pairs longest paths and strongly connected components ... done 212 213 ###scc 7 214 215 ##objective value = 102 (cpu time = 0.00(s), iteration = 0) 216 217 ##0: 0.00(s): 102/102 218 219 ## 220 221 ##--- best activity list --- 222 223 ##source Act[2] Act[5] Act[1] Act[3] Act[4] sink 224 225 ## 226 227 ##--- best solution --- 228 229 ##source,---, 0 0 230 231 ##sink,---, 102 102 232 233 ##Act[1],---, 47 47--60 60 234 235 ##Act[2],---, 0 0--25 25 236 237 ##Act[3],---, 60 60--75 75 238 239 ##Act[4],---, 75 75--102 102 240 241 ##Act[5],---, 25 25--47 47 242 243 ##--- tardy activity --- 244 245 ##sink: 102 246 247 ##--- resource residuals --- 248 249 ##worker: [0,102] 0 250 251 ## 252 253 ##objective value = 102 254 255 ##cpu time = 0.00/1.00(s) 256 257 ##iteration = 0/15767 258 259 ## 260 ## 261 ##source --- 0 0 262 ##sink --- 102 102 263 ##Act[1] --- 47 60 264 ##Act[2] --- 0 25 265 ##Act[3] --- 60 75 266 ##Act[4] --- 75 102 267 ##Act[5] --- 25 47 268 ##planning horizon= 102 269 270 271 #chart2.txt 272 ##activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42| 43| 44| 45| 46| 47| 48| 49| 50| 51| 52| 53| 54| 55| 56| 57| 58| 59| 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 70| 71| 72| 73| 74| 75| 76| 77| 78| 79| 80| 81| 82| 83| 84| 85| 86| 87| 88| 89| 90| 91| 92| 93| 94| 95| 96| 97| 98| 99|100|101|102| 273 ##------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 274 ## Act[1] Mode[1] 13 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |===|===|===|===|===|===|===|===|===|===|===|===|===| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 275 ## Act[2] Mode[2] 25 |===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 276 ## Act[3] Mode[3] 15 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |===|===|===|===|===|===|===|===|===|===|===|===|===|===|===| | | | | | | | | | | | | | | | | | | | | | | | | | | | 277 ## Act[4] Mode[4] 27 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===| 278 ## Act[5] Mode[5] 22 | | | | | | | | | | | | | | | | | | | | | | | | | |===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===|===| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 279 ##------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 280 ## resource usage/capacity | 281 ##------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 282 ## worker | 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 283 ## | 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 284 ##------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 285 ## 286
287 -def Example3():
288 """ 289 Example 3 290 Parallel Shop Problem 291 file name: Example3.py 292 Copyright Log Opt Co., Ltd. 293 294 Consider a 10-activity problem in which each activity is processed on three identical parallel machines. 295 The processing times (durations) of the activities are kept in the dictionary 296 duration ={1:3, 2:2, 3:2, 4:2, 5:4, 6:4, 7:4, 8:4, 9:11, 10:2 }. 297 Precedence constraints are given by: 298 Activity 1 -> Activity 9; 299 Activities 5,6,7,8 are processed after Activity 4 and before Activity 10. 300 The objective is to find the maximum completion time (makespan). 301 """ 302 303 m1=Model() 304 duration ={1:3, 2:2, 3:2, 4:2, 5:4, 6:4, 7:4, 8:4, 9:11, 10:2 } 305 res=m1.addResource("worker",capacity={(0,"inf"):3}) 306 act={} 307 mode={} 308 for i in duration: 309 act[i]=m1.addActivity("Act[%s]"%i) 310 mode[i]=Mode("Mode[%s]"%i,duration[i]) 311 mode[i].addResource(res,{(0,"inf"):1}) 312 act[i].addModes(mode[i]) 313 314 #temporal (precedense) constraints 315 m1.addTemporal(act[1],act[9]) 316 for i in range(5,9): 317 m1.addTemporal(act[4],act[i]) 318 m1.addTemporal(act[i],act[10]) 319 m1.Params.TimeLimit=1 320 m1.Params.Makespan=True 321 m1.optimize() 322 m1.write("chart3.txt")
323 324 #output 325 ##source --- 0 0 326 ##sink --- 14 14 327 ##Act[1] --- 0 3 328 ##Act[2] --- 0 2 329 ##Act[3] --- 0 2 330 ##Act[4] --- 2 4 331 ##Act[5] --- 8 12 332 ##Act[6] --- 4 8 333 ##Act[7] --- 8 12 334 ##Act[8] --- 4 8 335 ##Act[9] --- 3 14 336 ##Act[10] --- 12 14 337 ##planning horizon= 14 338 339 #chart3.txt 340 ## activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14| 341 ##------------------------------------------------------------------------| 342 ## Act[10] Mode[10] 2 | | | | | | | | | | | | |==|==| 343 ## Act[1] Mode[1] 3 |==|==|==| | | | | | | | | | | | 344 ## Act[2] Mode[2] 2 |==|==| | | | | | | | | | | | | 345 ## Act[3] Mode[3] 2 |==|==| | | | | | | | | | | | | 346 ## Act[4] Mode[4] 2 | | |==|==| | | | | | | | | | | 347 ## Act[5] Mode[5] 4 | | | | | | | | |==|==|==|==| | | 348 ## Act[6] Mode[6] 4 | | | | |==|==|==|==| | | | | | | 349 ## Act[7] Mode[7] 4 | | | | | | | | |==|==|==|==| | | 350 ## Act[8] Mode[8] 4 | | | | |==|==|==|==| | | | | | | 351 ## Act[9] Mode[9] 11 | | | |==|==|==|==|==|==|==|==|==|==|==| 352 ##------------------------------------------------------------------------ 353 ## resource usage/capacity | 354 ##------------------------------------------------------------------------ 355 ## worker | 3| 3| 2| 2| 3| 3| 3| 3| 3| 3| 3| 3| 2| 2| 356 ## | 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 357 ##------------------------------------------------------------------------ 358 359
360 -def Example4():
361 """ 362 Example 4 363 Parallel Shop Problem using Modes 364 file name: Example4.py 365 Copyright Log Opt Co., Ltd. 366 367 Consider a 10-activity problem in which each activity is processed on three identical parallel machines. 368 The processing times (durations) of the activities are kept in the dictionary 369 duration ={1:3, 2:2, 3:2, 4:2, 5:4, 6:4, 7:4, 8:4, 9:11, 10:2 }. 370 Precedence constraints are given by: 371 Activity 1 -> Activity 9; 372 Activities 5,6,7,8 are processed after Activity 4 and before Activity 10. 373 Activity 1 can be processed in one of the following three modes: 374 Mode 1 with duration 3 that requires 1 unit of worker resource, 375 Mode 2 with duration 2 that requires 2 units of worker resource, and 376 Mode 3 with duration 1 that requires 3 units of worker resource. 377 The objective is to find the maximum completion time (makespan). 378 """ 379 380 m1=Model() 381 duration ={1:3, 2:2, 3:2, 4:2, 5:4, 6:4, 7:4, 8:4, 9:11, 10:2 } 382 res=m1.addResource("worker",capacity={(0,"inf"):3}) 383 act={} 384 mode={} 385 386 for i in duration: 387 act[i]=m1.addActivity("Act[%s]"%i) 388 if i==1: 389 mode[1,1]=Mode("Mode[1_1]",3) 390 mode[1,1].addResource(res,{(0,"inf"):1}) 391 mode[1,2]=Mode("Mode[1_2]",2) 392 mode[1,2].addResource(res,{(0,"inf"):2}) 393 mode[1,3]=Mode("Mode[1_3]",1) 394 mode[1,3].addResource(res,{(0,"inf"):3}) 395 act[i].addModes(mode[1,1],mode[1,2],mode[1,3]) 396 else: 397 mode[i]=Mode("Mode[%s]"%i,duration[i]) 398 mode[i].addResource(res,{(0,"inf"):1}) 399 act[i].addModes(mode[i]) 400 #temporal (precedense) constraints 401 m1.addTemporal(act[1],act[9]) 402 for i in range(5,9): 403 m1.addTemporal(act[4],act[i]) 404 m1.addTemporal(act[i],act[10]) 405 m1.Params.TimeLimit=1 406 m1.Params.Makespan=True 407 m1.optimize() 408 m1.write("chart4.txt")
409 410 #output 411 ##source --- 0 0 412 ##sink --- 13 13 413 ##Act[1] Mode[1_3] 0 1 414 ##Act[2] --- 1 3 415 ##Act[3] --- 11 13 416 ##Act[4] --- 1 3 417 ##Act[5] --- 7 11 418 ##Act[6] --- 3 7 419 ##Act[7] --- 7 11 420 ##Act[8] --- 3 7 421 ##Act[9] --- 1 12 422 ##Act[10] --- 11 13 423 ##planning horizon= 13 424 425 #chart4.txt 426 ## activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13| 427 ##---------------------------------------------------------------------| 428 ## Act[10] Mode[10] 2 | | | | | | | | | | | |==|==| 429 ## Act[1] Mode[1_3] 1 |==| | | | | | | | | | | | | 430 ## Act[2] Mode[2] 2 | |==|==| | | | | | | | | | | 431 ## Act[3] Mode[3] 2 | | | | | | | | | | | |==|==| 432 ## Act[4] Mode[4] 2 | |==|==| | | | | | | | | | | 433 ## Act[5] Mode[5] 4 | | | | | | | |==|==|==|==| | | 434 ## Act[6] Mode[6] 4 | | | |==|==|==|==| | | | | | | 435 ## Act[7] Mode[7] 4 | | | | | | | |==|==|==|==| | | 436 ## Act[8] Mode[8] 4 | | | |==|==|==|==| | | | | | | 437 ## Act[9] Mode[9] 11 | |==|==|==|==|==|==|==|==|==|==|==| | 438 ##--------------------------------------------------------------------- 439 ## resource usage/capacity | 440 ##--------------------------------------------------------------------- 441 ## worker | 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 2| 442 ## | 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 443 ##--------------------------------------------------------------------- 444
445 -def Example5():
446 """ 447 Example 5 448 Resource Constrained Scheduling 449 file name: Example5.py 450 Copyright Log Opt Co., Ltd. 451 452 Consider a 4-activity problem with a resource whose capacity is 2 units on day 1, 2, 4, 5, 6, and 1 unit on day 3. 453 The processing times (durations) of the activities are kept in the dictionary 454 duration ={1:1,2:3,3:2,4:2}. 455 Precedence constraints are give by: 456 Activity 1 -> Activity 2; 457 Activity 1 -> Activity 3; 458 Activity 2 -> Activity 4. 459 Activity 1 requires 2 units of resource the first day. 460 Activity 2 requires 2 units of resource the first day and 1 unit on other days. 461 Activity 3 requires 1 unit of resource all the days. 462 Activity 4 requires 1 unit of the resource the first day and 2 units on the second day. 463 The objective is to find the maximum completion time (makespan). 464 """ 465 m1=Model() 466 duration ={1:1,2:3,3:2,4:2} 467 req={} 468 req[1]={(0,1):2 } 469 req[2]={(0,1):2 ,(1,3):1} 470 req[3]={(0,2):1 } 471 req[4]={(0,1):1,(1,2):2 } 472 473 res=m1.addResource("worker") 474 res.addCapacity(0,2,2) 475 res.addCapacity(2,3,1) 476 res.addCapacity(3,"inf",2) 477 478 act={} 479 mode={} 480 481 for i in duration: 482 act[i]=m1.addActivity("Act[%s]"%i) 483 mode[i]=Mode("Mode[%s]"%i,duration[i]) 484 mode[i].addResource(res,req[i]) 485 act[i].addModes(mode[i]) 486 487 #temporal (precedense) constraints 488 m1.addTemporal(act[1],act[2]) 489 m1.addTemporal(act[1],act[3]) 490 m1.addTemporal(act[2],act[4]) 491 492 m1.Params.TimeLimit=1 493 m1.Params.OutputFlag=True 494 m1.Params.Makespan=True 495 m1.optimize() 496 m1.write("chart5.txt")
497 498 ##output: 499 ##resource worker 500 ## interval 0 2 capacity 2 501 ## interval 2 3 capacity 1 502 ## interval 3 inf capacity 2 503 ##activity Act[1] 504 ##mode duration 1 505 ## worker interval 0 1 requirement 2 506 ##activity Act[2] 507 ##mode duration 3 508 ## worker interval 0 1 requirement 2 509 ##interval 1 3 requirement 1 510 ##activity Act[3] 511 ##mode duration 2 512 ## worker interval 0 2 requirement 1 513 ##activity Act[4] 514 ##mode duration 2 515 ## worker interval 0 1 requirement 1 516 ##interval 1 2 requirement 2 517 ## 518 ##temporal Act[1] Act[2] type CS delay 0 519 ##temporal Act[1] Act[3] type CS delay 0 520 ##temporal Act[2] Act[4] type CS delay 0 521 ## 522 ##activity sink duedate 0 523 ## 524 ### reading data ... done: 0.00(s) 525 526 ### random seed: 1 527 528 ### tabu tenure: 0 529 530 ### cpu time limit: 1.00(s) 531 532 ### iteration limit: 1073741823 533 534 ### computing all-pairs longest paths and strongly connected components ... done 535 536 ###scc 6 537 538 ##objective value = 6 (cpu time = 0.00(s), iteration = 0) 539 540 ##0: 0.00(s): 6/6 541 542 ##--- best activity list --- 543 544 ##source Act[1] Act[2] Act[3] Act[4] sink 545 546 ## 547 548 ##--- best solution --- 549 550 ##source,---, 0 0 551 552 ##sink,---, 6 6 553 554 ##Act[1],---, 0 0--1 1 555 556 ##Act[2],---, 1 1--4 4 557 558 ##Act[3],---, 3 3--5 5 559 560 ##Act[4],---, 4 4--6 6 561 562 ##--- tardy activity --- 563 564 ##sink: 6 565 566 ##--- resource residuals --- 567 568 ##worker: [0,6] 0 569 570 ## 571 572 ##objective value = 6 573 574 ##cpu time = 0.00/1.00(s) 575 576 ##iteration = 1/10916 577 578 ## 579 ## 580 ##source --- 0 0 581 ##sink --- 6 6 582 ##Act[1] --- 0 1 583 ##Act[2] --- 1 4 584 ##Act[3] --- 3 5 585 ##Act[4] --- 4 6 586 ##planning horizon= 6 587 588 #chart5.txt 589 ## activity mode duration |1|2|3|4|5|6| 590 ##------------------------------------------| 591 ## Act[1] Mode[1] 1 |=| | | | | | 592 ## Act[2] Mode[2] 3 | |=|=|=| | | 593 ## Act[3] Mode[3] 2 | | | |=|=| | 594 ## Act[4] Mode[4] 2 | | | | |=|=| 595 ##------------------------------------------ 596 ## resource usage/capacity | 597 ##------------------------------------------ 598 ## worker |2|2|1|2|2|2| 599 ## |2|2|1|2|2|2| 600 ##------------------------------------------ 601 602
603 -def Example6():
604 """ 605 Example 6 606 Minimizing the Tardiness 607 file name: Example6.py 608 Copyright Log Opt Co., Ltd. 609 610 Consider a 4-activity problem with one machine resource. 611 The due dates and processing times (durations) of the activities are kept in the dictionaries 612 due={1:5,2:9,3:6,4:4} and 613 duration={1:1, 2:2, 3:3, 4:4 }, respectively. 614 We have to pay tardiness penalty by the amount the completion time of the activity exceeds its due date. 615 The objective is to find the schedule that minimizes total tardiness penalty cost. 616 """ 617 m1=Model() 618 due={1:5,2:9,3:6,4:4} 619 duration={1:1, 2:2, 3:3, 4:4 } 620 621 res=m1.addResource("writer") 622 res.addCapacity(0,"inf",1) 623 624 act={} 625 mode={} 626 627 for i in duration: 628 act[i]=m1.addActivity("Act[%s]"%i,duedate=due[i]) 629 mode[i]=Mode("Mode[%s]"%i,duration[i]) 630 mode[i].addResource(res,{(0,"inf"):1}) 631 act[i].addModes(mode[i]) 632 633 m1.Params.TimeLimit=1 634 m1.Params.OutputFlag=True 635 m1.Params.Makespan=False 636 m1.optimize() 637 m1.write("chart6.txt")
638 639 ##output: 640 ##resource writer 641 ## interval 0 inf capacity 1 642 ##activity Act[1] 643 ## duedate 5 644 ## weight 1 645 ##mode duration 1 646 ## writer interval 0 inf requirement 1 647 ##activity Act[2] 648 ## duedate 9 649 ## weight 1 650 ##mode duration 2 651 ## writer interval 0 inf requirement 1 652 ##activity Act[3] 653 ## duedate 6 654 ## weight 1 655 ##mode duration 3 656 ## writer interval 0 inf requirement 1 657 ##activity Act[4] 658 ## duedate 4 659 ## weight 1 660 ##mode duration 4 661 ## writer interval 0 inf requirement 1 662 ## 663 ## 664 ## 665 ### reading data ... done: 0.00(s) 666 667 ### random seed: 1 668 669 ### tabu tenure: 0 670 671 ### cpu time limit: 1.00(s) 672 673 ### iteration limit: 1073741823 674 675 ### computing all-pairs longest paths and strongly connected components ... done 676 677 ###scc 6 678 679 ##objective value = 3 (cpu time = 0.00(s), iteration = 0) 680 681 ##0: 0.00(s): 3/3 682 683 ## 684 685 ##--- best activity list --- 686 687 ##source Act[4] Act[1] Act[3] Act[2] sink 688 689 ## 690 691 ##--- best solution --- 692 693 ##source,---, 0 0 694 695 ##sink,---, 10 10 696 697 ##Act[1],---, 4 4--5 5 698 699 ##Act[2],---, 8 8--10 10 700 701 ##Act[3],---, 5 5--8 8 702 703 ##Act[4],---, 0 0--4 4 704 705 ##--- tardy activity --- 706 707 ##Act[2]: 1 708 709 ##Act[3]: 2 710 711 ##--- resource residuals --- 712 713 ##writer: [0,10] 0 714 715 ## 716 717 ##objective value = 3 718 719 ##cpu time = 0.00/1.00(s) 720 721 ##iteration = 0/15809 722 723 ## 724 ## 725 ##source --- 0 0 726 ##sink --- 10 10 727 ##Act[1] --- 4 5 728 ##Act[2] --- 8 10 729 ##Act[3] --- 5 8 730 ##Act[4] --- 0 4 731 ##planning horizon= 10 732 733 #chart6.txt 734 ## activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9|10| 735 ##------------------------------------------------------------| 736 ## Act[1] Mode[1] 1 | | | | |==| | | | | | 737 ## Act[2] Mode[2] 2 | | | | | | | | |==|==| 738 ## Act[3] Mode[3] 3 | | | | | |==|==|==| | | 739 ## Act[4] Mode[4] 4 |==|==|==|==| | | | | | | 740 ##------------------------------------------------------------ 741 ## resource usage/capacity | 742 ##------------------------------------------------------------ 743 ## writer | 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 744 ## | 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 745 746
747 -def Example7():
748 """ 749 Example 7 750 CPM(critical path method) -- nonrenewable resource 751 file name: Example7.py 752 Copyright Log Opt Co., Ltd. 753 754 Consider the same scenario as in Example 1. 755 Here, activities have a standard mode and an express mode whose durations are 756 durationA = {1:13, 2:25, 3:15, 4:27, 5:22 } and 757 durationB = {1:10, 2:20, 3:10, 4:25, 5:20 }, respectively. 758 Express modes require additional costs; they can be processed at most 4. 759 Find the makespan under the restriction. 760 761 """ 762 763 m1=Model() 764 durationA = {1:13, 2:25, 3:15, 4:27, 5:22 } 765 durationB = {1:10, 2:20, 3:10, 4:25, 5:20 } 766 767 act={} 768 mode={} 769 770 res=m1.addResource("money",rhs=4,direction="<=") 771 772 for i in durationA: 773 act[i]=m1.addActivity("Act[%s]"%i) 774 mode[i,1]=Mode("Mode[%s][1]"%i,durationA[i]) 775 mode[i,2]=Mode("Mode[%s][2]"%i,durationB[i]) 776 act[i].addModes(mode[i,1],mode[i,2]) 777 res.addTerms(1,act[i],mode[i,2]) 778 779 #temporal (precedense) constraints 780 m1.addTemporal(act[1],act[3]) 781 m1.addTemporal(act[2],act[4]) 782 m1.addTemporal(act[2],act[5]) 783 m1.addTemporal(act[3],act[4]) 784 785 m1.Params.TimeLimit=1 786 m1.Params.OutputFlag=True 787 m1.Params.Makespan=True 788 m1.optimize() 789 m1.write("chart7.txt")
790 791 ##output: 792 ##mode Mode[2][1] duration 25 793 ##mode Mode[3][1] duration 15 794 ##mode Mode[1][1] duration 13 795 ##mode Mode[3][2] duration 10 796 ##mode Mode[1][2] duration 10 797 ##mode Mode[5][2] duration 20 798 ##mode Mode[4][2] duration 25 799 ##mode Mode[4][1] duration 27 800 ##mode Mode[2][2] duration 20 801 ##mode Mode[5][1] duration 22 802 ##activity Act[1] 803 ##Mode[1][1] Mode[1][2] 804 ##activity Act[2] 805 ##Mode[2][1] Mode[2][2] 806 ##activity Act[3] 807 ##Mode[3][1] Mode[3][2] 808 ##activity Act[4] 809 ##Mode[4][1] Mode[4][2] 810 ##activity Act[5] 811 ##Mode[5][1] Mode[5][2] 812 ## 813 ##temporal Act[1] Act[3] type CS delay 0 814 ##temporal Act[2] Act[4] type CS delay 0 815 ##temporal Act[2] Act[5] type CS delay 0 816 ##temporal Act[3] Act[4] type CS delay 0 817 ##nonrenewable 1(Act[1],Mode[1][2]) 1(Act[2],Mode[2][2]) 1(Act[3],Mode[3][2]) 1(Act[4],Mode[4][2]) 1(Act[5],Mode[5][2]) <=4 818 ##activity sink duedate 0 819 ## 820 ### reading data ... done: 0.00(s) 821 822 ### random seed: 1 823 824 ### tabu tenure: 0 825 826 ### cpu time limit: 1.00(s) 827 828 ### iteration limit: 1073741823 829 830 ### computing all-pairs longest paths and strongly connected components ... done 831 832 ###scc 7 833 834 ##objective value = 45 (cpu time = 0.00(s), iteration = 0) 835 836 ##0: 0.00(s): 45/45 837 838 ## 839 840 ##--- best activity list --- 841 842 ##source Act[2] Act[5] Act[1] Act[3] Act[4] sink 843 844 ## 845 846 ##--- best solution --- 847 848 ##source,---, 0 0 849 850 ##sink,---, 45 45 851 852 ##Act[1],Mode[1][2], 0 0--10 10 853 854 ##Act[2],Mode[2][2], 0 0--20 20 855 856 ##Act[3],Mode[3][2], 10 10--20 20 857 858 ##Act[4],Mode[4][2], 20 20--45 45 859 860 ##Act[5],Mode[5][1], 20 20--42 42 861 862 ##--- tardy activity --- 863 864 ##sink: 45 865 866 ##--- resource residuals --- 867 868 ## 869 870 ##objective value = 45 871 872 ##cpu time = 0.00/1.00(s) 873 874 ##iteration = 0/29478 875 876 ## 877 ## 878 ##source --- 0 0 879 ##sink --- 45 45 880 ##Act[1] Mode[1][2] 0 10 881 ##Act[2] Mode[2][2] 0 20 882 883 #chart7.txt 884 ##activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45| 885 ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------| 886 ## Act[1] Mode[1][2] 10 |==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 887 ## Act[2] Mode[2][2] 20 |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | 888 ## Act[3] Mode[3][2] 10 | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | 889 ## Act[4] Mode[4][2] 25 | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| 890 ## Act[5] Mode[5][1] 22 | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| | | | 891 ##--------------------------------------------------------------------------------------------------------------------------------------------------------------------- 892 ## resource usage/capacity | 893 ##--------------------------------------------------------------------------------------------------------------------------------------------------------------------- 894
895 -def Example8():
896 """ 897 Example 8 898 Temporal Constraints 899 file name: Example8.py 900 Copyright Log Opt Co., Ltd. 901 902 Consider the same scenario as in Example 1. 903 Here, we add an additional temporal constraint; Activity 3 and Activity 5 must be start simultaneously. 904 Find the makespan under this new condition. 905 906 """ 907 908 m1=Model() 909 durationA = {1:13, 2:25, 3:15, 4:27, 5:22 } 910 911 act={} 912 mode={} 913 914 for i in durationA: 915 act[i]=m1.addActivity("Act[%s]"%i) 916 mode[i]=Mode("Mode[%s]"%i,durationA[i]) 917 act[i].addModes(mode[i]) 918 919 #temporal (precedense) constraints 920 m1.addTemporal(act[1],act[3]) 921 m1.addTemporal(act[2],act[4]) 922 m1.addTemporal(act[2],act[5]) 923 m1.addTemporal(act[3],act[4]) 924 925 #act[3] and act[5] start at the same time 926 m1.addTemporal(act[3],act[5],"SS",0) 927 m1.addTemporal(act[5],act[3],"SS",0) 928 929 m1.Params.TimeLimit=1 930 m1.Params.OutputFlag=True 931 m1.Params.Makespan=True 932 m1.optimize() 933 m1.write("chart8.txt")
934 935 ##output: 936 ##activity Act[1] 937 ##mode duration 13 938 ##activity Act[2] 939 ##mode duration 25 940 ##activity Act[3] 941 ##mode duration 15 942 ##activity Act[4] 943 ##mode duration 27 944 ##activity Act[5] 945 ##mode duration 22 946 ## 947 ##temporal Act[1] Act[3] type CS delay 0 948 ##temporal Act[2] Act[4] type CS delay 0 949 ##temporal Act[2] Act[5] type CS delay 0 950 ##temporal Act[3] Act[4] type CS delay 0 951 ##temporal Act[3] Act[5] type SS delay 0 952 ##temporal Act[5] Act[3] type SS delay 0 953 ## 954 ##activity sink duedate 0 955 ## 956 ### reading data ... done: 0.00(s) 957 958 ### random seed: 1 959 960 ### tabu tenure: 0 961 962 ### cpu time limit: 1.00(s) 963 964 ### iteration limit: 1073741823 965 966 ### computing all-pairs longest paths and strongly connected components ... done 967 968 ###scc 6 969 970 ##objective value = 67 (cpu time = 0.00(s), iteration = 0) 971 972 ##0: 0.00(s): 67/67 973 974 ## 975 976 ##--- best activity list --- 977 978 ##source Act[2] Act[1] Act[3] Act[5] Act[4] sink 979 980 ## 981 982 ##--- best solution --- 983 984 ##source,---, 0 0 985 986 ##sink,---, 67 67 987 988 ##Act[1],---, 0 0--13 13 989 990 ##Act[2],---, 0 0--25 25 991 992 ##Act[3],---, 25 25--40 40 993 994 ##Act[4],---, 40 40--67 67 995 996 ##Act[5],---, 25 25--47 47 997 998 ##--- tardy activity --- 999 1000 ##sink: 67 1001 1002 ##--- resource residuals --- 1003 1004 ## 1005 1006 ##objective value = 67 1007 1008 ##cpu time = 0.00/1.00(s) 1009 1010 ##iteration = 0/21037 1011 1012 ## 1013 ## 1014 ##source --- 0 0 1015 ##sink --- 67 67 1016 ##Act[1] --- 0 13 1017 ##Act[2] --- 0 25 1018 ##Act[3] --- 25 40 1019 ##Act[4] --- 40 67 1020 ##Act[5] --- 25 47 1021 ##planning horizon= 67 1022 1023 #chart8.txt 1024 ##activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67| 1025 ##---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 1026 ## Act[1] Mode[1] 13 |==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1027 ## Act[2] Mode[2] 25 |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1028 ## Act[3] Mode[3] 15 | | | | | | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | 1029 ## Act[4] Mode[4] 27 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| 1030 ## Act[5] Mode[5] 22 | | | | | | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | 1031 ##--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1032 ## resource usage/capacity | 1033 ##--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1034 1035
1036 -def Example9():
1037 """ 1038 Example 9 1039 Breakable Activity 1040 file name: Example9.py 1041 Copyright Log Opt Co., Ltd. 1042 1043 Consider the same scenario as in Example 6. 1044 Here, Activities 2 and 3 can interrupt their processing and re-start after one unit of break time. 1045 Find the optimal schedule (minimum tardiness solution) under this new condition. 1046 """ 1047 m1=Model() 1048 1049 due={1:5,2:9,3:6,4:4} 1050 duration={1:1, 2:2, 3:3, 4:4 } 1051 1052 res=m1.addResource("writer") 1053 res.addCapacity(0,3,1) 1054 res.addCapacity(4,6,1) 1055 res.addCapacity(7,10,1) 1056 res.addCapacity(11,"inf",1) 1057 1058 act={} 1059 mode={} 1060 1061 for i in duration: 1062 act[i]=m1.addActivity("Act[%s]"%i,duedate=due[i]) 1063 mode[i]=Mode("Mode[%s]"%i,duration[i]) 1064 mode[i].addResource(res,{(0,"inf"):1}) 1065 if i=="B": 1066 mode[i].addBreak(0,2,1) 1067 if i=="C": 1068 mode[i].addBreak(0,3,1) 1069 #act["C"] uses resource in it's break time 1070 # mode[i].addResource(res,{(0,"inf"):1},"break") 1071 if i=="D": 1072 mode[i].addBreak(0,4,1) 1073 act[i].addModes(mode[i]) 1074 1075 m1.Params.TimeLimit=1 1076 m1.Params.OutputFlag=True 1077 m1.Params.Makespan=False 1078 m1.optimize() 1079 m1.write("chart9.txt")
1080 1081 ##output: 1082 ##resource writer 1083 ## interval 0 3 capacity 1 1084 ## interval 4 6 capacity 1 1085 ## interval 7 10 capacity 1 1086 ## interval 11 inf capacity 1 1087 ##activity Act[A] 1088 ## duedate 5 1089 ## weight 1 1090 ##mode duration 1 1091 ## writer interval 0 inf requirement 1 1092 ##activity Act[C] 1093 ## duedate 6 1094 ## weight 1 1095 ##mode duration 3 1096 ## writer interval 0 inf requirement 1 1097 ## break interval 0 3 max 1 1098 ##activity Act[B] 1099 ## duedate 9 1100 ## weight 1 1101 ##mode duration 2 1102 ## writer interval 0 inf requirement 1 1103 ## break interval 0 2 max 1 1104 ##activity Act[D] 1105 ## duedate 4 1106 ## weight 1 1107 ##mode duration 4 1108 ## writer interval 0 inf requirement 1 1109 ## break interval 0 4 max 1 1110 ## 1111 ## 1112 ## 1113 ### reading data ... done: 0.00(s) 1114 1115 ### random seed: 1 1116 1117 ### tabu tenure: 0 1118 1119 ### cpu time limit: 1.00(s) 1120 1121 ### iteration limit: 1073741823 1122 1123 ### computing all-pairs longest paths and strongly connected components ... done 1124 1125 ###scc 6 1126 1127 ##objective value = 10 (cpu time = 0.00(s), iteration = 0) 1128 1129 ##0: 0.00(s): 10/10 1130 1131 ##objective value = 9 (cpu time = 0.00(s), iteration = 1) 1132 1133 ## 1134 1135 ##--- best activity list --- 1136 1137 ##source Act[D] Act[A] Act[B] Act[C] sink 1138 1139 ## 1140 1141 ##--- best solution --- 1142 1143 ##source,---, 0 0 1144 1145 ##sink,---, 13 13 1146 1147 ##Act[A],---, 5 5--6 6 1148 1149 ##Act[C],---, 8 9--10 11--13 13 1150 1151 ##Act[B],---, 6 7--9 9 1152 1153 ##Act[D],---, 0 0--3 4--5 5 1154 1155 ##--- tardy activity --- 1156 1157 ##Act[A]: 1 1158 1159 ##Act[C]: 7 1160 1161 ##Act[D]: 1 1162 1163 ##--- resource residuals --- 1164 1165 ##writer: [0,13] 0 1166 1167 ## 1168 1169 ##objective value = 9 1170 1171 ##cpu time = 0.00/1.00(s) 1172 1173 ##iteration = 1/10241 1174 1175 ## 1176 ## 1177 ##source --- 0 0 1178 ##sink --- 13 13 1179 ##Act[A] --- 5 6 1180 ##Act[C] --- 8 13 1181 ##Act[B] --- 6 9 1182 ##Act[D] --- 0 5 1183 ##planning horizon= 13 1184 1185 #chart9.txt 1186 ## activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13| 1187 ##---------------------------------------------------------------------| 1188 ## Act[A] Mode[A] 1 | | | | | |==| | | | | | | | 1189 ## Act[B] Mode[B] 2 | | | | | | |..|==|==| | | | | 1190 ## Act[C] Mode[C] 3 | | | | | | | | |..|==|..|==|==| 1191 ## Act[D] Mode[D] 4 |==|==|==|..|==| | | | | | | | | 1192 ##--------------------------------------------------------------------- 1193 ## resource usage/capacity | 1194 ##--------------------------------------------------------------------- 1195 ## writer | 1| 1| 1| 0| 1| 1| 0| 1| 1| 1| 0| 1| 1| 1196 ## | 1| 1| 1| 0| 1| 1| 0| 1| 1| 1| 0| 1| 1| 1197 ##--------------------------------------------------------------------- 1198
1199 -def Example10():
1200 """ 1201 Example 10 1202 Parallel Execution 1203 file name: Example10.py 1204 Copyright Log Opt Co., Ltd. 1205 1206 Consider the same scenario as in Example 3. 1207 Here, Activity 1 can be processed in parallel up to 3 units. 1208 Find the optimal schedule under this new condition. 1209 1210 """ 1211 1212 m1=Model() 1213 duration ={1:3, 2:2, 3:2, 4:2, 5:4, 6:4, 7:4, 8:4, 9:11, 10:2 } 1214 1215 res=m1.addResource("worker") 1216 res.addCapacity(0,"inf",3) 1217 1218 act={} 1219 mode={} 1220 1221 for i in duration: 1222 act[i]=m1.addActivity("Act[%s]"%i) 1223 mode[i]=Mode("Mode[%s]"%i,duration[i]) 1224 mode[i].addResource(res,{(0,"inf"):1}) 1225 if i==1: 1226 mode[i].addParallel(1,1,3) 1227 act[i].addModes(mode[i]) 1228 1229 #temporal (precedense) constraints 1230 m1.addTemporal(act[1],act[9]) 1231 for i in range(5,9): 1232 m1.addTemporal(act[4],act[i]) 1233 m1.addTemporal(act[i],act[10]) 1234 1235 m1.Params.TimeLimit=1 1236 m1.Params.OutputFlag=True 1237 m1.Params.Makespan=True 1238 m1.optimize() 1239 m1.write("chart10.txt")
1240 1241 ##output: 1242 ##resource worker 1243 ## interval 0 inf capacity 3 1244 ##activity Act[1] 1245 ##mode duration 3 1246 ## worker interval 0 inf requirement 1 1247 ## parallel interval 1 1 max 3 1248 ##activity Act[2] 1249 ##mode duration 2 1250 ## worker interval 0 inf requirement 1 1251 ##activity Act[3] 1252 ##mode duration 2 1253 ## worker interval 0 inf requirement 1 1254 ##activity Act[4] 1255 ##mode duration 2 1256 ## worker interval 0 inf requirement 1 1257 ##activity Act[5] 1258 ##mode duration 4 1259 ## worker interval 0 inf requirement 1 1260 ##activity Act[6] 1261 ##mode duration 4 1262 ## worker interval 0 inf requirement 1 1263 ##activity Act[7] 1264 ##mode duration 4 1265 ## worker interval 0 inf requirement 1 1266 ##activity Act[8] 1267 ##mode duration 4 1268 ## worker interval 0 inf requirement 1 1269 ##activity Act[9] 1270 ##mode duration 11 1271 ## worker interval 0 inf requirement 1 1272 ##activity Act[10] 1273 ##mode duration 2 1274 ## worker interval 0 inf requirement 1 1275 ## 1276 ##temporal Act[1] Act[9] type CS delay 0 1277 ##temporal Act[4] Act[5] type CS delay 0 1278 ##temporal Act[5] Act[10] type CS delay 0 1279 ##temporal Act[4] Act[6] type CS delay 0 1280 ##temporal Act[6] Act[10] type CS delay 0 1281 ##temporal Act[4] Act[7] type CS delay 0 1282 ##temporal Act[7] Act[10] type CS delay 0 1283 ##temporal Act[4] Act[8] type CS delay 0 1284 ##temporal Act[8] Act[10] type CS delay 0 1285 ## 1286 ##activity sink duedate 0 1287 ## 1288 ### reading data ... done: 0.00(s) 1289 1290 ### random seed: 1 1291 1292 ### tabu tenure: 0 1293 1294 ### cpu time limit: 1.00(s) 1295 1296 ### iteration limit: 1073741823 1297 1298 ### computing all-pairs longest paths and strongly connected components ... done 1299 1300 ###scc 12 1301 1302 ##objective value = 14 (cpu time = 0.00(s), iteration = 0) 1303 1304 ##0: 0.00(s): 14/14 1305 1306 ##objective value = 13 (cpu time = 0.01(s), iteration = 25) 1307 1308 ## 1309 1310 ##--- best activity list --- 1311 1312 ##source Act[4] Act[5] Act[1] Act[2] Act[9] Act[6] Act[8] Act[7] Act[3] Act[10] sink 1313 1314 ## 1315 1316 ##--- best solution --- 1317 1318 ##source,---, 0 0 1319 1320 ##sink,---, 13 13 1321 1322 ##Act[1],---, 0 0--1[2] 1--2 2 1323 1324 ##Act[2],---, 1 1--3 3 1325 1326 ##Act[3],---, 10 10--12 12 1327 1328 ##Act[4],---, 0 0--2 2 1329 1330 ##Act[5],---, 2 2--6 6 1331 1332 ##Act[6],---, 3 3--7 7 1333 1334 ##Act[7],---, 7 7--11 11 1335 1336 ##Act[8],---, 6 6--10 10 1337 1338 ##Act[9],---, 2 2--13 13 1339 1340 ##Act[10],---, 11 11--13 13 1341 1342 ##--- tardy activity --- 1343 1344 ##sink: 13 1345 1346 ##--- resource residuals --- 1347 1348 ##worker: [0,12] 0 [12,13] 1 1349 1350 ## 1351 1352 ##objective value = 13 1353 1354 ##cpu time = 0.01/1.00(s) 1355 1356 ##iteration = 25/6292 1357 1358 ## 1359 ## 1360 ##source --- 0 0 1361 ##sink --- 13 13 1362 ##Act[1] --- 0 2 1363 ##Act[2] --- 1 3 1364 ##Act[3] --- 10 12 1365 ##Act[4] --- 0 2 1366 ##Act[5] --- 2 6 1367 ##Act[6] --- 3 7 1368 ##Act[7] --- 7 11 1369 ##Act[8] --- 6 10 1370 ##Act[9] --- 2 13 1371 ##Act[10] --- 11 13 1372 ##planning horizon= 13 1373 1374 #chart10.txt 1375 ## activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13| 1376 ##---------------------------------------------------------------------| 1377 ## Act[10] Mode[10] 2 | | | | | | | | | | | |==|==| 1378 ## Act[1] Mode[1] 3 |*2|==| | | | | | | | | | | | 1379 ## Act[2] Mode[2] 2 | |==|==| | | | | | | | | | | 1380 ## Act[3] Mode[3] 2 | | | | | | | | | | |==|==| | 1381 ## Act[4] Mode[4] 2 |==|==| | | | | | | | | | | | 1382 ## Act[5] Mode[5] 4 | | |==|==|==|==| | | | | | | | 1383 ## Act[6] Mode[6] 4 | | | |==|==|==|==| | | | | | | 1384 ## Act[7] Mode[7] 4 | | | | | | | |==|==|==|==| | | 1385 ## Act[8] Mode[8] 4 | | | | | | |==|==|==|==| | | | 1386 ## Act[9] Mode[9] 11 | | |==|==|==|==|==|==|==|==|==|==|==| 1387 ##--------------------------------------------------------------------- 1388 ## resource usage/capacity | 1389 ##--------------------------------------------------------------------- 1390 ## worker | 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 2| 1391 ## | 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 3| 1392 1393 1394 1395 1396
1397 -def Example11():
1398 """ 1399 A simple test problem for the Resource Constrained Scheduling Solver OptSeq 1400 file name: Example11.py 1401 Copyright Log Opt Co., Ltd. 1402 1403 Consider a small job shop problem consisting of 4 activities and 3 machines. 1404 Each activity consists of three sub-jobs (operations). 1405 Operation must be processed in the order of 1,2 and 3 on thecorresponding machines. 1406 The machines to be processed and the processing time (days) are kept by the dictionary 1407 JobInfo={ (1,1):(1,7), (1,2):(2,10), (1,3):(3,4), 1408 (2,1):(3,9), (2,2):(1,5), (2,3):(2,11), 1409 (3,1):(1,3), (3,2):(3,9), (3,3):(2,12), 1410 (4,1):(2,6), (4,2):(3,13),(4,3):(1,9) 1411 } 1412 that maps a tuple of activity ID and operation ID to a tuple of machine IDand processing time. 1413 The objective is to minimize the latest completion time of activities (makespan). 1414 We add the following practical conditions: 1415 1. Each operation requires the worker resource for the first 2 days. The worker resource is available on weekdays only and its capacity(maximum number of operations to be executed in a day) is 2. 1416 2. Each operation may have a break after 1 day. 1417 3. Operations on machine 1 can be processed in parallel. 1418 4. Operations on machine 2 can be processed in an express mode whose processing time is 4 days. The express mode is restricted to be at most once in a whole. 1419 5. On machine 1, operation 2 must be executed just after operation 1. 1420 """ 1421 m1=Model() 1422 #resource declaration 1423 machine={} #define three machines 1424 for j in range(1,4): 1425 machine[j]=m1.addResource("machine[%s]"%j,capacity={(0,"inf"):1}) 1426 1427 #CAP={} #capacity of human resources; two workers are available on weekdays 1428 #for t in range(9): 1429 # CAP[(t*7,t*7+5)]=2 1430 #manpower=m1.addResource("manpower",capacity=CAP) 1431 # we may write ... 1432 manpower=m1.addResource("manpower") 1433 for t in range(9): 1434 manpower.addCapacity(t*7,t*7+5,2) 1435 1436 #budget constraint 1437 budget=m1.addResource("budget_constraint",rhs=1) 1438 1439 #activity declaration (3 activities are processed on three machines) 1440 #JobInfo containes the info. of operations (activity,1..3):-> machine ID and proc. time 1441 JobInfo={ (1,1):(1,7), (1,2):(2,10), (1,3):(3,4), 1442 (2,1):(3,9), (2,2):(1,5), (2,3):(2,11), 1443 (3,1):(1,3), (3,2):(3,9), (3,3):(2,12), 1444 (4,1):(2,6), (4,2):(3,13), (4,3):(1,9) 1445 } 1446 act={} 1447 express=Mode("Express",duration=4) 1448 express.addResource(machine[2],{(0,"inf"):1},"max") 1449 express.addResource(manpower,{(0,2):1}) 1450 express.addBreak(1,1) 1451 #express.addParallel(1,1,2) 1452 1453 mode={} 1454 for (i,j) in JobInfo: #for each job and machine 1455 act[i,j]=m1.addActivity("Act[%s][%s]"%(i,j)) 1456 mode[i,j]=Mode("Mode[%s][%s]"%(i,j),duration=JobInfo[i,j][1]) 1457 mode[i,j].addResource(machine[JobInfo[i,j][0]],{(0,"inf"):1},"max") 1458 mode[i,j].addResource(manpower,{(0,2):1}) 1459 mode[i,j].addBreak(1,1) 1460 if JobInfo[i,j][0]==1: 1461 mode[i,j].addParallel(1,1,2) 1462 1463 1464 if JobInfo[i,j][0]==2: 1465 #activities processed on machine 2 have two modes, Express and Normal. 1466 act[i,j].addModes(mode[i,j],express) 1467 #Express mode needs one budget 1468 budget.addTerms(1,act[i,j],express) 1469 else: 1470 act[i,j].addModes(mode[i,j]) #single mode activity 1471 #print act[i,j] 1472 #temporal (precedense) constraints 1473 for i in range(1,5): 1474 for j in range(1,3): 1475 m1.addTemporal(act[i,j],act[i,j+1]) 1476 1477 #Define that Act[2][2] must be processed just after Act[1][1] on machine 1 1478 #introduce dummy with duration 0 and can break at time 0 1479 #it requires machine 1 during the break, 1480 # completion of Act[1][1]=start of dummy and completaion of dummy=start of Act[2][2] 1481 d_act=m1.addActivity("dummy_activity") 1482 d_mode=Mode("dummy_mode") 1483 d_mode.addBreak(0,0) 1484 d_mode.addResource(machine[1],{(0,0):1},"break") 1485 d_act.addModes(d_mode) 1486 m1.addTemporal(act[1,1],d_act,tempType="CS") 1487 m1.addTemporal(d_act,act[1,1],tempType="SC") 1488 m1.addTemporal(d_act,act[2,2],tempType="CS") 1489 m1.addTemporal(act[2,2],d_act,tempType="SC") 1490 1491 m1.Params.TimeLimit=1 1492 m1.Params.OutputFlag=True 1493 m1.Params.Makespan=True 1494 m1.optimize() 1495 m1.write("chart11.txt")
1496 1497 ## output: 1498 ## resource machine[1] 1499 ## interval 0 inf capacity 1 1500 ## resource machine[2] 1501 ## interval 0 inf capacity 1 1502 ## resource machine[3] 1503 ## interval 0 inf capacity 1 1504 ## resource manpower 1505 ## interval 0 5 capacity 2 1506 ## interval 7 12 capacity 2 1507 ## interval 14 19 capacity 2 1508 ## interval 21 26 capacity 2 1509 ## interval 28 33 capacity 2 1510 ## interval 35 40 capacity 2 1511 ## interval 42 47 capacity 2 1512 ## interval 49 54 capacity 2 1513 ## interval 56 61 capacity 2 1514 ## mode Mode[2][3] duration 11 1515 ## manpower interval 0 2 requirement 1 1516 ## machine[2] max interval 0 inf requirement 1 1517 ## break interval 1 1 1518 ## mode Mode[4][1] duration 6 1519 ## manpower interval 0 2 requirement 1 1520 ## machine[2] max interval 0 inf requirement 1 1521 ## break interval 1 1 1522 ## mode Express duration 4 1523 ## manpower interval 0 2 requirement 1 1524 ## machine[2] max interval 0 inf requirement 1 1525 ## break interval 1 1 1526 ## mode Mode[1][2] duration 10 1527 ## manpower interval 0 2 requirement 1 1528 ## machine[2] max interval 0 inf requirement 1 1529 ## break interval 1 1 1530 ## mode Mode[3][3] duration 12 1531 ## manpower interval 0 2 requirement 1 1532 ## machine[2] max interval 0 inf requirement 1 1533 ## break interval 1 1 1534 ## activity Act[3][2] 1535 ## mode duration 9 1536 ## manpower interval 0 2 requirement 1 1537 ## machine[3] max interval 0 inf requirement 1 1538 ## break interval 1 1 1539 ## activity Act[1][3] 1540 ## mode duration 4 1541 ## manpower interval 0 2 requirement 1 1542 ## machine[3] max interval 0 inf requirement 1 1543 ## break interval 1 1 1544 ## activity Act[2][1] 1545 ## mode duration 9 1546 ## manpower interval 0 2 requirement 1 1547 ## machine[3] max interval 0 inf requirement 1 1548 ## break interval 1 1 1549 ## activity Act[2][3] 1550 ## Mode[2][3] Express 1551 ## activity Act[4][2] 1552 ## mode duration 13 1553 ## manpower interval 0 2 requirement 1 1554 ## machine[3] max interval 0 inf requirement 1 1555 ## break interval 1 1 1556 ## activity Act[1][2] 1557 ## Mode[1][2] Express 1558 ## activity Act[3][3] 1559 ## Mode[3][3] Express 1560 ## activity Act[3][1] 1561 ## mode duration 3 1562 ## manpower interval 0 2 requirement 1 1563 ## machine[1] max interval 0 inf requirement 1 1564 ## break interval 1 1 1565 ## parallel interval 1 1 max 2 1566 ## activity Act[4][3] 1567 ## mode duration 9 1568 ## manpower interval 0 2 requirement 1 1569 ## machine[1] max interval 0 inf requirement 1 1570 ## break interval 1 1 1571 ## parallel interval 1 1 max 2 1572 ## activity Act[2][2] 1573 ## mode duration 5 1574 ## manpower interval 0 2 requirement 1 1575 ## machine[1] max interval 0 inf requirement 1 1576 ## break interval 1 1 1577 ## parallel interval 1 1 max 2 1578 ## activity Act[4][1] 1579 ## Mode[4][1] Express 1580 ## activity Act[1][1] 1581 ## mode duration 7 1582 ## manpower interval 0 2 requirement 1 1583 ## machine[1] max interval 0 inf requirement 1 1584 ## break interval 1 1 1585 ## parallel interval 1 1 max 2 1586 ## activity dummy_activity 1587 ## mode duration 0 1588 ## machine[1] interval break 0 0 requirement 1 1589 ## break interval 0 0 1590 ## 1591 ## temporal Act[1][1] Act[1][2] type CS delay 0 1592 ## temporal Act[1][2] Act[1][3] type CS delay 0 1593 ## temporal Act[2][1] Act[2][2] type CS delay 0 1594 ## temporal Act[2][2] Act[2][3] type CS delay 0 1595 ## temporal Act[3][1] Act[3][2] type CS delay 0 1596 ## temporal Act[3][2] Act[3][3] type CS delay 0 1597 ## temporal Act[4][1] Act[4][2] type CS delay 0 1598 ## temporal Act[4][2] Act[4][3] type CS delay 0 1599 ## temporal Act[1][1] dummy_activity type CS delay 0 1600 ## temporal dummy_activity Act[1][1] type SC delay 0 1601 ## temporal dummy_activity Act[2][2] type CS delay 0 1602 ## temporal Act[2][2] dummy_activity type SC delay 0 1603 ## nonrenewable 1(Act[2][3],Express) 1(Act[1][2],Express) 1(Act[3][3],Express) 1(Act[4][1],Express) <=1 1604 ## activity sink duedate 0 1605 ## 1606 ## # reading data ... done: 0.01(s) 1607 1608 ## # random seed: 1 1609 1610 ## # tabu tenure: 0 1611 1612 ## # cpu time limit: 1.00(s) 1613 1614 ## # iteration limit: 1073741823 1615 1616 ## # computing all-pairs longest paths and strongly connected components ... done 1617 1618 ## #scc 13 1619 1620 ## objective value = 47 (cpu time = 0.00(s), iteration = 0) 1621 1622 ## 0: 0.00(s): 47/47 1623 1624 ## objective value = 39 (cpu time = 0.00(s), iteration = 1) 1625 1626 ## objective value = 38 (cpu time = 0.00(s), iteration = 9) 1627 1628 ## 1629 1630 ## --- best activity list --- 1631 1632 ## source Act[2][1] Act[1][1] dummy_activity Act[2][2] Act[4][1] Act[4][2] Act[3][1] Act[3][2] Act[1][2] Act[2][3] Act[4][3] Act[1][3] Act[3][3] sink 1633 1634 ## 1635 1636 ## --- best solution --- 1637 1638 ## source,---, 0 0 1639 1640 ## sink,---, 38 38 1641 1642 ## Act[3][2],---, 23 23--32 32 1643 1644 ## Act[1][3],---, 32 32--33 35--38 38 1645 1646 ## Act[2][1],---, 0 0--9 9 1647 1648 ## Act[2][3],Mode[2][3], 21 21--32 32 1649 1650 ## Act[4][2],---, 10 10--23 23 1651 1652 ## Act[1][2],Mode[1][2], 8 8--9 10--19 19 1653 1654 ## Act[3][3],Express, 32 32--33 35--38 38 1655 1656 ## Act[3][1],---, 14 14--15[2] 15--16 16 1657 1658 ## Act[4][3],---, 23 23--32 32 1659 1660 ## Act[2][2],---, 9 9--10[2] 10--13 13 1661 1662 ## Act[4][1],Mode[4][1], 2 2--8 8 1663 1664 ## Act[1][1],---, 0 0--7 7 1665 1666 ## dummy_activity,---, 7 9 1667 1668 ## --- tardy activity --- 1669 1670 ## sink: 38 1671 1672 ## --- resource residuals --- 1673 1674 ## machine[1]: [0,13] 0 [13,14] 1 [14,16] 0 [16,23] 1 [23,32] 0 [32,1073741823] 1 1675 1676 ## machine[2]: [0,2] 1 [2,9] 0 [9,10] 1 [10,19] 0 [19,21] 1 [21,33] 0 [33,35] 1 [35,38] 0 1677 1678 ## machine[3]: [0,9] 0 [9,10] 1 [10,33] 0 [33,35] 1 [35,38] 0 1679 1680 ## manpower: [0,2] 0 [2,4] 1 [4,5] 2 [5,7] 0 [7,8] 2 [8,9] 1 [9,11] 0 [11,12] 1 [12,15] 0 [15,19] 2 [19,21] 0 [21,23] 1 [23,25] 0 [25,26] 2 [26,28] 0 [28,32] 2 [32,36] 0 [36,40] 2 1681 1682 ## 1683 1684 ## objective value = 38 1685 1686 ## cpu time = 0.00/1.02(s) 1687 1688 ## iteration = 9/2794 1689 1690 ## 1691 ## 1692 ## source --- 0 0 1693 ## sink --- 38 38 1694 ## Act[3][2] --- 23 32 1695 ## Act[1][3] --- 32 38 1696 ## Act[2][1] --- 0 9 1697 ## Act[2][3] Mode[2][3] 21 32 1698 ## Act[4][2] --- 10 23 1699 ## Act[1][2] Mode[1][2] 8 19 1700 ## Act[3][3] Express 32 38 1701 ## Act[3][1] --- 14 16 1702 ## Act[4][3] --- 23 32 1703 ## Act[2][2] --- 9 13 1704 ## Act[4][1] Mode[4][1] 2 8 1705 ## Act[1][1] --- 0 7 1706 ## dummy_activity --- 7 9 1707 ## planning horizon= 38 1708 1709 ## activity mode duration | 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38| 1710 ##------------------------------------------------------------------------------------------------------------------------------------------------| 1711 ##Act[1][1] Mode[1][1] 7 |==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1712 ##Act[1][2] Mode[1][2] 10 | | | | | | | | |==|..|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | 1713 ##Act[1][3] Mode[1][3] 4 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |==|..|..|==|==|==| 1714 ##Act[2][1] Mode[2][1] 9 |==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1715 ##Act[2][2] Mode[2][2] 5 | | | | | | | | | |*2|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | 1716 ##Act[2][3] Mode[2][3] 11 | | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==| | | | | | | 1717 ##Act[3][1] Mode[3][1] 3 | | | | | | | | | | | | | | |*2|==| | | | | | | | | | | | | | | | | | | | | | | 1718 ##Act[3][2] Mode[3][2] 9 | | | | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==| | | | | | | 1719 ##Act[3][3] Express 4 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |==|..|..|==|==|==| 1720 ##Act[4][1] Mode[4][1] 6 | | |==|==|==|==|==|==| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1721 ##Act[4][2] Mode[4][2] 13 | | | | | | | | | | |==|==|==|==|==|==|==|==|==|==|==|==|==| | | | | | | | | | | | | | | | 1722 ##Act[4][3] Mode[4][3] 9 | | | | | | | | | | | | | | | | | | | | | | | |==|==|==|==|==|==|==|==|==| | | | | | | 1723 ##dummy_actidummy_mode 0 | | | | | | | |..|..| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1724 ##------------------------------------------------------------------------------------------------------------------------------------------------ 1725 ## resource usage/capacity | 1726 ##------------------------------------------------------------------------------------------------------------------------------------------------ 1727 ## machine[1] | 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 0| 1| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1| 1| 1| 1| 1| 1| 1| 1| 0| 0| 0| 0| 0| 0| 1728 ## | 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1729 ##------------------------------------------------------------------------------------------------------------------------------------------------ 1730 ## machine[2] | 0| 0| 1| 1| 1| 1| 1| 1| 1| 0| 1| 1| 1| 1| 1| 1| 1| 1| 1| 0| 0| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 0| 0| 1| 1| 1| 1731 ## | 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1732 ##------------------------------------------------------------------------------------------------------------------------------------------------ 1733 ## machine[3] | 1| 1| 1| 1| 1| 1| 1| 1| 1| 0| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 0| 0| 1| 1| 1| 1734 ## | 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1| 1735 ##------------------------------------------------------------------------------------------------------------------------------------------------ 1736 ## manpower | 2| 2| 1| 1| 0| 0| 0| 0| 1| 2| 2| 1| 0| 0| 2| 0| 0| 0| 0| 0| 0| 1| 1| 2| 2| 0| 0| 0| 0| 0| 0| 0| 2| 0| 0| 2| 0| 0| 1737 ## | 2| 2| 2| 2| 2| 0| 0| 2| 2| 2| 2| 2| 0| 0| 2| 2| 2| 2| 2| 0| 0| 2| 2| 2| 2| 2| 0| 0| 2| 2| 2| 2| 2| 0| 0| 2| 2| 2| 1738 ##------------------------------------------------------------------------------------------------------------------------------------------------ 1739