Tests a small multi-trip VRP example. The data are from [1]_, corresponding to their Figure 1. References ---------- .. [1] D. Cattaruzza, N. Absi, and D. Feillet (2016). The Multi-Trip Vehicle Routing Problem with Time Windows and Release Dates. *Transpor
()
| 704 | |
| 705 | |
| 706 | def test_small_example_from_cattaruzza_paper(): |
| 707 | """ |
| 708 | Tests a small multi-trip VRP example. The data are from [1]_, corresponding |
| 709 | to their Figure 1. |
| 710 | |
| 711 | References |
| 712 | ---------- |
| 713 | .. [1] D. Cattaruzza, N. Absi, and D. Feillet (2016). The Multi-Trip |
| 714 | Vehicle Routing Problem with Time Windows and Release Dates. |
| 715 | *Transportation Science* 50(2): 676-693. |
| 716 | https://doi.org/10.1287/trsc.2015.0608. |
| 717 | """ |
| 718 | depot = Depot(0, 0, tw_early=0, tw_late=200, service_duration=20) |
| 719 | clients = [ |
| 720 | # Figure 1 details release times for some clients. But release times |
| 721 | # are not actually binding in the example, so they are not needed. |
| 722 | Client(0, 0, tw_early=100, tw_late=120, service_duration=5), |
| 723 | Client(0, 0, tw_early=50, tw_late=75, service_duration=5), |
| 724 | Client(0, 0, tw_early=50, tw_late=75, service_duration=5), |
| 725 | Client(0, 0, tw_early=50, tw_late=100, service_duration=5), |
| 726 | Client(0, 0, tw_early=50, tw_late=100, service_duration=5), |
| 727 | ] |
| 728 | |
| 729 | matrix = [ |
| 730 | [0, 5, 15, 20, 10, 15], |
| 731 | [5, 0, 20, 20, 15, 15], |
| 732 | [15, 20, 0, 40, 20, 30], |
| 733 | [20, 20, 40, 0, 30, 10], |
| 734 | [10, 15, 20, 30, 0, 20], |
| 735 | [15, 15, 30, 10, 20, 0], |
| 736 | ] |
| 737 | |
| 738 | data = ProblemData( |
| 739 | clients=clients, |
| 740 | depots=[depot], |
| 741 | vehicle_types=[VehicleType(reload_depots=[0])], |
| 742 | distance_matrices=[matrix], |
| 743 | duration_matrices=[matrix], |
| 744 | ) |
| 745 | |
| 746 | trip1 = Trip(data, [5, 3], 0) |
| 747 | trip2 = Trip(data, [1], 0) |
| 748 | trip3 = Trip(data, [4], 0) |
| 749 | trip4 = Trip(data, [2], 0) |
| 750 | route = Route(data, [trip1, trip2, trip3, trip4], 0) |
| 751 | |
| 752 | # These values were verified from the paper, and where needed calculated |
| 753 | # manually. Note that the paper setting requires the first trip to start |
| 754 | # immediately, which results in 15 wait duration. We do not require this, |
| 755 | # instead starting a little later to avoid the wait duration. The other |
| 756 | # quantities reported below match the paper. |
| 757 | assert_equal(route.start_time(), 15) |
| 758 | assert_equal(route.end_time(), 95) |
| 759 | assert_equal(route.time_warp(), 75 + 55) # two time warp violations |
| 760 | assert_equal(route.slack(), 0) # there is time warp, so no slack |
| 761 | assert_equal(route.service_duration(), 25 + 80) # at clients and depots |
| 762 | assert_equal(route.travel_duration(), 105) |
| 763 |
nothing calls this directly
no test coverage detected