Hi Stefan,
Actually, I can see that this could be one of the situations you mentioned where you would want to decouple the driver from the vehicle. You have 3 vehicle types that could be driven 24/7, the limit is the person in the vehicle. You have 3 drivers, each with different shifts - whatever driver is picked for the vehicle then defines the working window for that vehicle. I believe your suggestion mandates that an arbitrary decision is made over which vehicle types can drive for which hours.
For example, I choose that type_1 gets driver 3, meaning that type_1 is now only available between 9 am and 4 pm. The problem is then solved. However, what if a better solution could have been achieved by having vehicle type_1 on the road for longer (I instead put driver 2 in this vehicle, and his shift is 9 am to 6 pm) and put driver 3 in a different vehicle. In each case, (n^2 - 1) possible solutions are never even tested; the blind spot scales fast!
I typed out a detailed reply to OP on how you might be able to do this using the same tricks I used in the huge thread on driver lunch breaks but then realise it fell down on the last hurdle. Whilst it will make all permutations available to the algorithm in a single run, I don’t think there’s anything stopping, for example, two vehicles escaping the warehouse that are both “driven” by the same driver with the longest working hours. I’ll provide it anyway in case it sparks a thought:
…
- Create 9 vehicles to cover the permutations of possible working times
- Define an extra vehicle capacity type for each type of vehicle. Each vehicle can only hold one item of this type.
- In the case described here, create 6 pickups at the warehouse that have a time window that is within all 3 shift windows. 2 jobs for every type of fake vehicle capacity.
- MASSIVELY inflate all distances to/from the warehouse, but not the driving time.
- Run simulation
The idea here is that by creating the 6 jobs at the warehouse, your entire fleet (well, at least 6 vehicles just for the fake jobs) is mobilised to cover the fake jobs, which leaves them fair-game to start doing real jobs. This is not what you want because, once deployed, you lose the fixed cost parameter that would normally minimise the number of vehicles.
Instead, we cheat by massively inflating driving distance to/from warehouse (add 1000 km for each direction, even more if necessary to really make it truly disproportionate to your real problem scale) to simulate a fixed cost. So, even though all vehicles are deployed, it is not attractive to have more than the minimum number of vehicles to do anything other than sit at the warehouse because of the disproportionate fuel cost, even if for the longest shift he could have done 3 hours more work.
In each case, for a particular vehicle type, the one with the most appropriate working shift should be selected to escape the warehouse. If all 3 vehicles are not needed, there aren’t any fake jobs left so it should just never get deployed.
All well and good, in theory, BUT there are issues to think about:
- You could come to a condition where there are more jobs than can be covered by 3 vehicles, in which case the jobs at the warehouse start becoming unassigned and fake vehicles are set free. It may be that with a sufficiently high travel cost to/from warehouse to overwhelm everything else, that the fake jobs at the warehouse would (almost) always be the last to be unassigned
- Different cost per mile for each vehicle type might cause some issues.
- Hopefully you have a single point in time that is in all 3 driver shifts.
- I don’t think you’ll be able to set a cost for waiting time as this will influence which vehicle breaks free from warehouse, because the fake warehouse job will apply a cost per waiting time that is still proportional to the route solution.
Josh