OptaPlanner CVRPTW - solution with capacity issue

拥有回忆 提交于 2019-12-25 09:36:19

问题


I have the following CVRPTW problem and I'm trying to find a good solution with OptaPlanner. Time is in hh:mm:ss format.

My DRL file is like this. Moreover I defined also a hard contraint relative to the arrival before ready time. My solver configuration is like this, with the difference of the termination tag:

<termination>
    <terminationCompositionStyle>OR</terminationCompositionStyle>
    <maximumSecondsSpend>10</maximumSecondsSpend>
    <scoreAttained>0hard/-750000soft</scoreAttained>
</termination>

This is the problem statement:

PROBLEM STATEMENT:
CustID  ReadyTIME   DueTIME     ServiceDUR  DEMAND
1       20:38:18    20:44:18    00:05:00    2   
2       20:20:53    20:26:53    00:05:00    4   
3       20:51:39    20:57:39    00:05:00    3   
4       20:20:18    20:26:18    00:05:00    6   
5       20:34:15    20:40:15    00:05:00    5   
6       20:21:40    20:27:40    00:05:00    10  

I have 2 vehicles with both a capacity of 10 items and 1 depot.

This is the solution (customers grouped by vehicle and sorted by arrival time):

Vehicle 1   Capacity 10 - from Depot [1]
[6]     D: 10   Ar.T: 20:21:40  Prev.D: 00:02:21    Next.D: --:--:--

Vehicle 2   Capacity 10 - from Depot [1]
[4]     D: 6    Ar.T: 20:20:18  Prev.D: 00:01:08    Next.D: 00:02:21
[2]     D: 4    Ar.T: 20:27:42  Prev.D: 00:02:24    Next.D: 00:03:38
[5]     D: 5    Ar.T: 20:36:03  Prev.D: 00:03:21    Next.D: 00:02:09
[1]     D: 2    Ar.T: 20:43:26  Prev.D: 00:02:23    Next.D: 00:07:23
[3]     D: 3    Ar.T: 20:55:40  Prev.D: 00:07:14    Next.D: --:--:--

(D = demand, Ar.T = arrival time, Prev.D = distance from previous location, Next.D distance from next location)

As you can see vehicle 2 have to transport 6+4+5+2+3=20 items, which is greater than the capacity. I don't understand why the solver suggest me this solution if there's a hard contraint relative to the capacity in the configuration.

Considering my rules, this is not an acceptable solution. Am I missing something? Isn't there a condition where the solver provides no solution? Is it contemplated a "solver failed" termination?


回答1:


Correct if I am wrong, but you have:

  • a total demand of 30 (6+4+5+2+3+10)

  • a total capacity of 20 (2 vehicles with 10 each)

It's impossible to transport 30 items when your trucks can only transport 20 items. There is no feasible solution (so OptaPlanner delivers the best infeasible solution it finds).

Note: If the same vehicle can be used multiple times, add extra Vehicle instances and add a constraint to penalize the usage of multiple Vehicle instances with the same license plate.



来源:https://stackoverflow.com/questions/19251567/optaplanner-cvrptw-solution-with-capacity-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!