GraphHopper.com | Forum | GitHub | Maps | Blog

How even distribution?


#1

I would like to distribute it equally to the vehicle according to the number, not the capacity.
However, what constraints should be handled when the same coordinates are ignored?

case1)
-order count : 10
-vehicle count : 3
-order’s coordinates diffrence

result :
(O)
A vehicle amount : 4
B vehicle amount : 3
C vehicle amount : 3

(X)
A vehicle amount : 4
B vehicle amount : 4
C vehicle amount : 2

case2)
-order count : 10
-vhicle count : 2
-order’s same coordinates count : 7

result :
A vehicle amount : 7 (same coordinates)
B vehicle count : 3

please advice me…


#2

Hi @power1990,

If you want even distribution among ALL vehicles, then you can calculated the number of jobs per vehicle, say X, beforehand. As in your example case 1, you would already know that you want 3.33 jobs per vehicle before you call jsprit. Next you can implement a soft route constraint, in which you firstly obtain the number of jobs that are already in the route, say n. Then you compare n with X, if n is smaller than the floor of X, assign a reward to the insertion; and if n is larger than or equal to the ceiling of X, assign a penalty. Meanwhile you will need to make change to the objective function accordingly.

Regarding the second case, if you want jobs at the same location to be served by the same vehicle and this is more important than your even distribution constraint, you can use a hard route constraint to force a group of jobs to be in the same route. See the following related posts:

Best regards,
He