5

I am using Jsprit for vehicle routing and i am struck at auto-assignment for new services in the existing solution is there any work around for the same.

Nitish Makhija
  • 559
  • 5
  • 20
  • Could you please elaborate on what you consider to be "auto-assignment"? New services should go to a pre-determined driver of your choosing? – roganjosh Jul 18 '17 at 15:34
  • no, it should get automatically assigned to the driver which algorithm suits fit for example if i have got a solution for say 10 services for 3 drivers and another services comes in but i already have the solution i got by running 10 services against 3 drivers all i want is this new service gets auto-assigned to the driver that bests fits some constraints. – Nitish Makhija Jul 21 '17 at 05:31
  • and you want the 10 services (or the remaining ones when the new services come in) to remain in the same routes and the same sequence as in the previous solution? if so, then you should use the initial route feature in jsprit. – He Huang Jul 25 '17 at 10:00
  • what if I am computing a solution and in between a service comes as in the https://www.optaplanner.org project. – Nitish Makhija Aug 02 '17 at 09:20

1 Answers1

0

Give all vehicles their own unique skill. Any pre-solved orders must be defined in the new problem with the skill requirement of the vehicle they were initially assigned to (i.e in the previous solution prior to the new order). Only the new order goes into the problem with no pre-determined driver skill (beyond the "real" skill requirements that it may carry).

Jsprit is smart when selecting vehicles for inserting orders (it will pre-filter your fleet for each new insert so that it whittles down its options before calculating insertion costs). Therefore, even if you don't load an existing solution but instead start the solution cycle again, as though it were a brand new problem entirely, your previously solved orders will quickly (one insertion cycle for the order) get back to the vehicles they should be on; each old order can only ever go to one vehicle.

EDIT:
Jsprit is not stateful outside of a single problem. What you want to do requires something extra that is stateful, so you need something extra to monitor that and pass data to jsprit in the appropriate fashion. You can then "hijack" the existing hard constraints in jsprit core to pass the new state on.

roganjosh
  • 12,594
  • 4
  • 29
  • 46