TEST CASE FOR JOB SHOP SCHEDULING
Kushagra Tiwary
Type of Test Case: JSP
Reason for classification as JSP: The number of jobs is equal to or greater than the
number of machines. (i.e., the number of rows is equal to or greater than the
number of columns in the test case)
Design of the test instance:Constraints:
1) Number of jobs must be greater than 5.
2) Number of machines must be greater than 10.
3) Number of jobs must always be equal to or greater than number of machines.
(If the number of jobs is less than the number of machines, the problem becomes a lot
easier to solve)
4) The upper bound on the number of jobs is 30.
(If the number of jobs exceeds 30, the problem becomes very hard and consequently, it is
hard to visualize how it is optimized).
5) Number of machines should at least be half the number of jobs.
(If the number of machines is very less, again the problem becomes very complex)
6) The upper bound on the number of machines is 30.
(If the number of machines exceeds 30, the problem becomes very hard and
consequently, it is hard to visualize how it is optimized).
7) The upper bound on the duration of an operation in a job should be at least 20 and at
most 100.
(If the durations are standardized, the test instance seems more realistic. Also, if an
operation has a very low duration (say, 1 second) on one machine and a very high duration
on another machine (say, 1000 seconds), that would make the test case very unrealistic
since that should be the case with real life problem instances on job shop scheduling).
Implementation Details (Java):
//creates a random sequence of job objects with job id, machine id, duration, given the job id for which the
sequence is being created, and an upper bound, i.e. number of machines
public static JobSequence createJobSequence(int jobNo, int machineSize){
JobSequence js=new JobSequence();
ArrayList<Integer> temp=new ArrayList<>();
ArrayList<Integer> machineSequence=new ArrayList<>();
for(int m=0;m<machineSize;m++){
temp.add(m);
}
for(int m=0;m<machineSize;m++){
int size=temp.size();
int randIndex=(int)((size-1)*Math.random());
machineSequence.add(temp.get(randIndex));
temp.remove(randIndex);
}
for(int m=0;m<machineSize;m++){
int dur=20+(int)(50*Math.random());
Job curr=new Job(jobNo, machineSequence.get(m), dur);
js.add(curr);
}
return js;
}
//creates a random job matrix with 11 to 30 jobs and 6-30 machines and returns a job matrix object
public static JobMatrix createRandom(){
int randJobs=11+(int)(20*Math.random());
int randMachines=(randJobs/2+(24*randJobs))%randJobs;
JobMatrix randomJM=new JobMatrix(randJobs,randMachines);
for(int j=0;j<randJobs;j++){
JobSequence[] jmqueue=new JobSequence[randJobs];
jmqueue[j]=new JobSequence();
jmqueue[j]=createJobSequence(j, randMachines);
for(int m=0;m<randMachines;m++){
Job curr=jmqueue[j].remove(0);
randomJM.index[j][m]=curr;
}
}
return randomJM;
}
A TEST INSTANCE GENERATED USING THE ABOVE ALGORITHM:
JOB MATRIX:13 6
3 67
4 49
2 68
1 28
1 38
4 59
3 40
0 68
3 50
2 36
1 58
3 24
0 51
4 41
3 54
4 69
4 29
0 51
1 60
0 35
2 57
1 49
2 22
3 53
4 57
1 23
2 67
4 36
3 31
2 33
4 64
0 30
2 34
2 34
3 26
2 48
3 26
0 20
0 61
1 25
3 42
0 61
1 29
1 63
2 61
1 59
0 45
2 31
3 57
4 42
4 39
3 69
0 20
0 63
2 26
4 54
0 31
4 57
3 24
1 67
1 55
4 43
0 44
1 65
2 38
5 60
5 45
5 68
5 28
5 56
5 69
5 54
5 28
5 26
5 46
5 32
5 68
5 24
RESULTS OBSERVED AFTER 50,000 RUNS:
1) OPTIMIZING MAKESPAN
INITIAL MACHINE MATRIX FOR MAKESPAN:1246 13324
60
9 118 5 288 3 318 11 386 12 406
50
9 58
2 118 12 156 1 179 10 207
10
11 68 4 90
10 126 9 183 5 318
40
7 50
0 104 3 171 11 211 5 264
12 0
2 156 7 215 0 284 8 333 4 362
5 599 2 711 11 779 0 847 4 907 6 963
8 467
4 426
7 379
2 288
6 426
9 1017
2 518
6 514
0 413
1 503
1 467
1 1063
7 579 1 624
11 573 3 638
6 480 3 514
9 545 10 602
11 503 5 542
10 1108
4 687
0 667
8 654
8 628
10 628
3 1140
Image credits: http://www.robpaulson.com/jobshop.html
0 718
7 692
2 685
12 654
9 670
7 1168
10 738
8 759
12 723
6 723
3 713
8 1196 12 1222
FINAL MACHINE MATRIX OPTIMIZED BY MAKESPAN OVER 500 RUNS:1065 10953
60
9 156 5 195 3 235 11 303 12 323 8 384 2 435 7 496
20
5 38
9 96
12 156 1 179 10 207 4 404 6 467 11 526
10
11 68 4 90
10 126 9 191 5 239 7 300 0 334 6 401
40
7 50
0 104 5 171 3 195 11 235 2 288 9 319 1 376
12 0
2 57
7 116 0 185 1 234 8 270 6 299 4 340 5 404
5 461 2 530 6 598 11 652 1 720 0 765 9 825 4 871 10 927
1 541
3 591
3 435
10 418
11 461
3 959
4 604
0 620
8 470
8 444
10 500
8 987
Image credits: http://www.robpaulson.com/jobshop.html
0 645
7 645
2 501
12 470
9 542
7 1013
10 665
8 712
12 539
6 539
3 620
12 1041
2) OPTIMIZING TWFT (CUMULATIVE VALUE OF DIFFERENCES OF END TIME
AND START TIME FOR ALL THE JOBS IN A GIVEN COMPLETE SCHEDULE IN
THIS CASE)
INITIAL MACHINE MATRIX FOR TWFT:2410 16790
8 29
10 311 3 355 6 423 11 750
8 137 10 194 3 456 6 614 11 809
8 106 10 137 3 423 6 580 11 614
8 80
10 243 3 269 6 673 11 697
80
10 269 3 485 6 539 11 770
8 192 10 355 3 539 6 697 11 874
12 897 1 1239
12 874 1 1133
12 1027
12 958 1 1197
12 809 1 1161
12 1065
2 1302
2 1161
1 1065
2 1258
2 1199
1 1302
0 1497
0 1472
2 1363
0 1289
0 1356
2 1389
9 1557
9 1497
0 1405
9 1640
9 1697
0 1517
7 1854
7 1899
9 1592
7 1697
7 1751
9 1740
Image credits: http://www.robpaulson.com/jobshop.html
5 2048
5 1966
7 1820
5 2024
5 2139
7 1966
4 2323
4 2260
5 2078 4 2139
4 2048
4 2196
5 2196 4 2354
FINAL MACHINE MATRIX OPTIMIZED BY TWFT OVER 500 RUNS:1102 8651
8 29
3 80
6 148 10 199 11 256 12 393 1 468 9 556 2 591
10 57 8 137 3 192 6 274 1 342 12 370 2 393 11 431 9 496
10 0
8 106 3 148 11 181 6 240 1 274 12 537 9 591 2 652
30
8 80
10 106 11 203 6 333 1 426 12 468 2 537 0 568
80
10 132 6 199 3 240 12 294 11 351 1 390 2 431 0 635
8 192 10 243 3 294 6 357 11 496 12 575 1 599 2 678 0 796
0 776
5 556
0 684
7 635
7 689
9 856
5 796
0 751
7 758
5 689
9 770
7 938
Image credits: http://www.robpaulson.com/jobshop.html
7 826
7 871
4 820
9 713
4 856
5 977
4 1001
4 938
5 856
4 770
5 920
4 1046
© Copyright 2026 Paperzz