mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add a way to use fast regret with custom contraints
This commit is contained in:
parent
4889876d28
commit
070aef735f
2 changed files with 2 additions and 4 deletions
|
|
@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Future;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insertion based on regret approach.
|
* Insertion based on regret approach.
|
||||||
|
|
@ -174,7 +173,6 @@ public class RegretInsertionConcurrentFast extends AbstractInsertionStrategy {
|
||||||
if(priorityQueues[unassignedJob.getIndex()] == null){
|
if(priorityQueues[unassignedJob.getIndex()] == null){
|
||||||
priorityQueues[unassignedJob.getIndex()] = new TreeSet<VersionedInsertionData>(InsertionDataUpdater.getComparator());
|
priorityQueues[unassignedJob.getIndex()] = new TreeSet<VersionedInsertionData>(InsertionDataUpdater.getComparator());
|
||||||
}
|
}
|
||||||
final TreeSet<VersionedInsertionData> priorityQueue = priorityQueues[unassignedJob.getIndex()];
|
|
||||||
if(firstRun) {
|
if(firstRun) {
|
||||||
makeCallables(tasks, true, priorityQueues[unassignedJob.getIndex()], updateRound, unassignedJob, routes, lastModified);
|
makeCallables(tasks, true, priorityQueues[unassignedJob.getIndex()], updateRound, unassignedJob, routes, lastModified);
|
||||||
updatedAllRoutes = true;
|
updatedAllRoutes = true;
|
||||||
|
|
@ -201,7 +199,7 @@ public class RegretInsertionConcurrentFast extends AbstractInsertionStrategy {
|
||||||
updates.put(lastModified,updateRound);
|
updates.put(lastModified,updateRound);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
List<Future<Boolean>> futures = executor.invokeAll(tasks);
|
executor.invokeAll(tasks);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ public class RegretInsertionFast extends AbstractInsertionStrategy {
|
||||||
else{
|
else{
|
||||||
if(dependencyTypes == null || dependencyTypes[unassignedJob.getIndex()] == null){
|
if(dependencyTypes == null || dependencyTypes[unassignedJob.getIndex()] == null){
|
||||||
InsertionDataUpdater.update(switchAllowed, initialVehicleIds, fleetManager, insertionCostsCalculator, priorityQueues[unassignedJob.getIndex()], updateRound, unassignedJob, Arrays.asList(lastModified));
|
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 {
|
else {
|
||||||
DependencyType dependencyType = dependencyTypes[unassignedJob.getIndex()];
|
DependencyType dependencyType = dependencyTypes[unassignedJob.getIndex()];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue