mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
fix bug: not all initial jobs returned by getJobsInclusiveInitialJobsInRoutes()
This commit is contained in:
parent
4c2df19064
commit
dde8b01e1c
2 changed files with 7 additions and 6 deletions
|
|
@ -81,7 +81,7 @@ public class VehicleRoutingProblem {
|
||||||
|
|
||||||
private Map<String, Job> tentativeJobs = new LinkedHashMap<String, Job>();
|
private Map<String, Job> tentativeJobs = new LinkedHashMap<String, Job>();
|
||||||
|
|
||||||
private Set<Job> jobsInInitialRoutes = new HashSet<>();
|
private Map<String, Job> jobsInInitialRoutes = new HashMap<>();
|
||||||
|
|
||||||
private Map<String, Coordinate> tentative_coordinates = new HashMap<String, Coordinate>();
|
private Map<String, Coordinate> tentative_coordinates = new HashMap<String, Coordinate>();
|
||||||
|
|
||||||
|
|
@ -309,7 +309,7 @@ public class VehicleRoutingProblem {
|
||||||
incActivityIndexCounter();
|
incActivityIndexCounter();
|
||||||
if (act instanceof TourActivity.JobActivity) {
|
if (act instanceof TourActivity.JobActivity) {
|
||||||
Job job = ((TourActivity.JobActivity) act).getJob();
|
Job job = ((TourActivity.JobActivity) act).getJob();
|
||||||
jobsInInitialRoutes.add(job);
|
jobsInInitialRoutes.put(job.getId(), job);
|
||||||
addLocationToTentativeLocations(job);
|
addLocationToTentativeLocations(job);
|
||||||
registerJobAndActivity(abstractAct, job);
|
registerJobAndActivity(abstractAct, job);
|
||||||
}
|
}
|
||||||
|
|
@ -430,7 +430,7 @@ public class VehicleRoutingProblem {
|
||||||
transportCosts = new CrowFlyCosts(getLocations());
|
transportCosts = new CrowFlyCosts(getLocations());
|
||||||
}
|
}
|
||||||
for (Job job : tentativeJobs.values()) {
|
for (Job job : tentativeJobs.values()) {
|
||||||
if (!jobsInInitialRoutes.contains(job)) {
|
if (!jobsInInitialRoutes.containsKey(job.getId())) {
|
||||||
addJobToFinalJobMapAndCreateActivities(job);
|
addJobToFinalJobMapAndCreateActivities(job);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -439,7 +439,7 @@ public class VehicleRoutingProblem {
|
||||||
for (Job job : jobs.values()) {
|
for (Job job : jobs.values()) {
|
||||||
((AbstractJob)job).setIndex(jobIndexCounter++);
|
((AbstractJob)job).setIndex(jobIndexCounter++);
|
||||||
}
|
}
|
||||||
for (Job job : jobsInInitialRoutes) {
|
for (Job job : jobsInInitialRoutes.values()) {
|
||||||
((AbstractJob)job).setIndex(jobIndexCounter++);
|
((AbstractJob)job).setIndex(jobIndexCounter++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -595,7 +595,8 @@ public class VehicleRoutingProblem {
|
||||||
this.activityMap = builder.activityMap;
|
this.activityMap = builder.activityMap;
|
||||||
this.nuActivities = builder.activityIndexCounter;
|
this.nuActivities = builder.activityIndexCounter;
|
||||||
this.allLocations = builder.allLocations;
|
this.allLocations = builder.allLocations;
|
||||||
this.allJobs = builder.tentativeJobs;
|
this.allJobs = new HashMap<>(jobs);
|
||||||
|
this.allJobs.putAll(builder.jobsInInitialRoutes);
|
||||||
logger.info("setup problem: {}", this);
|
logger.info("setup problem: {}", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class Delivery extends Service {
|
||||||
|
|
||||||
|
|
||||||
public Builder setMaxTimeInVehicle(double maxTimeInVehicle){
|
public Builder setMaxTimeInVehicle(double maxTimeInVehicle){
|
||||||
if(maxTimeInVehicle < 0) throw new IllegalArgumentException("maxTimeInVehicle should be positive");
|
if(maxTimeInVehicle < 0) throw new IllegalArgumentException("maxTimeInVehicle should not be negative");
|
||||||
this.maxTimeInVehicle = maxTimeInVehicle;
|
this.maxTimeInVehicle = maxTimeInVehicle;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue