Re: [or-tools-discuss] What is the meaning of solution.Max() and solution.Min() ?

43 views
Skip to first unread message

Vincent Furnon

unread,
Oct 25, 2023, 10:39:04 AM10/25/23
to or-tools...@googlegroups.com
Setting SetGlobalSpanCostCoefficient means that time cumul variables will have an impact on the value of the objective, therefore the solver has to instantiate time variables to actually minimize the objective. In your first case, time values might impact feasibility but not the objective directly, therefore it's ok for the solver to not instantiate time. In this case you obtain the earliest and latest feasible arrival time at each node.

On Wed, Oct 25, 2023 at 4:30 PM weersdfas asdasd <alpha...@gmail.com> wrote:
I apply my script from https://developers.google.com/optimization/routing/vrptw using my own matrix distance. When I didn't set SetGlobalSpanCostCoefficient(1) and conducted greedy decent method.

This is the result
Objective: 802 Route for vehicle 0: 0 Time(0.0,0.0) -> 4 Time(5.016666666666667,6.416666666666667) -> 8 Time(7.433333333333334,8.833333333333334) -> 5 Time(9.466666666666667,10.866666666666667) -> 1 Time(11.516666666666667,12.916666666666666) -> 9 Time(13.533333333333333,14.933333333333334) -> 12 Time(15.583333333333334,16.983333333333334) -> 7 Time(32.016666666666666,32.75) -> 11 Time(35.016666666666666,35.016666666666666) -> 3 Time(37.25,37.25) -> 2 Time(39.35,39.35) -> 10 Time(41.36666666666667,41.36666666666667) -> 6 Time(43.43333333333333,43.43333333333333) -> 13 Time(57.21666666666667,57.21666666666667) -> 14 Time(59.36666666666667,59.36666666666667) -> 0 Time(61.36666666666667,61.36666666666667) Time of the route: 61.36666666666667min

the print of its result really confused me because the time is difference in the same node. For instance, the time at node 4 is (5.016666666666667,6.416666666666667)

 I conducted reverse engineering and know that this value is originated by solution.Max() and solution.Min()

However, When I set SetGlobalSpanCostCoefficient(1) and conducted the same method.

This is the result
Objective: 25670 Route for vehicle 0: 0 Time(13.65,13.65) -> 7 Time(13.65,13.65) -> 12 Time(15.816666666666666,15.816666666666666) -> 8 Time(17.9,17.9) -> 9 Time(19.966666666666665,19.966666666666665) -> 1 Time(21.983333333333334,21.983333333333334) -> 6 Time(24.1,24.1) -> 4 Time(30.233333333333334,30.233333333333334) -> 10 Time(32.78333333333333,32.78333333333333) -> 11 Time(35.016666666666666,35.016666666666666) -> 5 Time(37.233333333333334,37.233333333333334) -> 2 Time(39.43333333333333,39.43333333333333) -> 3 Time(41.583333333333336,41.583333333333336) -> 14 Time(55.416666666666664,55.416666666666664) -> 13 Time(57.6,57.6) -> 0 Time(59.6,59.6) Time of the route: 59.6min

The values of solution.Max() and solution.Min() of each node are equal.

My questions are
1. What is the meaning of solution.Max() and solution.Min() ? Is it possible to difference at the same node ? Does it mean Min() and Max() is the range time that you should reach the node after Min() time and leave at Max() time ?

2. Why do the result of solution.Max() and solution.Min() change by just setting SetGlobalSpanCostCoefficient ?
Let's me guess. The objective function without setting SetGlobalSpanCostCoefficient accounts for only distance between the nodes so this is unnecessary for model to reach the node and leave asap. Meanwhile, Setting SetGlobalSpanCostCoefficient is added max-min time to the objective function so the solution should reach the node and leave asap to minimize the objection function.

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/cd7c64ff-c6b5-4362-8284-4674e1ed15a3n%40googlegroups.com.

weersdfas asdasd

unread,
Oct 25, 2023, 10:42:57 AM10/25/23
to or-tools-discuss
Thank you,
You can delete this forum. I create the new forum because I add another questions.
ในวันที่ วันพุธที่ 25 ตุลาคม ค.ศ. 2023 เวลา 21 นาฬิกา 39 นาที 04 วินาที UTC+7 or-tools-discuss เขียนว่า:
Reply all
Reply to author
Forward
0 new messages