Add method to access tasks in resource order
This commit is contained in:
parent
87acd95887
commit
f6d78491ba
2 changed files with 13 additions and 3 deletions
|
@ -16,12 +16,12 @@ public class MainTest {
|
|||
// load the aaa1 instance
|
||||
Instance instance = Instance.fromFile(Paths.get("instances/aaa1"));
|
||||
|
||||
// builds a solution in the job-numbers encoding [0 1 1 0 0 1]
|
||||
// builds a solution in the job-numbers encoding [0 0 1 1 0 1]
|
||||
JobNumbers enc = new JobNumbers(instance);
|
||||
enc.addTask(0);
|
||||
enc.addTask(1);
|
||||
enc.addTask(1);
|
||||
enc.addTask(0);
|
||||
enc.addTask(1);
|
||||
enc.addTask(1);
|
||||
enc.addTask(0);
|
||||
enc.addTask(1);
|
||||
|
||||
|
|
|
@ -62,6 +62,16 @@ public class ResourceOrder extends Encoding {
|
|||
nextFreeSlot[machine] += 1;
|
||||
}
|
||||
|
||||
/** Returns the i-th task scheduled on a particular machine.
|
||||
*
|
||||
* @param machine Machine on which the task to retrieve is scheduled.
|
||||
* @param taskIndex Index of the task in the queue for this machine.
|
||||
* @return The i-th task scheduled on a machine.
|
||||
*/
|
||||
public Task getTaskOfMachine(int machine, int taskIndex) {
|
||||
return tasksByMachine[machine][taskIndex];
|
||||
}
|
||||
|
||||
/** Exchange the order of two tasks that are scheduled on a given machine.
|
||||
*
|
||||
* @param machine Machine on which the two tasks appear (line on which to perform the exchange)
|
||||
|
|
Loading…
Reference in a new issue