Skip to content

Understanding the Solution (assignment) of Time Window Constraints sample #1051

@Muhammad-Altabba

Description

@Muhammad-Altabba

Trying with the sample:
https://github.com/google/or-tools/blob/master/ortools/constraint_solver/doc/vrp.md#time-window-constraints
The output is:

Objective: 70
Route for Vehicle 0:
0 Time(0,0) Slack(0,3) -> 9 Time(2,5) Slack(0,3) -> 14 Time(5,8) Slack(0,3) -> 16 Time(7,10) Slack(0,16) -> 0 Time(14,30)
Time of the route: 14m
Route for Vehicle 1:
0 Time(0,0) Slack(0,1) -> 12 Time(4,5) Slack(0,1) -> 13 Time(6,7) Slack(0,1) -> 15 Time(11,12) Slack(0,1) -> 11 Time(14,15) Slack(0,10) -> 0 Time(20,30)
Time of the route: 20m
Route for Vehicle 2:
0 Time(0,0) Slack(0,3) -> 7 Time(2,5) Slack(0,3) -> 4 Time(6,9) Slack(0,3) -> 3 Time(7,10) Slack(0,5) -> 1 Time(10,15) Slack(0,14) -> 0 Time(16,30)
Time of the route: 16m
Route for Vehicle 3:
0 Time(0,0) Slack(0,1) -> 5 Time(3,4) Slack(0,1) -> 8 Time(5,6) Slack(0,1) -> 6 Time(7,8) Slack(0,1) -> 2 Time(10,11) Slack(0,1) -> 10 Time(14,15) Slack(0,10) -> 0 Time(20,30)
Time of the route: 20m
Total Distance of all routes: 70m

How can we read the solution in an understandable way?

Time

What is exactly the Time here? For example, taking the Time for first vehicle between 14 and 16:

Location (14) Time(5,8) -> Location (16) Time(7,10)

The time ends at location 14 at 8 but it start at 7 on location next location 16!

Slack

For second vehicle, at the first route, Slack is (0, 1). What is 0 here? And what is 1? It suppose to be the waiting time because this is a time dimension (ref). But the vehicle will arrive to site 12 at 4 not at 1.
So, what 1 represent here?
And why all slacks first value is 0?

Travel Time

Viewing the time needed between every two sites. It can be seen as this, isn't it?

  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 0 6 9 8 7 3 6 2 3 2 6 6 4 4 5 9 7
1 6 0 8 3 2 6 8 4 8 8 13 7 5 8 12 10 14
2 9 8 0 11 10 6 3 9 5 8 4 15 14 13 9 18 9
3 8 3 11 0 1 7 10 6 10 10 14 6 7 9 14 6 16
4 7 2 10 1 0 6 9 4 8 9 13 4 6 8 12 8 14
5 3 6 6 7 6 0 2 3 2 2 7 9 7 7 6 12 8
6 6 8 3 10 9 2 0 6 2 5 4 12 10 10 6 15 5
7 2 4 9 6 4 3 6 0 4 4 8 5 4 3 7 8 10
8 3 8 5 10 8 2 2 4 0 3 4 9 8 7 3 13 6
9 2 8 8 10 9 2 5 4 3 0 4 6 5 4 3 9 5
10 6 13 4 14 13 7 4 8 4 4 0 10 9 8 4 13 4
11 6 7 15 6 4 9 12 5 9 6 10 0 1 3 7 3 10
12 4 5 14 7 6 7 10 4 8 5 9 1 0 2 6 4 8
13 4 8 13 9 8 7 10 3 7 4 8 3 2 0 4 5 6
14 5 12 9 14 12 6 6 7 3 3 4 7 6 4 0 9 2
15 9 10 18 6 8 12 15 8 13 9 13 3 4 5 9 0 9
16 7 14 9 16 14 8 5 10 6 5 4 10 8 6 2 9 0

From the this table, the time needed for first vehicle is as follow:

Site 0 9 14 16 0
Travel Time from previous   2 3 2 7

But the algorithm prints:

14 Time(5,8) Slack(0,3) -> 16 Time(7,10) Slack(0,16)

How is this print anyway related to the travel time above?

Is there bug(s) that made the solution numbers inconsistent?

Many thanks,

Metadata

Metadata

Assignees

Labels

Doc: Optimization SiteIssue related to https://developers.google.com/optimization/ or Documentation in generalDuplicateHelp NeededModeling/Usage problemSolver: RoutingUses the Routing library and the original CP solver

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions