java - OptaPlanner CVRPTW - continuous deliveries -


i'm new optaplanner, , i'm trying configure in project solve cvrptw problem. current configuration similar example can find in source code of project, requirements different. application receives continuously delivery requests where:

  • average service duration 5 minutes
  • duetime - readytime = 10 minutes
  • average distance (in time) between locations 2,5 minutes
  • only 1 depot

my idea re-run solving algorithm every time new request received. necessary me understand if request feasible or if needs shifted forward or backward in time. if consider following problem statement (locations omitted, equidistant depot's location):

cust_id ready_time  due_time    serv_dur        demand   1       12:45:00    12:55:00    00:05:00        1        2       12:35:00    12:45:00    00:05:00        8        3       12:25:00    12:35:00    00:05:00        5        4       13:25:00    13:35:00    00:05:00        5    

considering there 2 vehicles available, both capacity of 10, following solution (timetable each vehicle):

**vehicle 1 capacity 10 - delivery sequence starting depot [1]** cust[3]     d: 5    ar.t: 12:25:00  ap.t: 12:23:08  prev.d: 00:01:52    next.d: 00:03:46 cust[4]     d: 5    ar.t: 12:33:56  ap.t: 12:30:00  prev.d: 00:03:56    next.d: --:--:--  **vehicle 2 capacity 10 - delivery sequence starting depot [1]** cust[2]     d: 8    ar.t: 12:35:00  ap.t: 12:33:03  prev.d: 00:01:57    next.d: 00:03:05 cust[1]     d: 1    ar.t: 12:42:47  ap.t: 12:40:00  prev.d: 00:02:47    next.d: --:--:-- 

where d demand, ar.t arrival time, ap.t approaching time (time when it's necessary leave previous location arrive punctual selected one), prev.d distance (in time) previous location , next.d distance (in time) following location.

as can see, customer 4 receives delivery (arrival time 12:33:56, while ready time 13:25:00). understand rule arrivalbeforereadytime soft constraint, expect planner suggest me deliver customer 4 using reserved delivery. setting rule arrivalbeforereadytime hard constraint, of time following exception:

org.drools.core.runtimedroolsexception: java.lang.nullpointerexception     @ org.drools.core.base.accumulators.sumaccumulatefunction.reverse(sumaccumulatefunction.java:85) 

i have 2 questions:

  1. when exception above, should have catch "problem unsolved"? or have tune configuration? should not get?
  2. how should manage continuous deliveries scenario? should have define different large time-windows solve independently? how define boundaries of these windows? , how manage deliveries planned across boundaries? (this solution seems not correct me)

edit 1:

updating optaplanner version 6.0.0.cr3 6.0.0.cr4-pre1 solved nullpointerexception. documentation clear real-time planning , considering run planner in real-time mode. since in example above result not good, trying understand else have done manage situation. swiched rule arrivalbeforereadytime soft hard constraint, don't nullpointerexception, time-schedule seems managed properly, , result following (for example):

problem statement:

custid  rtime         dtime           servdur         demand  1       12:45:00      12:55:00        00:05:00        5       2       12:35:00      12:45:00        00:05:00        3       3       12:25:00      12:35:00        00:05:00        10      4       14:25:00      14:35:00        00:05:00        2       

solution

**vehicle 1       capacity 10 - delivery sequence starting depot [1]** cust[3]   d: 10   ar.t: 12:25:00  ap.t: 12:23:08     prev.d: 00:01:52    next.d: 00:02:26 cust[2]   d: 3    ar.t: 12:32:26  ap.t: 12:30:00     prev.d: 00:02:26    next.d: 00:03:05 cust[1]   d: 5    ar.t: 12:42:47  ap.t: 12:40:00     prev.d: 00:02:47    next.d: --:--:--  **vehicle 2       capacity 10 - delivery sequence starting depot [1]** cust[4]   d: 2    ar.t: 14:25:00  ap.t: 14:22:53     prev.d: 00:02:07    next.d: --:--:-- 

as can see, 1st delivery not feasible, since sum of demands overflows vehicle's capacity. should assume correct? mean, in case solution use both vehicles manage customers 1,2,3. i'm using same configuration of example, vehiclecapacity hard constraint. moreover, customer 2 , 1 served before ready time, if i'm using hard constraint it.

if haven't already, first read documentation on repeated planning in general , more real-time planning specifically.

you can try real-time planning out in demo clicking anywhere on vrp map while it's solving.

  1. that exception bug (in code or ours). should never happen. read warnings in docs section referenced above. if followed those, , believe bug not in code, please file jira.

  2. let me know if docs don't answer question clearly.

ps: make sure you're using 6.0.0.cr4. drools <= cr3 had bug related shadow variables in vrp timewindows.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -