GraphHopper.com | Forum | GitHub | Maps | Blog

Time window of an InitialRoute


#1

In my team we’ve created a tour planning web service based in jspirit. We had the requirement to included already planned appointments into a new planning. I did some research and found out that it can be done with initial routes. In my tests the tour activities (relationship between vehicles and services) are not ruined as expected. But unfortunately, the time window doesn’t stay the same. First, it can be bigger if there is more time to serve the appointment. This is ok for me. But sometimes, the whole appointment is shifted to a different time. Is this the expected behaviour of initial routes. Routes are not ruined but the time can change?

Are there more constraints or settings I can use? Currently, I use only a few code lines (note, I also got my own service class):

for (Service plannedService : plannedServices) {
	com.graphhopper.jsprit.core.problem.job.Service.Builder.newInstance(service.getServiceID());
	serviceInstance.setLocation(Location.newInstance(service.getServiceID()));
	if(!service.getRequiredSkills().isEmpty()) {
		for(String skill: service.getRequiredSkills()) {
			serviceInstance.addRequiredSkill(skill);
		}
	}
	serviceInstance.addTimeWindow(service.getStartWindow(),service.getEndWindow());
	serviceInstance.setServiceTime(service.getServiceTime());
	serviceInstance.setName(service.getServiceID());	
        com.graphhopper.jsprit.core.problem.job.Service service = serviceInstance.build();
	vrpBuilder.addJob(service);
	initialRoute.addService(service);
}

vrpBuilder.addInitialVehicleRoute(initialRoute.build());

The code can also be found here.

Thanks in advance for any hints.