Browse Source

Mise en place de code et Manupulation des représentations : TERMINE

Faure Paul 3 months ago
parent
commit
9bc6dfdec3
2 changed files with 56 additions and 4 deletions
  1. 22
    0
      notes.txt
  2. 34
    4
      src/main/java/jobshop/MainTest.java

+ 22
- 0
notes.txt View File

@@ -0,0 +1,22 @@
1
+Encodage : ordre des jobs [0,0,1,1,0,1]
2
+ => job 0 puis job 0 puis 1 ...
3
+Du coup : 
4
+J0T0 -> machine0 [0,3]
5
+J0T1 -> machine1 [3,6]
6
+J1T0 -> machine1 [6,8]
7
+J1T1 -> machine0 [8,10]
8
+J0T2 -> machine2 [6,8]
9
+J1T2 -> machine2 [10,14]
10
+
11
+Validé par experimentation
12
+
13
+Version optimum 
14
+
15
+J0T0 -> machine0 [0,3]
16
+J1T0 -> machine1 [0,2]
17
+J0T1 -> machine1 [3,6]
18
+J1T1 -> machine0 [3,5]
19
+J1T2 -> machine2 [5,9]
20
+J0T2 -> machine2 [9,11]
21
+
22
+Attention SI SOLUTION PAS POSSIBLE, RAISE EXCEPTION

+ 34
- 4
src/main/java/jobshop/MainTest.java View File

@@ -34,13 +34,43 @@ public class MainTest {
34 34
             System.out.println("SCHEDULE: " + schedule.toString());
35 35
             System.out.println("GANTT: " + schedule.asciiGantt());
36 36
 
37
+            // Création du schedule a la main
37 38
             Schedule manualSchedule = new Schedule(instance);
38
-            // TODO: encode the same solution
39
-            //manualSchedule.setStartTime(....);
39
+            manualSchedule.setStartTime(0,0,0);
40
+            manualSchedule.setStartTime(0,1,3);
41
+            manualSchedule.setStartTime(0,2,6);
42
+            manualSchedule.setStartTime(1,0,6);
43
+            manualSchedule.setStartTime(1,1,8);
44
+            manualSchedule.setStartTime(1,2,10);
45
+            System.out.println("GANTT: " + manualSchedule.asciiGantt());
40 46
 
47
+            //Creation du RO a la main
41 48
             ResourceOrder manualRO = new ResourceOrder(instance);
42
-            // TODO: encode the same solution
43
-            //manualRO.addTaskToMachine(..., new Task(..., ...));
49
+            manualRO.addTaskToMachine(0, new Task(0,0));
50
+            manualRO.addTaskToMachine(0, new Task(1,1));
51
+            manualRO.addTaskToMachine(1, new Task(0,1));
52
+            manualRO.addTaskToMachine(1, new Task(1,0));
53
+            manualRO.addTaskToMachine(2, new Task(0,2));
54
+            manualRO.addTaskToMachine(2, new Task(1,2));
55
+            System.out.println("GANTT: " + manualRO.toSchedule().get().asciiGantt());
56
+            //Modification du RO vers optimum
57
+            manualRO.swapTasks(1,0,1);
58
+            manualRO.swapTasks(2,0,1);
59
+            System.out.println("OPTIMUM: ");
60
+            System.out.println("VALID: " + manualRO.toSchedule().get().isValid());
61
+            System.out.println("MAKESPAN: " + manualRO.toSchedule().get().makespan());
62
+            System.out.println("SCHEDULE: " + manualRO.toSchedule().get().toString());
63
+            System.out.println("GANTT: " + manualRO.toSchedule().get().asciiGantt());
64
+
65
+            //Creation du RO INVALIDE a la main
66
+            ResourceOrder manualROInvalid = new ResourceOrder(instance);
67
+            manualROInvalid.addTaskToMachine(0, new Task(1,1));
68
+            manualROInvalid.addTaskToMachine(0, new Task(0,0));
69
+            manualROInvalid.addTaskToMachine(1, new Task(0,1));
70
+            manualROInvalid.addTaskToMachine(1, new Task(1,0));
71
+            manualROInvalid.addTaskToMachine(2, new Task(0,2));
72
+            manualROInvalid.addTaskToMachine(2, new Task(1,2));
73
+            System.out.println("GANTT: " + manualROInvalid.toSchedule().get().asciiGantt());
44 74
 
45 75
         } catch (IOException e) {
46 76
             e.printStackTrace();

Loading…
Cancel
Save