Browse Source

Remove a misleading method of ResourceOrder

Arthur Bit-Monnot 3 years ago
parent
commit
8e5545fc80

+ 2
- 2
doc/src/encodings.md View File

@@ -18,9 +18,9 @@ Convenience methods:
18 18
  - `asciiGantt()`: generates a Gantt chart view of the solution in ASCII art.
19 19
 
20 20
 
21
- ## NumJobs
21
+ ## JobNumbers
22 22
 
23
- The `NumJobs` encoding consists of a sequence of job numbers. To produce a schedule, one should iterate on the job numbers and try to schedule *as early as possible* the next task of the job.
23
+ The `JobNumbers` encoding consists of a sequence of job numbers. To produce a schedule, one should iterate on the job numbers and try to schedule *as early as possible* the next task of the job.
24 24
 
25 25
  For instance the encoding `[0 0 1 1 0 1]` will produce a schedule by trying to place as early as possible the following tasks (in this order):
26 26
 

+ 4
- 2
doc/src/prelude.md View File

@@ -26,14 +26,16 @@ classrooms as well as on `montp.insa-toulouse.fr`.
26 26
 To import the project in IntelliJ (once IntelliJ is running):
27 27
 
28 28
  - Open a new project : `Open project` or `File > Open`
29
- - Select the `gradle.build` file in the cloned repository. 
29
+ - Select the `build.gradle` file in the cloned repository. 
30 30
  - Select `Open as project`.
31 31
 
32 32
 To run the program in IntelliJ, you can 
33 33
 
34 34
  - Right click on the `src/main/java/jobshop/Main` class in the project view.
35 35
  - Select `Run Main.main()`. The program should execute but complain that some arguments are missing.
36
- - Give it the expected command line arguments : `Run > Edit Configuration`, then fill in the `Program arguments` text box.
36
+ - Specify the expected command line arguments : 
37
+   - open the run configuration dialog: `Run > Edit Configuration` 
38
+   - fill in the `Program arguments` text box with `--solver basic random --instance aaa1 aaa2` (see the next page for more details on the meaning of the arguments)
37 39
 
38 40
 ### Working on the command line (Gradle)
39 41
 

+ 6
- 8
src/main/java/jobshop/MainTest.java View File

@@ -3,8 +3,6 @@ package jobshop;
3 3
 import jobshop.encodings.JobNumbers;
4 4
 import jobshop.encodings.ResourceOrder;
5 5
 import jobshop.encodings.Schedule;
6
-import jobshop.encodings.Task;
7
-import jobshop.solvers.GreedySolver;
8 6
 
9 7
 import java.io.IOException;
10 8
 import java.nio.file.Paths;
@@ -19,12 +17,12 @@ public class MainTest {
19 17
 
20 18
             // builds a solution in the job-numbers encoding [0 0 1 1 0 1]
21 19
             JobNumbers enc = new JobNumbers(instance);
22
-            enc.addTask(0);
23
-            enc.addTask(0);
24
-            enc.addTask(1);
25
-            enc.addTask(1);
26
-            enc.addTask(0);
27
-            enc.addTask(1);
20
+            enc.addTaskOfJob(0);
21
+            enc.addTaskOfJob(0);
22
+            enc.addTaskOfJob(1);
23
+            enc.addTaskOfJob(1);
24
+            enc.addTaskOfJob(0);
25
+            enc.addTaskOfJob(1);
28 26
 
29 27
             System.out.println("\nENCODING: " + enc);
30 28
 

+ 2
- 2
src/main/java/jobshop/encodings/JobNumbers.java View File

@@ -47,13 +47,13 @@ public final class JobNumbers extends Encoding {
47 47
                     .min(Comparator.comparing(t -> schedule.startTime(t.job, t.task)))
48 48
                     .get();
49 49
 
50
-            this.addTask(next.job);
50
+            this.addTaskOfJob(next.job);
51 51
             nextOnJob[next.job] += 1;
52 52
         }
53 53
     }
54 54
 
55 55
     /** Schedule the next task of the given job. */
56
-    public void addTask(int jobNumber) {
56
+    public void addTaskOfJob(int jobNumber) {
57 57
         this.jobs[nextToSet++] = jobNumber;
58 58
     }
59 59
 

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

@@ -53,13 +53,6 @@ public final class ResourceOrder extends Encoding {
53 53
         }
54 54
     }
55 55
 
56
-    /** Enqueues a task for the given job on the machine. We automatically, find the task
57
-     * that must be executed on this particular machine. */
58
-    public void addToMachine(int machine, int jobNumber) {
59
-        Task taskToEnqueue = new Task(jobNumber, instance.task_with_machine(jobNumber, machine));
60
-        addTaskToMachine(machine, taskToEnqueue);
61
-    }
62
-
63 56
     /** Adds the given task to the queue of the given machine. */
64 57
     public void addTaskToMachine(int machine, Task task) {
65 58
         tasksByMachine[machine][nextFreeSlot[machine]] = task;

+ 1
- 1
src/main/java/jobshop/solvers/BasicSolver.java View File

@@ -14,7 +14,7 @@ public class BasicSolver implements Solver {
14 14
         JobNumbers sol = new JobNumbers(instance);
15 15
         for(int t = 0 ; t<instance.numTasks ; t++) {
16 16
             for(int j = 0 ; j<instance.numJobs ; j++) {
17
-                sol.addTask(j);
17
+                sol.addTaskOfJob(j);
18 18
             }
19 19
         }
20 20
 

+ 1
- 1
src/main/java/jobshop/solvers/RandomSolver.java View File

@@ -21,7 +21,7 @@ public class RandomSolver implements Solver {
21 21
         // initialize a first solution to the problem.
22 22
         for(int j = 0 ; j<instance.numJobs ; j++) {
23 23
             for(int t = 0 ; t<instance.numTasks ; t++) {
24
-                sol.addTask(j);
24
+                sol.addTaskOfJob(j);
25 25
             }
26 26
         }
27 27
         // best solution is currently the initial one

Loading…
Cancel
Save