0

I was trying to understand the variant Time Windowed of Optaplanner Vehicle Routing Example. There are some points that I don't really understand and need to be confirmed.

  1. What is the unit measurement that was used for readyTime, dueTime, serviceDuration, and arrivalTime? I tried to look at the sample data but still can't figured it out.
  2. How to calculated the arrival time? It should be related with the time that was required to travel from one location to another location, but I can't find how to calculate that time.

Any comments and answers will really be appreciated. Thanks and regards.

mchlfchr
  • 3,998
  • 4
  • 26
  • 35
the.wizard
  • 1,079
  • 1
  • 9
  • 25
  • to whoever down vote my question, please tell me why you do that. If I ask a wrong question, you can tell me what is wrong with my question, and I can fix it. – the.wizard Apr 24 '15 at 15:25

1 Answers1

4
  1. The time unit is/seems relative. In the example it's an integer, which has no real timestamp information (e.g. an absolute date). The advantage of getting this approach is that you don't need to go for a "year","month" or "day" unit system.

  2. Take a look at the ArrivalTimeUpdatingVariableListener class. There is a method called calculateArrivalTime(). The calculation itself takes your current customer and the previous departure time and checks if the previous departue time is the start of your customer chain (if its null, then you get your vehicle) or an existing customer.

    2.1 Case "vehicle" says, that you check the current customer (aka the first job of your vehicle) for the maximum of the readyTime and the distance of the depot to your current customer. You take the one, which is greater than the other and set is as updated arrivalTime.

    2.2 Case "N-customer (N > 1)": Get the departureTime of the previous customer, add the distance from the previous customer and return that value as updated arrivalTime.

In both cases you will check for your complete chain, if the last known arrivalTime is equal to the updated arrivalTime in order to prevent duplicated calculation. This saves performance, because you will break the while condition.

mchlfchr
  • 3,998
  • 4
  • 26
  • 35
  • 1. That's the problem, I need to know how to measure it, i.e. I want the customer A readyTime was at 8.00 and the dueTime was at 17.00, how can I do that? I don't know how to convert those integers value to time value. 2. Does this mean, the distance was equivalent to the time to travel it? In real world, does it different? The same 10 km of 2 road distance may take a different time to travel it right? – the.wizard Apr 27 '15 at 07:45
  • 1. I was just thinking in my answer of the current implementation, never said that I had implemented it :-). You can achieve that "relational time" in a pre-processing step. Each job has an optional defined dueTime in an absolute date format (so I understand your use case). If you read in your dataset, you can convert that format in relation to your current system time. Your current system time is a so called "anchor point" from which you compare your dueTimes. The conversion of your times is a pre-processing step. The comparing process is part of your solving process. – mchlfchr Apr 28 '15 at 06:45
  • 2. Yes, that's the point with the "fastest" route. If your "driven distance" or "fuel consumption" doesn't play a role, you can go for that and save time instead of "fuel" and "driven distance". In the real world (e.g. with navigation systems) one would also choose the fastest or shortest route, depending on the knowledge of the driver and his personal preferences (e.g. comfortable driving, lesser speed limits on highways, no stops during the ride, etc.) – mchlfchr Apr 28 '15 at 07:02