Browse Source

Do not allow placing task on the wrong machine

Arthur Bit-Monnot 5 months ago
parent
commit
fcf0a8b19a
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      src/main/java/jobshop/encodings/ResourceOrder.java

+ 3
- 0
src/main/java/jobshop/encodings/ResourceOrder.java View File

@@ -55,6 +55,9 @@ public final class ResourceOrder extends Encoding {
55 55
 
56 56
     /** Adds the given task to the queue of the given machine. */
57 57
     public void addTaskToMachine(int machine, Task task) {
58
+        if(instance.machine(task) != machine) {
59
+            throw new RuntimeException("Task " + task + " cannot be scheduled on machine "+machine);
60
+        }
58 61
         tasksByMachine[machine][nextFreeSlot[machine]] = task;
59 62
         nextFreeSlot[machine] += 1;
60 63
     }

Loading…
Cancel
Save