GraphHopper.com | Forum | GitHub | Maps | Blog

Control Break with service time and cost


#1

I’m implementing a solution is that the break take service time for by duration as code:

	Break lunch = Break.Builder.newInstance("Lunch")
					.setServiceTime(duration)
					.setPriority(1)
					.setTimeWindow(TimeWindow.newInstance(startTime, startTime + duration))
					.build();

And I only have one vehicle type be set with cost parameters as:

	VehicleType type = VehicleTypeImpl.Builder.newInstance("vehicle")
		    .setCostPerTransportTime(CostPerTranportSecond)
			.setCostPerServiceTime(CostPerSeviceSecond)

The break is added for every vehicle as:

ArrayList<VehicleImpl> vehicles = new ArrayList<VehicleImpl>();
for(int i = 1; i <= noVehicles; i++) {
  VehicleImpl vehicle = VehicleImpl.Builder.newInstance(type.getTypeId() + " " +i)
	  .setStartLocation(start)
	  .setType(type)
	  .setReturnToDepot(true)  
	  .setBreak(lunch)
	  .setLatestArrival(operatingTime)
	  .build();
  vehicles.add(vehicle);
}

So, I want to ask Is there any way I can make the Break still takes the service time, but doesn’t cost.

This is the json file for the problem: problem.json (6.4 KB)