From 070aef735f3e7080ea621a411e4b3ba9057acaf2 Mon Sep 17 00:00:00 2001 From: oblonski Date: Wed, 13 Jul 2016 14:07:23 +0200 Subject: [PATCH] add a way to use fast regret with custom contraints --- .../algorithm/recreate/RegretInsertionConcurrentFast.java | 4 +--- .../jsprit/core/algorithm/recreate/RegretInsertionFast.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrentFast.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrentFast.java index 5b575fa2..47e967f1 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrentFast.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionConcurrentFast.java @@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory; import java.util.*; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; /** * Insertion based on regret approach. @@ -174,7 +173,6 @@ public class RegretInsertionConcurrentFast extends AbstractInsertionStrategy { if(priorityQueues[unassignedJob.getIndex()] == null){ priorityQueues[unassignedJob.getIndex()] = new TreeSet(InsertionDataUpdater.getComparator()); } - final TreeSet priorityQueue = priorityQueues[unassignedJob.getIndex()]; if(firstRun) { makeCallables(tasks, true, priorityQueues[unassignedJob.getIndex()], updateRound, unassignedJob, routes, lastModified); updatedAllRoutes = true; @@ -201,7 +199,7 @@ public class RegretInsertionConcurrentFast extends AbstractInsertionStrategy { updates.put(lastModified,updateRound); } try { - List> futures = executor.invokeAll(tasks); + executor.invokeAll(tasks); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionFast.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionFast.java index ce184be4..2259070b 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionFast.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/algorithm/recreate/RegretInsertionFast.java @@ -175,7 +175,7 @@ public class RegretInsertionFast extends AbstractInsertionStrategy { else{ if(dependencyTypes == null || dependencyTypes[unassignedJob.getIndex()] == null){ InsertionDataUpdater.update(switchAllowed, initialVehicleIds, fleetManager, insertionCostsCalculator, priorityQueues[unassignedJob.getIndex()], updateRound, unassignedJob, Arrays.asList(lastModified)); - for(VehicleRoute r : routes) updates.put(r,updateRound); + updates.put(lastModified,updateRound); } else { DependencyType dependencyType = dependencyTypes[unassignedJob.getIndex()];