updated .sort to .max/min for SPT/LRPT

This commit is contained in:
Raphaël LACROIX 2023-04-27 15:09:57 +02:00
parent 640e695533
commit e14f7d77ef

View file

@ -51,8 +51,8 @@ public class GreedySolver implements Solver {
case SPT:
return(
lTask.stream()
.sorted(Comparator.comparing(e -> heuristiqueSPT(e, instance)))
.toArray(Task[]::new)[0]
.min(Comparator.comparing(e -> heuristiqueSPT(e, instance)))
.get()
);
case LRPT:
return(
@ -65,8 +65,8 @@ public class GreedySolver implements Solver {
// find the minimal next execution time value
int EST_SPT_minValue = lTask.stream()
.map(e -> heuristiqueEST(e, instance,machineStatus, jobStatus))
.sorted()
.toArray(Integer[]::new)[0];
.min(Comparator.comparing(e -> e))
.get();
// find all tasks with this next execution time value
Task[] EST_SPT_closestTasks = lTask.stream()
@ -76,16 +76,16 @@ public class GreedySolver implements Solver {
// run SPT (see above) on this
return(
Arrays.stream(EST_SPT_closestTasks)
.sorted(Comparator.comparing(e -> heuristiqueSPT(e, instance)))
.toArray(Task[]::new)[0]
.min(Comparator.comparing(e -> heuristiqueSPT(e, instance)))
.get()
);
case EST_LRPT:
// find the minimal next execution time value
int EST_LRPT_minValue = lTask.stream()
.map(e -> heuristiqueEST(e, instance,machineStatus, jobStatus))
.sorted()
.toArray(Integer[]::new)[0];
.min(Comparator.comparing(e -> e))
.get();
// find all tasks with this next execution time value
Task[] EST_LRPT_closestTasks = lTask.stream()