From 8181ead48ca1d9138df5328a40baccbf858c2f69 Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Thu, 17 Oct 2024 00:49:53 -0500 Subject: [PATCH 01/11] Adds the python-nextroute community app --- .../golden/python-nextroute/inputs/input.json | 263 ++++++++ .../python-nextroute/inputs/input.json.golden | 628 ++++++++++++++++++ .nextmv/golden/python-nextroute/main_test.go | 46 ++ .nextmv/readme/python-nextroute/0.sh | 1 + .nextmv/readme/python-nextroute/0.sh.golden | 0 .nextmv/readme/python-nextroute/1.sh | 2 + .nextmv/readme/workflow-configuration.yml | 10 +- .nextmv/release/requirements.txt | 2 +- .nextmv/workflow-configuration.yml | 6 + go-nextroute/README.md | 2 +- python-ampl-facilitylocation/requirements.txt | 2 +- python-ampl-knapsack/requirements.txt | 2 +- .../requirements.txt | 2 +- python-gurobi-knapsack/requirements.txt | 2 +- python-hello-world/requirements.txt | 2 +- python-hexaly-knapsack/requirements.txt | 2 +- python-highs-knapsack/requirements.txt | 2 +- python-nextroute/LICENSE | 201 ++++++ python-nextroute/README.md | 27 + python-nextroute/app.yaml | 11 + python-nextroute/input.json | 263 ++++++++ python-nextroute/main.py | 62 ++ python-nextroute/requirements.txt | 2 + python-ortools-costflow/requirements.txt | 2 +- .../requirements.txt | 2 +- .../requirements.txt | 2 +- python-ortools-knapsack/requirements.txt | 2 +- python-ortools-routing/requirements.txt | 2 +- .../requirements.txt | 2 +- python-ortools-shiftplanning/requirements.txt | 2 +- python-pyomo-knapsack/requirements.txt | 2 +- python-pyomo-shiftassignment/requirements.txt | 2 +- python-pyomo-shiftplanning/requirements.txt | 2 +- .../requirements-arm64.txt | 2 +- .../requirements.txt | 2 +- python-pyvroom-routing/requirements.txt | 2 +- python-xpress-knapsack/requirements.txt | 2 +- 37 files changed, 1539 insertions(+), 29 deletions(-) create mode 100644 .nextmv/golden/python-nextroute/inputs/input.json create mode 100644 .nextmv/golden/python-nextroute/inputs/input.json.golden create mode 100644 .nextmv/golden/python-nextroute/main_test.go create mode 100644 .nextmv/readme/python-nextroute/0.sh create mode 100644 .nextmv/readme/python-nextroute/0.sh.golden create mode 100644 .nextmv/readme/python-nextroute/1.sh create mode 100644 python-nextroute/LICENSE create mode 100644 python-nextroute/README.md create mode 100644 python-nextroute/app.yaml create mode 100644 python-nextroute/input.json create mode 100644 python-nextroute/main.py create mode 100644 python-nextroute/requirements.txt diff --git a/.nextmv/golden/python-nextroute/inputs/input.json b/.nextmv/golden/python-nextroute/inputs/input.json new file mode 100644 index 0000000..bfb9969 --- /dev/null +++ b/.nextmv/golden/python-nextroute/inputs/input.json @@ -0,0 +1,263 @@ +{ + "defaults": { + "vehicles": { + "capacity": { + "bunnies": 20, + "rabbits": 10 + }, + "start_location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + }, + "end_location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + }, + "speed": 10 + }, + "stops": { + "duration": 300, + "quantity": { + "bunnies": -1, + "rabbits": -1 + }, + "unplanned_penalty": 200000, + "target_arrival_time": "2023-01-01T10:00:00Z", + "early_arrival_time_penalty": 1.5, + "late_arrival_time_penalty": 1.5 + } + }, + "stops": [ + { + "id": "s1", + "location": { + "lon": -78.90919, + "lat": 35.72389 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s2", + "location": { + "lon": -78.813862, + "lat": 35.75712 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s3", + "location": { + "lon": -78.92996, + "lat": 35.932795 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s4", + "location": { + "lon": -78.505745, + "lat": 35.77772 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s5", + "location": { + "lon": -78.75084, + "lat": 35.732995 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s6", + "location": { + "lon": -78.788025, + "lat": 35.813025 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s7", + "location": { + "lon": -78.749391, + "lat": 35.74261 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s8", + "location": { + "lon": -78.94658, + "lat": 36.039135 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s9", + "location": { + "lon": -78.64972, + "lat": 35.64796 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s10", + "location": { + "lon": -78.747955, + "lat": 35.672955 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s11", + "location": { + "lon": -78.83403, + "lat": 35.77013 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s12", + "location": { + "lon": -78.864465, + "lat": 35.782855 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s13", + "location": { + "lon": -78.952142, + "lat": 35.88029 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s14", + "location": { + "lon": -78.52748, + "lat": 35.961465 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s15", + "location": { + "lon": -78.89832, + "lat": 35.83202 + } + }, + { + "id": "s16", + "location": { + "lon": -78.63216, + "lat": 35.83458 + } + }, + { + "id": "s17", + "location": { + "lon": -78.76063, + "lat": 35.67337 + } + }, + { + "id": "s18", + "location": { + "lon": -78.911485, + "lat": 36.009015 + } + }, + { + "id": "s19", + "location": { + "lon": -78.522705, + "lat": 35.93663 + } + }, + { + "id": "s20", + "location": { + "lon": -78.995162, + "lat": 35.97414 + } + }, + { + "id": "s21", + "location": { + "lon": -78.50509, + "lat": 35.7606 + } + }, + { + "id": "s22", + "location": { + "lon": -78.828547, + "lat": 35.962635 + }, + "precedes": ["s16", "s23"] + }, + { + "id": "s23", + "location": { + "lon": -78.60914, + "lat": 35.84616 + }, + "start_time_window": [ + "2023-01-01T09:00:00-06:00", + "2023-01-01T09:30:00-06:00" + ] + }, + { + "id": "s24", + "location": { + "lon": -78.65521, + "lat": 35.740605 + }, + "start_time_window": [ + "2023-01-01T09:00:00-06:00", + "2023-01-01T09:30:00-06:00" + ], + "succeeds": "s25" + }, + { + "id": "s25", + "location": { + "lon": -78.92051, + "lat": 35.887575 + }, + "start_time_window": [ + "2023-01-01T09:00:00-06:00", + "2023-01-01T09:30:00-06:00" + ], + "precedes": "s26" + }, + { + "id": "s26", + "location": { + "lon": -78.84058, + "lat": 35.823865 + }, + "start_time_window": [ + "2023-01-01T09:00:00-06:00", + "2023-01-01T09:30:00-06:00" + ] + } + ], + "vehicles": [ + { + "id": "vehicle-0", + "start_time": "2023-01-01T06:00:00-06:00", + "end_time": "2023-01-01T10:00:00-06:00", + "activation_penalty": 4000, + "compatibility_attributes": ["premium"] + }, + { + "id": "vehicle-1", + "start_time": "2023-01-01T10:00:00-06:00", + "end_time": "2023-01-01T16:00:00-06:00", + "max_duration": 21000, + "compatibility_attributes": ["basic"] + } + ] +} diff --git a/.nextmv/golden/python-nextroute/inputs/input.json.golden b/.nextmv/golden/python-nextroute/inputs/input.json.golden new file mode 100644 index 0000000..9b5373e --- /dev/null +++ b/.nextmv/golden/python-nextroute/inputs/input.json.golden @@ -0,0 +1,628 @@ +{ + "options": { + "check": { + "duration": 30000000000, + "verbosity": "off" + }, + "format": { + "disable": { + "progression": true + } + }, + "model": { + "constraints": { + "disable": { + "attributes": false, + "capacities": null, + "capacity": false, + "distance_limit": false, + "groups": false, + "maximum_duration": false, + "maximum_stops": false, + "maximum_wait_stop": false, + "maximum_wait_vehicle": false, + "mixing_items": false, + "precedence": false, + "start_time_windows": false, + "vehicle_end_time": false, + "vehicle_start_time": false + }, + "enable": { + "cluster": false + } + }, + "objectives": { + "capacities": "", + "cluster": 0, + "early_arrival_penalty": 1, + "late_arrival_penalty": 1, + "min_stops": 1, + "travel_duration": 0, + "unplanned_penalty": 1, + "vehicle_activation_penalty": 1, + "vehicles_duration": 1 + }, + "properties": { + "disable": { + "duration_groups": false, + "durations": false, + "initial_solution": false, + "stop_duration_multipliers": false + } + }, + "validate": { + "disable": { + "resources": false, + "start_time": false + }, + "enable": { + "matrix": false, + "matrix_asymmetry_tolerance": 20 + } + } + }, + "solve": { + "duration": 3000000000, + "iterations": 50, + "parallel_runs": 1, + "run_deterministically": true, + "start_solutions": 1 + } + }, + "solutions": [ + { + "objective": { + "name": "1 * vehicle_activation_penalty + 1 * vehicles_duration + 1 * unplanned_penalty + 1 * early_arrival_penalty + 1 * late_arrival_penalty", + "objectives": [ + { + "base": 4000, + "factor": 1, + "name": "vehicle_activation_penalty", + "value": 4000 + }, + { + "base": 34394.3133084774, + "factor": 1, + "name": "vehicles_duration", + "value": 34394.3133084774 + }, + { + "base": 1400000, + "factor": 1, + "name": "unplanned_penalty", + "value": 1400000 + }, + { + "factor": 1, + "name": "early_arrival_penalty", + "value": 0 + }, + { + "base": 621271.1251366138, + "factor": 1, + "name": "late_arrival_penalty", + "value": 621271.1251366138 + } + ], + "value": 2059665.4384450912 + }, + "unplanned": [ + { + "id": "s16", + "location": { + "lat": 35.83458, + "lon": -78.63216 + } + }, + { + "id": "s22", + "location": { + "lat": 35.962635, + "lon": -78.828547 + } + }, + { + "id": "s23", + "location": { + "lat": 35.84616, + "lon": -78.60914 + } + }, + { + "id": "s24", + "location": { + "lat": 35.740605, + "lon": -78.65521 + } + }, + { + "id": "s25", + "location": { + "lat": 35.887575, + "lon": -78.92051 + } + }, + { + "id": "s26", + "location": { + "lat": 35.823865, + "lon": -78.84058 + } + }, + { + "id": "s4", + "location": { + "lat": 35.77772, + "lon": -78.505745 + } + } + ], + "vehicles": [ + { + "id": "vehicle-0", + "route": [ + { + "arrival_time": "2023-01-01T06:00:00-06:00", + "cumulative_travel_duration": 0, + "end_time": "2023-01-01T06:00:00-06:00", + "start_time": "2023-01-01T06:00:00-06:00", + "stop": { + "id": "vehicle-0-start", + "location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + } + }, + "travel_duration": 0 + }, + { + "arrival_time": "2023-01-01T06:09:12-06:00", + "cumulative_travel_distance": 5524, + "cumulative_travel_duration": 552, + "duration": 300, + "end_time": "2023-01-01T06:14:12-06:00", + "late_arrival_duration": 7752, + "start_time": "2023-01-01T06:09:12-06:00", + "stop": { + "id": "s7", + "location": { + "lat": 35.74261, + "lon": -78.749391 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 5524, + "travel_duration": 552 + }, + { + "arrival_time": "2023-01-01T06:28:29-06:00", + "cumulative_travel_distance": 14094, + "cumulative_travel_duration": 1409, + "duration": 300, + "end_time": "2023-01-01T06:33:29-06:00", + "late_arrival_duration": 8909, + "start_time": "2023-01-01T06:28:29-06:00", + "stop": { + "id": "s6", + "location": { + "lat": 35.813025, + "lon": -78.788025 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 8570, + "travel_duration": 857 + }, + { + "arrival_time": "2023-01-01T06:49:20-06:00", + "cumulative_travel_distance": 23604, + "cumulative_travel_duration": 2360, + "duration": 300, + "end_time": "2023-01-01T06:54:20-06:00", + "late_arrival_duration": 10160, + "start_time": "2023-01-01T06:49:20-06:00", + "stop": { + "id": "s5", + "location": { + "lat": 35.732995, + "lon": -78.75084 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 9510, + "travel_duration": 951 + }, + { + "arrival_time": "2023-01-01T07:05:29-06:00", + "cumulative_travel_distance": 30292, + "cumulative_travel_duration": 3029, + "duration": 300, + "end_time": "2023-01-01T07:10:29-06:00", + "late_arrival_duration": 11129, + "start_time": "2023-01-01T07:05:29-06:00", + "stop": { + "id": "s17", + "location": { + "lat": 35.67337, + "lon": -78.76063 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 6688, + "travel_duration": 668 + }, + { + "arrival_time": "2023-01-01T07:34:43-06:00", + "cumulative_travel_distance": 44835, + "cumulative_travel_duration": 4483, + "duration": 300, + "end_time": "2023-01-01T07:39:43-06:00", + "late_arrival_duration": 12883, + "start_time": "2023-01-01T07:34:43-06:00", + "stop": { + "id": "s1", + "location": { + "lat": 35.72389, + "lon": -78.90919 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 14543, + "travel_duration": 1454 + }, + { + "arrival_time": "2023-01-01T07:55:20-06:00", + "cumulative_travel_distance": 54198, + "cumulative_travel_duration": 5420, + "duration": 300, + "end_time": "2023-01-01T08:00:20-06:00", + "late_arrival_duration": 14120, + "start_time": "2023-01-01T07:55:20-06:00", + "stop": { + "id": "s2", + "location": { + "lat": 35.75712, + "lon": -78.813862 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 9363, + "travel_duration": 936 + }, + { + "arrival_time": "2023-01-01T08:19:08-06:00", + "cumulative_travel_distance": 65484, + "cumulative_travel_duration": 6548, + "duration": 300, + "end_time": "2023-01-01T08:24:08-06:00", + "late_arrival_duration": 15548, + "start_time": "2023-01-01T08:19:08-06:00", + "stop": { + "id": "s15", + "location": { + "lat": 35.83202, + "lon": -78.89832 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 11286, + "travel_duration": 1128 + }, + { + "arrival_time": "2023-01-01T08:43:25-06:00", + "cumulative_travel_distance": 77046, + "cumulative_travel_duration": 7705, + "duration": 300, + "end_time": "2023-01-01T08:48:25-06:00", + "late_arrival_duration": 17005, + "start_time": "2023-01-01T08:43:25-06:00", + "stop": { + "id": "s3", + "location": { + "lat": 35.932795, + "lon": -78.92996 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 11562, + "travel_duration": 1156 + }, + { + "arrival_time": "2023-01-01T09:02:48-06:00", + "cumulative_travel_distance": 85682, + "cumulative_travel_duration": 8568, + "duration": 300, + "end_time": "2023-01-01T09:07:48-06:00", + "late_arrival_duration": 18168, + "start_time": "2023-01-01T09:02:48-06:00", + "stop": { + "id": "s18", + "location": { + "lat": 36.009015, + "lon": -78.911485 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 8636, + "travel_duration": 863 + }, + { + "arrival_time": "2023-01-01T09:55:35-06:00", + "cumulative_travel_distance": 114350, + "cumulative_travel_duration": 11435, + "end_time": "2023-01-01T09:55:35-06:00", + "start_time": "2023-01-01T09:55:35-06:00", + "stop": { + "id": "vehicle-0-end", + "location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + } + }, + "travel_distance": 28668, + "travel_duration": 2866 + } + ], + "route_duration": 14135, + "route_stops_duration": 2700, + "route_travel_distance": 114350, + "route_travel_duration": 11435 + }, + { + "id": "vehicle-1", + "route": [ + { + "arrival_time": "2023-01-01T10:00:00-06:00", + "cumulative_travel_duration": 0, + "end_time": "2023-01-01T10:00:00-06:00", + "start_time": "2023-01-01T10:00:00-06:00", + "stop": { + "id": "vehicle-1-start", + "location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + } + }, + "travel_duration": 0 + }, + { + "arrival_time": "2023-01-01T10:14:40-06:00", + "cumulative_travel_distance": 8801, + "cumulative_travel_duration": 880, + "duration": 300, + "end_time": "2023-01-01T10:19:40-06:00", + "late_arrival_duration": 22480, + "start_time": "2023-01-01T10:14:40-06:00", + "stop": { + "id": "s11", + "location": { + "lat": 35.77013, + "lon": -78.83403 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 8801, + "travel_duration": 880 + }, + { + "arrival_time": "2023-01-01T10:24:48-06:00", + "cumulative_travel_distance": 11889, + "cumulative_travel_duration": 1188, + "duration": 300, + "end_time": "2023-01-01T10:29:48-06:00", + "late_arrival_duration": 23088, + "start_time": "2023-01-01T10:24:48-06:00", + "stop": { + "id": "s12", + "location": { + "lat": 35.782855, + "lon": -78.864465 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 3088, + "travel_duration": 308 + }, + { + "arrival_time": "2023-01-01T10:56:41-06:00", + "cumulative_travel_distance": 28011, + "cumulative_travel_duration": 2801, + "duration": 300, + "end_time": "2023-01-01T11:01:41-06:00", + "late_arrival_duration": 25001, + "start_time": "2023-01-01T10:56:41-06:00", + "stop": { + "id": "s10", + "location": { + "lat": 35.672955, + "lon": -78.747955 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 16122, + "travel_duration": 1612 + }, + { + "arrival_time": "2023-01-01T11:17:11-06:00", + "cumulative_travel_distance": 37310, + "cumulative_travel_duration": 3731, + "duration": 300, + "end_time": "2023-01-01T11:22:11-06:00", + "late_arrival_duration": 26231, + "start_time": "2023-01-01T11:17:11-06:00", + "stop": { + "id": "s9", + "location": { + "lat": 35.64796, + "lon": -78.64972 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 9299, + "travel_duration": 929 + }, + { + "arrival_time": "2023-01-01T11:52:20-06:00", + "cumulative_travel_distance": 55404, + "cumulative_travel_duration": 5540, + "duration": 300, + "end_time": "2023-01-01T11:57:20-06:00", + "late_arrival_duration": 28340, + "start_time": "2023-01-01T11:52:20-06:00", + "stop": { + "id": "s21", + "location": { + "lat": 35.7606, + "lon": -78.50509 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 18094, + "travel_duration": 1809 + }, + { + "arrival_time": "2023-01-01T12:34:43-06:00", + "cumulative_travel_distance": 77830, + "cumulative_travel_duration": 7783, + "duration": 300, + "end_time": "2023-01-01T12:39:43-06:00", + "late_arrival_duration": 30883, + "start_time": "2023-01-01T12:34:43-06:00", + "stop": { + "id": "s14", + "location": { + "lat": 35.961465, + "lon": -78.52748 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 22426, + "travel_duration": 2242 + }, + { + "arrival_time": "2023-01-01T12:44:22-06:00", + "cumulative_travel_distance": 80624, + "cumulative_travel_duration": 8062, + "duration": 300, + "end_time": "2023-01-01T12:49:22-06:00", + "late_arrival_duration": 31462, + "start_time": "2023-01-01T12:44:22-06:00", + "stop": { + "id": "s19", + "location": { + "lat": 35.93663, + "lon": -78.522705 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 2794, + "travel_duration": 279 + }, + { + "arrival_time": "2023-01-01T13:54:40-06:00", + "cumulative_travel_distance": 119804, + "cumulative_travel_duration": 11980, + "duration": 300, + "end_time": "2023-01-01T13:59:40-06:00", + "late_arrival_duration": 35680, + "start_time": "2023-01-01T13:54:40-06:00", + "stop": { + "id": "s13", + "location": { + "lat": 35.88029, + "lon": -78.952142 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 39180, + "travel_duration": 3918 + }, + { + "arrival_time": "2023-01-01T14:18:14-06:00", + "cumulative_travel_distance": 130935, + "cumulative_travel_duration": 13094, + "duration": 300, + "end_time": "2023-01-01T14:23:14-06:00", + "late_arrival_duration": 37094, + "start_time": "2023-01-01T14:18:14-06:00", + "stop": { + "id": "s20", + "location": { + "lat": 35.97414, + "lon": -78.995162 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 11131, + "travel_duration": 1113 + }, + { + "arrival_time": "2023-01-01T14:37:18-06:00", + "cumulative_travel_distance": 139380, + "cumulative_travel_duration": 13938, + "duration": 300, + "end_time": "2023-01-01T14:42:18-06:00", + "late_arrival_duration": 38238, + "start_time": "2023-01-01T14:37:18-06:00", + "stop": { + "id": "s8", + "location": { + "lat": 36.039135, + "lon": -78.94658 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 8445, + "travel_duration": 844 + }, + { + "arrival_time": "2023-01-01T15:37:38-06:00", + "cumulative_travel_distance": 172581, + "cumulative_travel_duration": 17258, + "end_time": "2023-01-01T15:37:38-06:00", + "start_time": "2023-01-01T15:37:38-06:00", + "stop": { + "id": "vehicle-1-end", + "location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + } + }, + "travel_distance": 33201, + "travel_duration": 3320 + } + ], + "route_duration": 20258, + "route_stops_duration": 3000, + "route_travel_distance": 172581, + "route_travel_duration": 17258 + } + ] + } + ], + "statistics": { + "result": { + "custom": { + "activated_vehicles": 2, + "max_duration": 20258, + "max_stops_in_vehicle": 10, + "max_travel_duration": 17258, + "min_duration": 14135, + "min_stops_in_vehicle": 9, + "min_travel_duration": 11435, + "unplanned_stops": 7 + }, + "duration": 0.123, + "value": 2059665.4384450912 + }, + "run": { + "duration": 0.123, + "iterations": 50 + }, + "schema": "v1" + }, + "version": { + "nextroute": "VERSION", + "sdk": "VERSION" + } +} diff --git a/.nextmv/golden/python-nextroute/main_test.go b/.nextmv/golden/python-nextroute/main_test.go new file mode 100644 index 0000000..d999c6f --- /dev/null +++ b/.nextmv/golden/python-nextroute/main_test.go @@ -0,0 +1,46 @@ +package mip + +import ( + "os" + "testing" + + "github.com/nextmv-io/sdk/golden" +) + +func TestMain(m *testing.M) { + code := m.Run() + os.Exit(code) +} + +func TestGolden(t *testing.T) { + golden.FileTests( + t, + "inputs", + golden.Config{ + Args: []string{ + "-solve_duration", "3", + // for deterministic tests + "-format_disable_progression", "true", + "-solve_parallelruns", "1", + "-solve_iterations", "50", + "-solve_rundeterministically", "true", + "-solve.startsolutions", "1", + }, + TransientFields: []golden.TransientField{ + {Key: "$.version.sdk", Replacement: golden.StableVersion}, + {Key: "$.version.nextroute", Replacement: golden.StableVersion}, + {Key: "$.statistics.result.duration", Replacement: golden.StableFloat}, + {Key: "$.statistics.run.duration", Replacement: golden.StableFloat}, + }, + Thresholds: golden.Tresholds{ + Float: 0.01, + }, + ExecutionConfig: &golden.ExecutionConfig{ + Command: "python3", + Args: []string{"../../../python-nextroute/main.py"}, + InputFlag: "-input", + OutputFlag: "-output", + }, + }, + ) +} diff --git a/.nextmv/readme/python-nextroute/0.sh b/.nextmv/readme/python-nextroute/0.sh new file mode 100644 index 0000000..bc88b5d --- /dev/null +++ b/.nextmv/readme/python-nextroute/0.sh @@ -0,0 +1 @@ +pip3 install -r requirements.txt diff --git a/.nextmv/readme/python-nextroute/0.sh.golden b/.nextmv/readme/python-nextroute/0.sh.golden new file mode 100644 index 0000000..e69de29 diff --git a/.nextmv/readme/python-nextroute/1.sh b/.nextmv/readme/python-nextroute/1.sh new file mode 100644 index 0000000..2a4b830 --- /dev/null +++ b/.nextmv/readme/python-nextroute/1.sh @@ -0,0 +1,2 @@ +python3 main.py -input input.json -output output.json \ + -duration 30 diff --git a/.nextmv/readme/workflow-configuration.yml b/.nextmv/readme/workflow-configuration.yml index 170b9e6..978c060 100644 --- a/.nextmv/readme/workflow-configuration.yml +++ b/.nextmv/readme/workflow-configuration.yml @@ -65,12 +65,6 @@ apps: silent: true - name: 2.sh skip: true - - name: hello-world - scripts: - - name: 0.sh - silent: true - - name: 1.sh - skip: true - name: python-gurobi-knapsack scripts: - name: 0.sh @@ -97,6 +91,10 @@ apps: silent: true - name: 2.sh skip: true + - name: python-nextroute + scripts: + - name: 0.sh + silent: true - name: python-ortools-costflow scripts: - name: 0.sh diff --git a/.nextmv/release/requirements.txt b/.nextmv/release/requirements.txt index 85f80c1..3269071 100644 --- a/.nextmv/release/requirements.txt +++ b/.nextmv/release/requirements.txt @@ -2,4 +2,4 @@ boto3>=1.34.33 pyyaml>=6.0.1 ruff>=0.1.7 requests>=2.26.0 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/.nextmv/workflow-configuration.yml b/.nextmv/workflow-configuration.yml index 02b70a1..6502fd3 100644 --- a/.nextmv/workflow-configuration.yml +++ b/.nextmv/workflow-configuration.yml @@ -89,6 +89,12 @@ apps: marketplace_app_id: knapsack.highs marketplace_major_version: v1 description: Use Python and HiGHS - knapsack. + - name: python-nextroute + type: python + app_id: + marketplace_app_id: + marketplace_major_version: + description: Use Python and Nextroute - VRP. - name: python-ortools-costflow type: python app_id: cost-flow-ortools diff --git a/go-nextroute/README.md b/go-nextroute/README.md index 13febc3..f99e5dd 100644 --- a/go-nextroute/README.md +++ b/go-nextroute/README.md @@ -1,7 +1,7 @@ # Nextmv Go Nextroute Example for running a Go application on the Nextmv Platform using the -`nextroute` vehicle routing problem solver. +`Nextroute` vehicle routing problem solver. 1. Run the app. diff --git a/python-ampl-facilitylocation/requirements.txt b/python-ampl-facilitylocation/requirements.txt index 76a308e..e3b772b 100644 --- a/python-ampl-facilitylocation/requirements.txt +++ b/python-ampl-facilitylocation/requirements.txt @@ -17,5 +17,5 @@ ampl-module-open==20240121 ampl-module-scip==20240121 ampl-module-xpress==20240115 -nextmv==0.12.0 +nextmv==0.13.1 pandas==2.2.2 diff --git a/python-ampl-knapsack/requirements.txt b/python-ampl-knapsack/requirements.txt index 6764951..6284b6e 100644 --- a/python-ampl-knapsack/requirements.txt +++ b/python-ampl-knapsack/requirements.txt @@ -17,4 +17,4 @@ ampl-module-open==20240121 ampl-module-scip==20240121 ampl-module-xpress==20240115 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-ampl-priceoptimization/requirements.txt b/python-ampl-priceoptimization/requirements.txt index 6764951..6284b6e 100644 --- a/python-ampl-priceoptimization/requirements.txt +++ b/python-ampl-priceoptimization/requirements.txt @@ -17,4 +17,4 @@ ampl-module-open==20240121 ampl-module-scip==20240121 ampl-module-xpress==20240115 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-gurobi-knapsack/requirements.txt b/python-gurobi-knapsack/requirements.txt index 0355102..e3d1e4d 100644 --- a/python-gurobi-knapsack/requirements.txt +++ b/python-gurobi-knapsack/requirements.txt @@ -1,2 +1,2 @@ gurobipy==11.0.0 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-hello-world/requirements.txt b/python-hello-world/requirements.txt index 7dbdd04..c9acc29 100644 --- a/python-hello-world/requirements.txt +++ b/python-hello-world/requirements.txt @@ -1,2 +1,2 @@ # Define the packages required by your project here. -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-hexaly-knapsack/requirements.txt b/python-hexaly-knapsack/requirements.txt index b98510f..2f214bc 100644 --- a/python-hexaly-knapsack/requirements.txt +++ b/python-hexaly-knapsack/requirements.txt @@ -3,4 +3,4 @@ --extra-index-url https://pypi.org/simple hexaly==13.0.20240712 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-highs-knapsack/requirements.txt b/python-highs-knapsack/requirements.txt index 2bde981..cf20c12 100644 --- a/python-highs-knapsack/requirements.txt +++ b/python-highs-knapsack/requirements.txt @@ -1,2 +1,2 @@ highspy==1.7.2 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-nextroute/LICENSE b/python-nextroute/LICENSE new file mode 100644 index 0000000..2c27ec7 --- /dev/null +++ b/python-nextroute/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022-2024 nextmv.io inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/python-nextroute/README.md b/python-nextroute/README.md new file mode 100644 index 0000000..93a165b --- /dev/null +++ b/python-nextroute/README.md @@ -0,0 +1,27 @@ +# Nextmv Python Nextroute + +Example for running a Python application on the Nextmv Platform using the +`Nextroute` vehicle routing problem solver. + +1. Install packages. + + ```bash + pip3 install -r requirements.txt + ``` + +1. Run the app. + + ```bash + python3 main.py -input input.json -output output.json \ + -duration 30 + ``` + +## Next steps + +* Open `main.py` and modify the model. +* Visit our [docs][docs] and [blog][blog]. Need more assistance? + [Contact][contact] us! + +[docs]: https://docs.nextmv.io +[blog]: https://www.nextmv.io/blog +[contact]: https://www.nextmv.io/contact diff --git a/python-nextroute/app.yaml b/python-nextroute/app.yaml new file mode 100644 index 0000000..f0de77f --- /dev/null +++ b/python-nextroute/app.yaml @@ -0,0 +1,11 @@ +# This manifest holds the information the app needs to run on the Nextmv Cloud. +type: python +runtime: ghcr.io/nextmv-io/runtime/python:3.11 +# List all files/directories that should be included in the app. Globbing +# (e.g.: configs/*.json) is supported. +files: + - main.py +python: + # Packages the app depends on need to be listed in a requirements.txt file + # that is referenced here. All listed packages will get bundled with the app. + pip-requirements: requirements.txt diff --git a/python-nextroute/input.json b/python-nextroute/input.json new file mode 100644 index 0000000..bfb9969 --- /dev/null +++ b/python-nextroute/input.json @@ -0,0 +1,263 @@ +{ + "defaults": { + "vehicles": { + "capacity": { + "bunnies": 20, + "rabbits": 10 + }, + "start_location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + }, + "end_location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + }, + "speed": 10 + }, + "stops": { + "duration": 300, + "quantity": { + "bunnies": -1, + "rabbits": -1 + }, + "unplanned_penalty": 200000, + "target_arrival_time": "2023-01-01T10:00:00Z", + "early_arrival_time_penalty": 1.5, + "late_arrival_time_penalty": 1.5 + } + }, + "stops": [ + { + "id": "s1", + "location": { + "lon": -78.90919, + "lat": 35.72389 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s2", + "location": { + "lon": -78.813862, + "lat": 35.75712 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s3", + "location": { + "lon": -78.92996, + "lat": 35.932795 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s4", + "location": { + "lon": -78.505745, + "lat": 35.77772 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s5", + "location": { + "lon": -78.75084, + "lat": 35.732995 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s6", + "location": { + "lon": -78.788025, + "lat": 35.813025 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s7", + "location": { + "lon": -78.749391, + "lat": 35.74261 + }, + "compatibility_attributes": ["premium"] + }, + { + "id": "s8", + "location": { + "lon": -78.94658, + "lat": 36.039135 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s9", + "location": { + "lon": -78.64972, + "lat": 35.64796 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s10", + "location": { + "lon": -78.747955, + "lat": 35.672955 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s11", + "location": { + "lon": -78.83403, + "lat": 35.77013 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s12", + "location": { + "lon": -78.864465, + "lat": 35.782855 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s13", + "location": { + "lon": -78.952142, + "lat": 35.88029 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s14", + "location": { + "lon": -78.52748, + "lat": 35.961465 + }, + "compatibility_attributes": ["basic"] + }, + { + "id": "s15", + "location": { + "lon": -78.89832, + "lat": 35.83202 + } + }, + { + "id": "s16", + "location": { + "lon": -78.63216, + "lat": 35.83458 + } + }, + { + "id": "s17", + "location": { + "lon": -78.76063, + "lat": 35.67337 + } + }, + { + "id": "s18", + "location": { + "lon": -78.911485, + "lat": 36.009015 + } + }, + { + "id": "s19", + "location": { + "lon": -78.522705, + "lat": 35.93663 + } + }, + { + "id": "s20", + "location": { + "lon": -78.995162, + "lat": 35.97414 + } + }, + { + "id": "s21", + "location": { + "lon": -78.50509, + "lat": 35.7606 + } + }, + { + "id": "s22", + "location": { + "lon": -78.828547, + "lat": 35.962635 + }, + "precedes": ["s16", "s23"] + }, + { + "id": "s23", + "location": { + "lon": -78.60914, + "lat": 35.84616 + }, + "start_time_window": [ + "2023-01-01T09:00:00-06:00", + "2023-01-01T09:30:00-06:00" + ] + }, + { + "id": "s24", + "location": { + "lon": -78.65521, + "lat": 35.740605 + }, + "start_time_window": [ + "2023-01-01T09:00:00-06:00", + "2023-01-01T09:30:00-06:00" + ], + "succeeds": "s25" + }, + { + "id": "s25", + "location": { + "lon": -78.92051, + "lat": 35.887575 + }, + "start_time_window": [ + "2023-01-01T09:00:00-06:00", + "2023-01-01T09:30:00-06:00" + ], + "precedes": "s26" + }, + { + "id": "s26", + "location": { + "lon": -78.84058, + "lat": 35.823865 + }, + "start_time_window": [ + "2023-01-01T09:00:00-06:00", + "2023-01-01T09:30:00-06:00" + ] + } + ], + "vehicles": [ + { + "id": "vehicle-0", + "start_time": "2023-01-01T06:00:00-06:00", + "end_time": "2023-01-01T10:00:00-06:00", + "activation_penalty": 4000, + "compatibility_attributes": ["premium"] + }, + { + "id": "vehicle-1", + "start_time": "2023-01-01T10:00:00-06:00", + "end_time": "2023-01-01T16:00:00-06:00", + "max_duration": 21000, + "compatibility_attributes": ["basic"] + } + ] +} diff --git a/python-nextroute/main.py b/python-nextroute/main.py new file mode 100644 index 0000000..4b12605 --- /dev/null +++ b/python-nextroute/main.py @@ -0,0 +1,62 @@ +import nextmv +import nextroute + + +def main() -> None: + """Entry point for the program.""" + + options = nextmv.Options( + nextmv.Parameter("input", str, "", "Path to input file. Default is stdin.", False), + nextmv.Parameter("output", str, "", "Path to output file. Default is stdout.", False), + nextmv.Parameter("solve_duration", int, 30, "Maximum duration, in seconds, of the solver.", False), + nextmv.Parameter("solve_parallelruns", int, -1, "Max number of parallel runs, -1 uses all resources.", False), + nextmv.Parameter("solve_iterations", int, -1, "Max number of iterations, -1 assumes no limit.", False), + nextmv.Parameter("solve_rundeterministically", bool, False, "Whether to run deterministically.", False), + nextmv.Parameter("solve_startsolutions", int, -1, "Number of solutions on top of initial ones.", False), + nextmv.Parameter("format_disable_progression", bool, False, "Disable the series data.", False), + # Add more options if needed. + ) + + input = nextmv.load_local(options=options, path=options.input) + + nextmv.log("Solving vehicle routing problem:") + nextmv.log(f" - stops: {len(input.data.get('stops', []))}") + nextmv.log(f" - vehicles: {len(input.data.get('vehicles', []))}") + + output = solve(input, options) + nextmv.write_local(output, path=options.output) + + +def solve(input: nextmv.Input, options: nextmv.Options) -> nextmv.Output: + """Solves the given problem and returns the solution.""" + + nextroute_input = nextroute.schema.Input.from_dict(input.data) + nextroute_options = nextroute.Options( + solve=nextroute.ParallelSolveOptions( + duration=options.solve_duration, + iterations=options.solve_iterations, + parallel_runs=options.solve_parallelruns, + run_deterministically=options.solve_rundeterministically, + start_solutions=options.solve_startsolutions, + ), + format=nextroute.FormatOptions( + disable=nextroute.DisableFormatOptions( + progression=options.format_disable_progression, + ), + ), + ) + + nextroute_output = nextroute.solve(nextroute_input, nextroute_options) + + return nextmv.Output( + options={ + "nextmv": options.to_dict(), + "nextroute": nextroute_options.to_dict(), + }, + solution=nextroute_output.solutions[0].to_dict(), + statistics=nextroute_output.statistics.to_dict(), + ) + + +if __name__ == "__main__": + main() diff --git a/python-nextroute/requirements.txt b/python-nextroute/requirements.txt new file mode 100644 index 0000000..fb8d8e8 --- /dev/null +++ b/python-nextroute/requirements.txt @@ -0,0 +1,2 @@ +nextroute==1.8.0.dev2 +nextmv==0.13.1 diff --git a/python-ortools-costflow/requirements.txt b/python-ortools-costflow/requirements.txt index 461e2a5..d97726e 100644 --- a/python-ortools-costflow/requirements.txt +++ b/python-ortools-costflow/requirements.txt @@ -1,2 +1,2 @@ ortools==9.8.3296 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-ortools-demandforecasting/requirements.txt b/python-ortools-demandforecasting/requirements.txt index 461e2a5..d97726e 100644 --- a/python-ortools-demandforecasting/requirements.txt +++ b/python-ortools-demandforecasting/requirements.txt @@ -1,2 +1,2 @@ ortools==9.8.3296 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-ortools-knapsack-multicsv/requirements.txt b/python-ortools-knapsack-multicsv/requirements.txt index 461e2a5..d97726e 100644 --- a/python-ortools-knapsack-multicsv/requirements.txt +++ b/python-ortools-knapsack-multicsv/requirements.txt @@ -1,2 +1,2 @@ ortools==9.8.3296 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-ortools-knapsack/requirements.txt b/python-ortools-knapsack/requirements.txt index 461e2a5..d97726e 100644 --- a/python-ortools-knapsack/requirements.txt +++ b/python-ortools-knapsack/requirements.txt @@ -1,2 +1,2 @@ ortools==9.8.3296 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-ortools-routing/requirements.txt b/python-ortools-routing/requirements.txt index 461e2a5..d97726e 100644 --- a/python-ortools-routing/requirements.txt +++ b/python-ortools-routing/requirements.txt @@ -1,2 +1,2 @@ ortools==9.8.3296 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-ortools-shiftassignment/requirements.txt b/python-ortools-shiftassignment/requirements.txt index 461e2a5..d97726e 100644 --- a/python-ortools-shiftassignment/requirements.txt +++ b/python-ortools-shiftassignment/requirements.txt @@ -1,2 +1,2 @@ ortools==9.8.3296 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-ortools-shiftplanning/requirements.txt b/python-ortools-shiftplanning/requirements.txt index 461e2a5..d97726e 100644 --- a/python-ortools-shiftplanning/requirements.txt +++ b/python-ortools-shiftplanning/requirements.txt @@ -1,2 +1,2 @@ ortools==9.8.3296 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-pyomo-knapsack/requirements.txt b/python-pyomo-knapsack/requirements.txt index 6151d99..b21348f 100644 --- a/python-pyomo-knapsack/requirements.txt +++ b/python-pyomo-knapsack/requirements.txt @@ -1,2 +1,2 @@ pyomo==6.8.0 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-pyomo-shiftassignment/requirements.txt b/python-pyomo-shiftassignment/requirements.txt index 6151d99..b21348f 100644 --- a/python-pyomo-shiftassignment/requirements.txt +++ b/python-pyomo-shiftassignment/requirements.txt @@ -1,2 +1,2 @@ pyomo==6.8.0 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-pyomo-shiftplanning/requirements.txt b/python-pyomo-shiftplanning/requirements.txt index 6151d99..b21348f 100644 --- a/python-pyomo-shiftplanning/requirements.txt +++ b/python-pyomo-shiftplanning/requirements.txt @@ -1,2 +1,2 @@ pyomo==6.8.0 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-pyoptinterface-knapsack/requirements-arm64.txt b/python-pyoptinterface-knapsack/requirements-arm64.txt index 3d42b01..af13c47 100644 --- a/python-pyoptinterface-knapsack/requirements-arm64.txt +++ b/python-pyoptinterface-knapsack/requirements-arm64.txt @@ -4,4 +4,4 @@ highsbox==1.7.2.post2 https://merschformann.github.io/random/content/wheels/pyoptinterface/pyoptinterface-0.2.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl # Other packages. -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-pyoptinterface-knapsack/requirements.txt b/python-pyoptinterface-knapsack/requirements.txt index 3c0ffc8..bd9a516 100644 --- a/python-pyoptinterface-knapsack/requirements.txt +++ b/python-pyoptinterface-knapsack/requirements.txt @@ -2,4 +2,4 @@ pyoptinterface[highs]==0.2.8 # Other packages. -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-pyvroom-routing/requirements.txt b/python-pyvroom-routing/requirements.txt index 79d90a1..b3d9e08 100644 --- a/python-pyvroom-routing/requirements.txt +++ b/python-pyvroom-routing/requirements.txt @@ -1,2 +1,2 @@ pyvroom==1.13.6 -nextmv==0.12.0 +nextmv==0.13.1 diff --git a/python-xpress-knapsack/requirements.txt b/python-xpress-knapsack/requirements.txt index 273299b..66c3a7c 100644 --- a/python-xpress-knapsack/requirements.txt +++ b/python-xpress-knapsack/requirements.txt @@ -1,2 +1,2 @@ xpress==9.4.2; platform_system != 'Darwin' or (platform_system == 'Darwin' and platform_machine != 'arm64') -nextmv==0.12.0 +nextmv==0.13.1 From 5f162c5a67cf52d408a6bf1d5e9a700587edaa45 Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Thu, 17 Oct 2024 00:51:46 -0500 Subject: [PATCH 02/11] Correct flag in README --- python-nextroute/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-nextroute/README.md b/python-nextroute/README.md index 93a165b..6f9104d 100644 --- a/python-nextroute/README.md +++ b/python-nextroute/README.md @@ -13,7 +13,7 @@ Example for running a Python application on the Nextmv Platform using the ```bash python3 main.py -input input.json -output output.json \ - -duration 30 + -solve_duration 10 ``` ## Next steps From d6bfc3e5dc8cc8747dec9ac55400049fd1af5a8e Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Thu, 17 Oct 2024 00:52:29 -0500 Subject: [PATCH 03/11] Update README test --- .nextmv/readme/python-nextroute/1.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nextmv/readme/python-nextroute/1.sh b/.nextmv/readme/python-nextroute/1.sh index 2a4b830..71b47f3 100644 --- a/.nextmv/readme/python-nextroute/1.sh +++ b/.nextmv/readme/python-nextroute/1.sh @@ -1,2 +1,2 @@ python3 main.py -input input.json -output output.json \ - -duration 30 + -solve_duration 10 From 37abd13cf80b507c36caf7c36215a851b4f74af9 Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Thu, 17 Oct 2024 00:54:40 -0500 Subject: [PATCH 04/11] Adds new app to golden tests --- .nextmv/golden/workflow-configuration.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.nextmv/golden/workflow-configuration.yml b/.nextmv/golden/workflow-configuration.yml index b98d967..6b398e3 100644 --- a/.nextmv/golden/workflow-configuration.yml +++ b/.nextmv/golden/workflow-configuration.yml @@ -29,6 +29,9 @@ apps: - name: python-highs-knapsack language: python language-version: 3.11 + - name: python-nextroute + language: python + language-version: 3.11 - name: python-ortools-costflow language: python language-version: 3.11 From 465b5d2acf90864378db61babd6bc1de01014470 Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Thu, 17 Oct 2024 00:55:55 -0500 Subject: [PATCH 05/11] Fix flag in test --- .nextmv/golden/python-nextroute/main_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nextmv/golden/python-nextroute/main_test.go b/.nextmv/golden/python-nextroute/main_test.go index d999c6f..ae65cb8 100644 --- a/.nextmv/golden/python-nextroute/main_test.go +++ b/.nextmv/golden/python-nextroute/main_test.go @@ -24,7 +24,7 @@ func TestGolden(t *testing.T) { "-solve_parallelruns", "1", "-solve_iterations", "50", "-solve_rundeterministically", "true", - "-solve.startsolutions", "1", + "-solve_startsolutions", "1", }, TransientFields: []golden.TransientField{ {Key: "$.version.sdk", Replacement: golden.StableVersion}, From 8502ff167a0c9cbfec27b05305d3428175f6a865 Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Thu, 17 Oct 2024 01:00:18 -0500 Subject: [PATCH 06/11] Attempt golden fix --- .../python-nextroute/inputs/input.json.golden | 1130 +++++++++-------- .nextmv/readme/python-nextroute/1.sh.golden | 0 .nextmv/readme/workflow-configuration.yml | 2 + 3 files changed, 570 insertions(+), 562 deletions(-) create mode 100644 .nextmv/readme/python-nextroute/1.sh.golden diff --git a/.nextmv/golden/python-nextroute/inputs/input.json.golden b/.nextmv/golden/python-nextroute/inputs/input.json.golden index 9b5373e..0bf65a7 100644 --- a/.nextmv/golden/python-nextroute/inputs/input.json.golden +++ b/.nextmv/golden/python-nextroute/inputs/input.json.golden @@ -1,605 +1,615 @@ { "options": { - "check": { - "duration": 30000000000, - "verbosity": "off" + "nextmv": { + "format_disable_progression": true, + "input": "input.json", + "output": "output.json", + "solve_duration": 3, + "solve_iterations": 50, + "solve_parallelruns": 1, + "solve_rundeterministically": true, + "solve_startsolutions": 1 }, - "format": { - "disable": { - "progression": true - } - }, - "model": { - "constraints": { - "disable": { - "attributes": false, - "capacities": null, - "capacity": false, - "distance_limit": false, - "groups": false, - "maximum_duration": false, - "maximum_stops": false, - "maximum_wait_stop": false, - "maximum_wait_vehicle": false, - "mixing_items": false, - "precedence": false, - "start_time_windows": false, - "vehicle_end_time": false, - "vehicle_start_time": false - }, - "enable": { - "cluster": false - } - }, - "objectives": { - "capacities": "", - "cluster": 0, - "early_arrival_penalty": 1, - "late_arrival_penalty": 1, - "min_stops": 1, - "travel_duration": 0, - "unplanned_penalty": 1, - "vehicle_activation_penalty": 1, - "vehicles_duration": 1 + "nextroute": { + "check": { + "duration": 30, + "verbosity": "off" }, - "properties": { + "format": { "disable": { - "duration_groups": false, - "durations": false, - "initial_solution": false, - "stop_duration_multipliers": false + "progression": true } }, - "validate": { - "disable": { - "resources": false, - "start_time": false - }, - "enable": { - "matrix": false, - "matrix_asymmetry_tolerance": 20 - } - } - }, - "solve": { - "duration": 3000000000, - "iterations": 50, - "parallel_runs": 1, - "run_deterministically": true, - "start_solutions": 1 - } - }, - "solutions": [ - { - "objective": { - "name": "1 * vehicle_activation_penalty + 1 * vehicles_duration + 1 * unplanned_penalty + 1 * early_arrival_penalty + 1 * late_arrival_penalty", - "objectives": [ - { - "base": 4000, - "factor": 1, - "name": "vehicle_activation_penalty", - "value": 4000 + "model": { + "constraints": { + "disable": { + "attributes": false, + "capacities": [], + "capacity": false, + "distance_limit": false, + "groups": false, + "maximum_duration": false, + "maximum_stops": false, + "maximum_wait_stop": false, + "maximum_wait_vehicle": false, + "mixing_items": false, + "precedence": false, + "start_time_windows": false, + "vehicle_end_time": false, + "vehicle_start_time": false }, - { - "base": 34394.3133084774, - "factor": 1, - "name": "vehicles_duration", - "value": 34394.3133084774 - }, - { - "base": 1400000, - "factor": 1, - "name": "unplanned_penalty", - "value": 1400000 - }, - { - "factor": 1, - "name": "early_arrival_penalty", - "value": 0 - }, - { - "base": 621271.1251366138, - "factor": 1, - "name": "late_arrival_penalty", - "value": 621271.1251366138 - } - ], - "value": 2059665.4384450912 - }, - "unplanned": [ - { - "id": "s16", - "location": { - "lat": 35.83458, - "lon": -78.63216 + "enable": { + "cluster": false } }, - { - "id": "s22", - "location": { - "lat": 35.962635, - "lon": -78.828547 + "objectives": { + "capacities": "", + "cluster": 0, + "early_arrival_penalty": 1, + "late_arrival_penalty": 1, + "min_stops": 1, + "travel_duration": 0, + "unplanned_penalty": 1, + "vehicle_activation_penalty": 1, + "vehicles_duration": 1 + }, + "properties": { + "disable": { + "duration_groups": false, + "durations": false, + "initial_solution": false, + "stop_duration_multipliers": false } }, - { - "id": "s23", - "location": { - "lat": 35.84616, - "lon": -78.60914 + "validate": { + "disable": { + "resources": false, + "start_time": false + }, + "enable": { + "matrix": false, + "matrix_asymmetry_tolerance": 20 } + } + }, + "solve": { + "duration": 3, + "iterations": 50, + "parallel_runs": 1, + "run_deterministically": true, + "start_solutions": 1 + } + } + }, + "solution": { + "objective": { + "name": "1 * vehicle_activation_penalty + 1 * vehicles_duration + 1 * unplanned_penalty + 1 * early_arrival_penalty + 1 * late_arrival_penalty", + "objectives": [ + { + "base": 4000, + "factor": 1, + "name": "vehicle_activation_penalty", + "value": 4000 }, { - "id": "s24", - "location": { - "lat": 35.740605, - "lon": -78.65521 - } + "base": 34394.3133084774, + "factor": 1, + "name": "vehicles_duration", + "value": 34394.3133084774 }, { - "id": "s25", - "location": { - "lat": 35.887575, - "lon": -78.92051 - } + "base": 1400000, + "factor": 1, + "name": "unplanned_penalty", + "value": 1400000 }, { - "id": "s26", - "location": { - "lat": 35.823865, - "lon": -78.84058 - } + "factor": 1, + "name": "early_arrival_penalty", + "value": 0 }, { - "id": "s4", - "location": { - "lat": 35.77772, - "lon": -78.505745 - } + "base": 621271.1251366138, + "factor": 1, + "name": "late_arrival_penalty", + "value": 621271.1251366138 } ], - "vehicles": [ - { - "id": "vehicle-0", - "route": [ - { - "arrival_time": "2023-01-01T06:00:00-06:00", - "cumulative_travel_duration": 0, - "end_time": "2023-01-01T06:00:00-06:00", - "start_time": "2023-01-01T06:00:00-06:00", - "stop": { - "id": "vehicle-0-start", - "location": { - "lat": 35.791729813680874, - "lon": -78.7401685145487 - } - }, - "travel_duration": 0 + "value": 2059665.4384450912 + }, + "unplanned": [ + { + "id": "s16", + "location": { + "lat": 35.83458, + "lon": -78.63216 + } + }, + { + "id": "s22", + "location": { + "lat": 35.962635, + "lon": -78.828547 + } + }, + { + "id": "s23", + "location": { + "lat": 35.84616, + "lon": -78.60914 + } + }, + { + "id": "s24", + "location": { + "lat": 35.740605, + "lon": -78.65521 + } + }, + { + "id": "s25", + "location": { + "lat": 35.887575, + "lon": -78.92051 + } + }, + { + "id": "s26", + "location": { + "lat": 35.823865, + "lon": -78.84058 + } + }, + { + "id": "s4", + "location": { + "lat": 35.77772, + "lon": -78.505745 + } + } + ], + "vehicles": [ + { + "id": "vehicle-0", + "route": [ + { + "arrival_time": "2023-01-01T06:00:00-06:00", + "cumulative_travel_duration": 0, + "end_time": "2023-01-01T06:00:00-06:00", + "start_time": "2023-01-01T06:00:00-06:00", + "stop": { + "id": "vehicle-0-start", + "location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + } }, - { - "arrival_time": "2023-01-01T06:09:12-06:00", - "cumulative_travel_distance": 5524, - "cumulative_travel_duration": 552, - "duration": 300, - "end_time": "2023-01-01T06:14:12-06:00", - "late_arrival_duration": 7752, - "start_time": "2023-01-01T06:09:12-06:00", - "stop": { - "id": "s7", - "location": { - "lat": 35.74261, - "lon": -78.749391 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 5524, - "travel_duration": 552 + "travel_duration": 0 + }, + { + "arrival_time": "2023-01-01T06:09:12-06:00", + "cumulative_travel_distance": 5524, + "cumulative_travel_duration": 552, + "duration": 300, + "end_time": "2023-01-01T06:14:12-06:00", + "late_arrival_duration": 7752, + "start_time": "2023-01-01T06:09:12-06:00", + "stop": { + "id": "s7", + "location": { + "lat": 35.74261, + "lon": -78.749391 + } }, - { - "arrival_time": "2023-01-01T06:28:29-06:00", - "cumulative_travel_distance": 14094, - "cumulative_travel_duration": 1409, - "duration": 300, - "end_time": "2023-01-01T06:33:29-06:00", - "late_arrival_duration": 8909, - "start_time": "2023-01-01T06:28:29-06:00", - "stop": { - "id": "s6", - "location": { - "lat": 35.813025, - "lon": -78.788025 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 8570, - "travel_duration": 857 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 5524, + "travel_duration": 552 + }, + { + "arrival_time": "2023-01-01T06:28:29-06:00", + "cumulative_travel_distance": 14094, + "cumulative_travel_duration": 1409, + "duration": 300, + "end_time": "2023-01-01T06:33:29-06:00", + "late_arrival_duration": 8909, + "start_time": "2023-01-01T06:28:29-06:00", + "stop": { + "id": "s6", + "location": { + "lat": 35.813025, + "lon": -78.788025 + } }, - { - "arrival_time": "2023-01-01T06:49:20-06:00", - "cumulative_travel_distance": 23604, - "cumulative_travel_duration": 2360, - "duration": 300, - "end_time": "2023-01-01T06:54:20-06:00", - "late_arrival_duration": 10160, - "start_time": "2023-01-01T06:49:20-06:00", - "stop": { - "id": "s5", - "location": { - "lat": 35.732995, - "lon": -78.75084 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 9510, - "travel_duration": 951 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 8570, + "travel_duration": 857 + }, + { + "arrival_time": "2023-01-01T06:49:20-06:00", + "cumulative_travel_distance": 23604, + "cumulative_travel_duration": 2360, + "duration": 300, + "end_time": "2023-01-01T06:54:20-06:00", + "late_arrival_duration": 10160, + "start_time": "2023-01-01T06:49:20-06:00", + "stop": { + "id": "s5", + "location": { + "lat": 35.732995, + "lon": -78.75084 + } }, - { - "arrival_time": "2023-01-01T07:05:29-06:00", - "cumulative_travel_distance": 30292, - "cumulative_travel_duration": 3029, - "duration": 300, - "end_time": "2023-01-01T07:10:29-06:00", - "late_arrival_duration": 11129, - "start_time": "2023-01-01T07:05:29-06:00", - "stop": { - "id": "s17", - "location": { - "lat": 35.67337, - "lon": -78.76063 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 6688, - "travel_duration": 668 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 9510, + "travel_duration": 951 + }, + { + "arrival_time": "2023-01-01T07:05:29-06:00", + "cumulative_travel_distance": 30292, + "cumulative_travel_duration": 3029, + "duration": 300, + "end_time": "2023-01-01T07:10:29-06:00", + "late_arrival_duration": 11129, + "start_time": "2023-01-01T07:05:29-06:00", + "stop": { + "id": "s17", + "location": { + "lat": 35.67337, + "lon": -78.76063 + } }, - { - "arrival_time": "2023-01-01T07:34:43-06:00", - "cumulative_travel_distance": 44835, - "cumulative_travel_duration": 4483, - "duration": 300, - "end_time": "2023-01-01T07:39:43-06:00", - "late_arrival_duration": 12883, - "start_time": "2023-01-01T07:34:43-06:00", - "stop": { - "id": "s1", - "location": { - "lat": 35.72389, - "lon": -78.90919 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 14543, - "travel_duration": 1454 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 6688, + "travel_duration": 668 + }, + { + "arrival_time": "2023-01-01T07:34:43-06:00", + "cumulative_travel_distance": 44835, + "cumulative_travel_duration": 4483, + "duration": 300, + "end_time": "2023-01-01T07:39:43-06:00", + "late_arrival_duration": 12883, + "start_time": "2023-01-01T07:34:43-06:00", + "stop": { + "id": "s1", + "location": { + "lat": 35.72389, + "lon": -78.90919 + } }, - { - "arrival_time": "2023-01-01T07:55:20-06:00", - "cumulative_travel_distance": 54198, - "cumulative_travel_duration": 5420, - "duration": 300, - "end_time": "2023-01-01T08:00:20-06:00", - "late_arrival_duration": 14120, - "start_time": "2023-01-01T07:55:20-06:00", - "stop": { - "id": "s2", - "location": { - "lat": 35.75712, - "lon": -78.813862 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 9363, - "travel_duration": 936 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 14543, + "travel_duration": 1454 + }, + { + "arrival_time": "2023-01-01T07:55:20-06:00", + "cumulative_travel_distance": 54198, + "cumulative_travel_duration": 5420, + "duration": 300, + "end_time": "2023-01-01T08:00:20-06:00", + "late_arrival_duration": 14120, + "start_time": "2023-01-01T07:55:20-06:00", + "stop": { + "id": "s2", + "location": { + "lat": 35.75712, + "lon": -78.813862 + } }, - { - "arrival_time": "2023-01-01T08:19:08-06:00", - "cumulative_travel_distance": 65484, - "cumulative_travel_duration": 6548, - "duration": 300, - "end_time": "2023-01-01T08:24:08-06:00", - "late_arrival_duration": 15548, - "start_time": "2023-01-01T08:19:08-06:00", - "stop": { - "id": "s15", - "location": { - "lat": 35.83202, - "lon": -78.89832 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 11286, - "travel_duration": 1128 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 9363, + "travel_duration": 936 + }, + { + "arrival_time": "2023-01-01T08:19:08-06:00", + "cumulative_travel_distance": 65484, + "cumulative_travel_duration": 6548, + "duration": 300, + "end_time": "2023-01-01T08:24:08-06:00", + "late_arrival_duration": 15548, + "start_time": "2023-01-01T08:19:08-06:00", + "stop": { + "id": "s15", + "location": { + "lat": 35.83202, + "lon": -78.89832 + } }, - { - "arrival_time": "2023-01-01T08:43:25-06:00", - "cumulative_travel_distance": 77046, - "cumulative_travel_duration": 7705, - "duration": 300, - "end_time": "2023-01-01T08:48:25-06:00", - "late_arrival_duration": 17005, - "start_time": "2023-01-01T08:43:25-06:00", - "stop": { - "id": "s3", - "location": { - "lat": 35.932795, - "lon": -78.92996 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 11562, - "travel_duration": 1156 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 11286, + "travel_duration": 1128 + }, + { + "arrival_time": "2023-01-01T08:43:25-06:00", + "cumulative_travel_distance": 77046, + "cumulative_travel_duration": 7705, + "duration": 300, + "end_time": "2023-01-01T08:48:25-06:00", + "late_arrival_duration": 17005, + "start_time": "2023-01-01T08:43:25-06:00", + "stop": { + "id": "s3", + "location": { + "lat": 35.932795, + "lon": -78.92996 + } }, - { - "arrival_time": "2023-01-01T09:02:48-06:00", - "cumulative_travel_distance": 85682, - "cumulative_travel_duration": 8568, - "duration": 300, - "end_time": "2023-01-01T09:07:48-06:00", - "late_arrival_duration": 18168, - "start_time": "2023-01-01T09:02:48-06:00", - "stop": { - "id": "s18", - "location": { - "lat": 36.009015, - "lon": -78.911485 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 8636, - "travel_duration": 863 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 11562, + "travel_duration": 1156 + }, + { + "arrival_time": "2023-01-01T09:02:48-06:00", + "cumulative_travel_distance": 85682, + "cumulative_travel_duration": 8568, + "duration": 300, + "end_time": "2023-01-01T09:07:48-06:00", + "late_arrival_duration": 18168, + "start_time": "2023-01-01T09:02:48-06:00", + "stop": { + "id": "s18", + "location": { + "lat": 36.009015, + "lon": -78.911485 + } }, - { - "arrival_time": "2023-01-01T09:55:35-06:00", - "cumulative_travel_distance": 114350, - "cumulative_travel_duration": 11435, - "end_time": "2023-01-01T09:55:35-06:00", - "start_time": "2023-01-01T09:55:35-06:00", - "stop": { - "id": "vehicle-0-end", - "location": { - "lat": 35.791729813680874, - "lon": -78.7401685145487 - } - }, - "travel_distance": 28668, - "travel_duration": 2866 - } - ], - "route_duration": 14135, - "route_stops_duration": 2700, - "route_travel_distance": 114350, - "route_travel_duration": 11435 - }, - { - "id": "vehicle-1", - "route": [ - { - "arrival_time": "2023-01-01T10:00:00-06:00", - "cumulative_travel_duration": 0, - "end_time": "2023-01-01T10:00:00-06:00", - "start_time": "2023-01-01T10:00:00-06:00", - "stop": { - "id": "vehicle-1-start", - "location": { - "lat": 35.791729813680874, - "lon": -78.7401685145487 - } - }, - "travel_duration": 0 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 8636, + "travel_duration": 863 + }, + { + "arrival_time": "2023-01-01T09:55:35-06:00", + "cumulative_travel_distance": 114350, + "cumulative_travel_duration": 11435, + "end_time": "2023-01-01T09:55:35-06:00", + "start_time": "2023-01-01T09:55:35-06:00", + "stop": { + "id": "vehicle-0-end", + "location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + } }, - { - "arrival_time": "2023-01-01T10:14:40-06:00", - "cumulative_travel_distance": 8801, - "cumulative_travel_duration": 880, - "duration": 300, - "end_time": "2023-01-01T10:19:40-06:00", - "late_arrival_duration": 22480, - "start_time": "2023-01-01T10:14:40-06:00", - "stop": { - "id": "s11", - "location": { - "lat": 35.77013, - "lon": -78.83403 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 8801, - "travel_duration": 880 + "travel_distance": 28668, + "travel_duration": 2866 + } + ], + "route_duration": 14135, + "route_stops_duration": 2700, + "route_travel_distance": 114350, + "route_travel_duration": 11435 + }, + { + "id": "vehicle-1", + "route": [ + { + "arrival_time": "2023-01-01T10:00:00-06:00", + "cumulative_travel_duration": 0, + "end_time": "2023-01-01T10:00:00-06:00", + "start_time": "2023-01-01T10:00:00-06:00", + "stop": { + "id": "vehicle-1-start", + "location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + } }, - { - "arrival_time": "2023-01-01T10:24:48-06:00", - "cumulative_travel_distance": 11889, - "cumulative_travel_duration": 1188, - "duration": 300, - "end_time": "2023-01-01T10:29:48-06:00", - "late_arrival_duration": 23088, - "start_time": "2023-01-01T10:24:48-06:00", - "stop": { - "id": "s12", - "location": { - "lat": 35.782855, - "lon": -78.864465 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 3088, - "travel_duration": 308 + "travel_duration": 0 + }, + { + "arrival_time": "2023-01-01T10:14:40-06:00", + "cumulative_travel_distance": 8801, + "cumulative_travel_duration": 880, + "duration": 300, + "end_time": "2023-01-01T10:19:40-06:00", + "late_arrival_duration": 22480, + "start_time": "2023-01-01T10:14:40-06:00", + "stop": { + "id": "s11", + "location": { + "lat": 35.77013, + "lon": -78.83403 + } }, - { - "arrival_time": "2023-01-01T10:56:41-06:00", - "cumulative_travel_distance": 28011, - "cumulative_travel_duration": 2801, - "duration": 300, - "end_time": "2023-01-01T11:01:41-06:00", - "late_arrival_duration": 25001, - "start_time": "2023-01-01T10:56:41-06:00", - "stop": { - "id": "s10", - "location": { - "lat": 35.672955, - "lon": -78.747955 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 16122, - "travel_duration": 1612 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 8801, + "travel_duration": 880 + }, + { + "arrival_time": "2023-01-01T10:24:48-06:00", + "cumulative_travel_distance": 11889, + "cumulative_travel_duration": 1188, + "duration": 300, + "end_time": "2023-01-01T10:29:48-06:00", + "late_arrival_duration": 23088, + "start_time": "2023-01-01T10:24:48-06:00", + "stop": { + "id": "s12", + "location": { + "lat": 35.782855, + "lon": -78.864465 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 3088, + "travel_duration": 308 + }, + { + "arrival_time": "2023-01-01T10:56:41-06:00", + "cumulative_travel_distance": 28011, + "cumulative_travel_duration": 2801, + "duration": 300, + "end_time": "2023-01-01T11:01:41-06:00", + "late_arrival_duration": 25001, + "start_time": "2023-01-01T10:56:41-06:00", + "stop": { + "id": "s10", + "location": { + "lat": 35.672955, + "lon": -78.747955 + } + }, + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 16122, + "travel_duration": 1612 + }, + { + "arrival_time": "2023-01-01T11:17:11-06:00", + "cumulative_travel_distance": 37310, + "cumulative_travel_duration": 3731, + "duration": 300, + "end_time": "2023-01-01T11:22:11-06:00", + "late_arrival_duration": 26231, + "start_time": "2023-01-01T11:17:11-06:00", + "stop": { + "id": "s9", + "location": { + "lat": 35.64796, + "lon": -78.64972 + } }, - { - "arrival_time": "2023-01-01T11:17:11-06:00", - "cumulative_travel_distance": 37310, - "cumulative_travel_duration": 3731, - "duration": 300, - "end_time": "2023-01-01T11:22:11-06:00", - "late_arrival_duration": 26231, - "start_time": "2023-01-01T11:17:11-06:00", - "stop": { - "id": "s9", - "location": { - "lat": 35.64796, - "lon": -78.64972 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 9299, - "travel_duration": 929 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 9299, + "travel_duration": 929 + }, + { + "arrival_time": "2023-01-01T11:52:20-06:00", + "cumulative_travel_distance": 55404, + "cumulative_travel_duration": 5540, + "duration": 300, + "end_time": "2023-01-01T11:57:20-06:00", + "late_arrival_duration": 28340, + "start_time": "2023-01-01T11:52:20-06:00", + "stop": { + "id": "s21", + "location": { + "lat": 35.7606, + "lon": -78.50509 + } }, - { - "arrival_time": "2023-01-01T11:52:20-06:00", - "cumulative_travel_distance": 55404, - "cumulative_travel_duration": 5540, - "duration": 300, - "end_time": "2023-01-01T11:57:20-06:00", - "late_arrival_duration": 28340, - "start_time": "2023-01-01T11:52:20-06:00", - "stop": { - "id": "s21", - "location": { - "lat": 35.7606, - "lon": -78.50509 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 18094, - "travel_duration": 1809 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 18094, + "travel_duration": 1809 + }, + { + "arrival_time": "2023-01-01T12:34:43-06:00", + "cumulative_travel_distance": 77830, + "cumulative_travel_duration": 7783, + "duration": 300, + "end_time": "2023-01-01T12:39:43-06:00", + "late_arrival_duration": 30883, + "start_time": "2023-01-01T12:34:43-06:00", + "stop": { + "id": "s14", + "location": { + "lat": 35.961465, + "lon": -78.52748 + } }, - { - "arrival_time": "2023-01-01T12:34:43-06:00", - "cumulative_travel_distance": 77830, - "cumulative_travel_duration": 7783, - "duration": 300, - "end_time": "2023-01-01T12:39:43-06:00", - "late_arrival_duration": 30883, - "start_time": "2023-01-01T12:34:43-06:00", - "stop": { - "id": "s14", - "location": { - "lat": 35.961465, - "lon": -78.52748 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 22426, - "travel_duration": 2242 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 22426, + "travel_duration": 2242 + }, + { + "arrival_time": "2023-01-01T12:44:22-06:00", + "cumulative_travel_distance": 80624, + "cumulative_travel_duration": 8062, + "duration": 300, + "end_time": "2023-01-01T12:49:22-06:00", + "late_arrival_duration": 31462, + "start_time": "2023-01-01T12:44:22-06:00", + "stop": { + "id": "s19", + "location": { + "lat": 35.93663, + "lon": -78.522705 + } }, - { - "arrival_time": "2023-01-01T12:44:22-06:00", - "cumulative_travel_distance": 80624, - "cumulative_travel_duration": 8062, - "duration": 300, - "end_time": "2023-01-01T12:49:22-06:00", - "late_arrival_duration": 31462, - "start_time": "2023-01-01T12:44:22-06:00", - "stop": { - "id": "s19", - "location": { - "lat": 35.93663, - "lon": -78.522705 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 2794, - "travel_duration": 279 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 2794, + "travel_duration": 279 + }, + { + "arrival_time": "2023-01-01T13:54:40-06:00", + "cumulative_travel_distance": 119804, + "cumulative_travel_duration": 11980, + "duration": 300, + "end_time": "2023-01-01T13:59:40-06:00", + "late_arrival_duration": 35680, + "start_time": "2023-01-01T13:54:40-06:00", + "stop": { + "id": "s13", + "location": { + "lat": 35.88029, + "lon": -78.952142 + } }, - { - "arrival_time": "2023-01-01T13:54:40-06:00", - "cumulative_travel_distance": 119804, - "cumulative_travel_duration": 11980, - "duration": 300, - "end_time": "2023-01-01T13:59:40-06:00", - "late_arrival_duration": 35680, - "start_time": "2023-01-01T13:54:40-06:00", - "stop": { - "id": "s13", - "location": { - "lat": 35.88029, - "lon": -78.952142 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 39180, - "travel_duration": 3918 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 39180, + "travel_duration": 3918 + }, + { + "arrival_time": "2023-01-01T14:18:14-06:00", + "cumulative_travel_distance": 130935, + "cumulative_travel_duration": 13094, + "duration": 300, + "end_time": "2023-01-01T14:23:14-06:00", + "late_arrival_duration": 37094, + "start_time": "2023-01-01T14:18:14-06:00", + "stop": { + "id": "s20", + "location": { + "lat": 35.97414, + "lon": -78.995162 + } }, - { - "arrival_time": "2023-01-01T14:18:14-06:00", - "cumulative_travel_distance": 130935, - "cumulative_travel_duration": 13094, - "duration": 300, - "end_time": "2023-01-01T14:23:14-06:00", - "late_arrival_duration": 37094, - "start_time": "2023-01-01T14:18:14-06:00", - "stop": { - "id": "s20", - "location": { - "lat": 35.97414, - "lon": -78.995162 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 11131, - "travel_duration": 1113 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 11131, + "travel_duration": 1113 + }, + { + "arrival_time": "2023-01-01T14:37:18-06:00", + "cumulative_travel_distance": 139380, + "cumulative_travel_duration": 13938, + "duration": 300, + "end_time": "2023-01-01T14:42:18-06:00", + "late_arrival_duration": 38238, + "start_time": "2023-01-01T14:37:18-06:00", + "stop": { + "id": "s8", + "location": { + "lat": 36.039135, + "lon": -78.94658 + } }, - { - "arrival_time": "2023-01-01T14:37:18-06:00", - "cumulative_travel_distance": 139380, - "cumulative_travel_duration": 13938, - "duration": 300, - "end_time": "2023-01-01T14:42:18-06:00", - "late_arrival_duration": 38238, - "start_time": "2023-01-01T14:37:18-06:00", - "stop": { - "id": "s8", - "location": { - "lat": 36.039135, - "lon": -78.94658 - } - }, - "target_arrival_time": "2023-01-01T04:00:00-06:00", - "travel_distance": 8445, - "travel_duration": 844 + "target_arrival_time": "2023-01-01T04:00:00-06:00", + "travel_distance": 8445, + "travel_duration": 844 + }, + { + "arrival_time": "2023-01-01T15:37:38-06:00", + "cumulative_travel_distance": 172581, + "cumulative_travel_duration": 17258, + "end_time": "2023-01-01T15:37:38-06:00", + "start_time": "2023-01-01T15:37:38-06:00", + "stop": { + "id": "vehicle-1-end", + "location": { + "lat": 35.791729813680874, + "lon": -78.7401685145487 + } }, - { - "arrival_time": "2023-01-01T15:37:38-06:00", - "cumulative_travel_distance": 172581, - "cumulative_travel_duration": 17258, - "end_time": "2023-01-01T15:37:38-06:00", - "start_time": "2023-01-01T15:37:38-06:00", - "stop": { - "id": "vehicle-1-end", - "location": { - "lat": 35.791729813680874, - "lon": -78.7401685145487 - } - }, - "travel_distance": 33201, - "travel_duration": 3320 - } - ], - "route_duration": 20258, - "route_stops_duration": 3000, - "route_travel_distance": 172581, - "route_travel_duration": 17258 - } - ] - } - ], + "travel_distance": 33201, + "travel_duration": 3320 + } + ], + "route_duration": 20258, + "route_stops_duration": 3000, + "route_travel_distance": 172581, + "route_travel_duration": 17258 + } + ] + }, "statistics": { "result": { "custom": { @@ -620,9 +630,5 @@ "iterations": 50 }, "schema": "v1" - }, - "version": { - "nextroute": "VERSION", - "sdk": "VERSION" } } diff --git a/.nextmv/readme/python-nextroute/1.sh.golden b/.nextmv/readme/python-nextroute/1.sh.golden new file mode 100644 index 0000000..e69de29 diff --git a/.nextmv/readme/workflow-configuration.yml b/.nextmv/readme/workflow-configuration.yml index 978c060..3969ea2 100644 --- a/.nextmv/readme/workflow-configuration.yml +++ b/.nextmv/readme/workflow-configuration.yml @@ -95,6 +95,8 @@ apps: scripts: - name: 0.sh silent: true + - name: 1.sh + silent: true - name: python-ortools-costflow scripts: - name: 0.sh From edf7bbd44afe89880852b50524ea3fe8b1e624ba Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Thu, 17 Oct 2024 01:04:34 -0500 Subject: [PATCH 07/11] Replacements in golden file test --- .nextmv/golden/python-nextroute/main_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.nextmv/golden/python-nextroute/main_test.go b/.nextmv/golden/python-nextroute/main_test.go index ae65cb8..22be848 100644 --- a/.nextmv/golden/python-nextroute/main_test.go +++ b/.nextmv/golden/python-nextroute/main_test.go @@ -27,10 +27,10 @@ func TestGolden(t *testing.T) { "-solve_startsolutions", "1", }, TransientFields: []golden.TransientField{ - {Key: "$.version.sdk", Replacement: golden.StableVersion}, - {Key: "$.version.nextroute", Replacement: golden.StableVersion}, {Key: "$.statistics.result.duration", Replacement: golden.StableFloat}, {Key: "$.statistics.run.duration", Replacement: golden.StableFloat}, + {Key: "$.options.output", Replacement: "output.json"}, + {Key: "$.options.input", Replacement: "input.json"}, }, Thresholds: golden.Tresholds{ Float: 0.01, From e263e23bc5c2428978a42d81d31457d3b277e1d2 Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Thu, 17 Oct 2024 01:07:37 -0500 Subject: [PATCH 08/11] Add nesting for replacement key --- .nextmv/golden/python-nextroute/main_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.nextmv/golden/python-nextroute/main_test.go b/.nextmv/golden/python-nextroute/main_test.go index 22be848..ef7ff59 100644 --- a/.nextmv/golden/python-nextroute/main_test.go +++ b/.nextmv/golden/python-nextroute/main_test.go @@ -29,8 +29,8 @@ func TestGolden(t *testing.T) { TransientFields: []golden.TransientField{ {Key: "$.statistics.result.duration", Replacement: golden.StableFloat}, {Key: "$.statistics.run.duration", Replacement: golden.StableFloat}, - {Key: "$.options.output", Replacement: "output.json"}, - {Key: "$.options.input", Replacement: "input.json"}, + {Key: "$.options.nextmv.output", Replacement: "output.json"}, + {Key: "$.options.nextmv.input", Replacement: "input.json"}, }, Thresholds: golden.Tresholds{ Float: 0.01, From 00cab88b2733704d56408c7c192035b33fb1e1f2 Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Sat, 19 Oct 2024 00:57:49 -0500 Subject: [PATCH 09/11] Set the released version for nextroute --- python-nextroute/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-nextroute/requirements.txt b/python-nextroute/requirements.txt index fb8d8e8..b9a5490 100644 --- a/python-nextroute/requirements.txt +++ b/python-nextroute/requirements.txt @@ -1,2 +1,2 @@ -nextroute==1.8.0.dev2 +nextroute==1.8.0 nextmv==0.13.1 From e7207b74dcbb2e98ca8020b18be00ab78d810cb4 Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Mon, 21 Oct 2024 12:42:54 -0500 Subject: [PATCH 10/11] Use extract_from_dict to simplify option handling --- python-nextroute/main.py | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/python-nextroute/main.py b/python-nextroute/main.py index 4b12605..c0a0bd0 100644 --- a/python-nextroute/main.py +++ b/python-nextroute/main.py @@ -5,17 +5,16 @@ def main() -> None: """Entry point for the program.""" - options = nextmv.Options( + parameters = [ nextmv.Parameter("input", str, "", "Path to input file. Default is stdin.", False), nextmv.Parameter("output", str, "", "Path to output file. Default is stdout.", False), - nextmv.Parameter("solve_duration", int, 30, "Maximum duration, in seconds, of the solver.", False), - nextmv.Parameter("solve_parallelruns", int, -1, "Max number of parallel runs, -1 uses all resources.", False), - nextmv.Parameter("solve_iterations", int, -1, "Max number of iterations, -1 assumes no limit.", False), - nextmv.Parameter("solve_rundeterministically", bool, False, "Whether to run deterministically.", False), - nextmv.Parameter("solve_startsolutions", int, -1, "Number of solutions on top of initial ones.", False), - nextmv.Parameter("format_disable_progression", bool, False, "Disable the series data.", False), - # Add more options if needed. - ) + ] + + default_options = nextroute.Options() + for name, default_value in default_options.to_dict().items(): + parameters.append(nextmv.Parameter(name.lower(), type(default_value), default_value, name, False)) + + options = nextmv.Options(*parameters) input = nextmv.load_local(options=options, path=options.input) @@ -31,28 +30,11 @@ def solve(input: nextmv.Input, options: nextmv.Options) -> nextmv.Output: """Solves the given problem and returns the solution.""" nextroute_input = nextroute.schema.Input.from_dict(input.data) - nextroute_options = nextroute.Options( - solve=nextroute.ParallelSolveOptions( - duration=options.solve_duration, - iterations=options.solve_iterations, - parallel_runs=options.solve_parallelruns, - run_deterministically=options.solve_rundeterministically, - start_solutions=options.solve_startsolutions, - ), - format=nextroute.FormatOptions( - disable=nextroute.DisableFormatOptions( - progression=options.format_disable_progression, - ), - ), - ) - + nextroute_options = nextroute.Options.extract_from_dict(options.to_dict()) nextroute_output = nextroute.solve(nextroute_input, nextroute_options) return nextmv.Output( - options={ - "nextmv": options.to_dict(), - "nextroute": nextroute_options.to_dict(), - }, + options=options, solution=nextroute_output.solutions[0].to_dict(), statistics=nextroute_output.statistics.to_dict(), ) From 432ff7a27ff5229e2aea1d9666d32064810613f6 Mon Sep 17 00:00:00 2001 From: Sebastian Quintero Date: Mon, 21 Oct 2024 15:23:47 -0500 Subject: [PATCH 11/11] Fix golden expectations --- .../python-nextroute/inputs/input.json.golden | 122 ++++++------------ .nextmv/golden/python-nextroute/main_test.go | 4 +- python-nextroute/requirements.txt | 2 +- 3 files changed, 45 insertions(+), 83 deletions(-) diff --git a/.nextmv/golden/python-nextroute/inputs/input.json.golden b/.nextmv/golden/python-nextroute/inputs/input.json.golden index 0bf65a7..b0924fe 100644 --- a/.nextmv/golden/python-nextroute/inputs/input.json.golden +++ b/.nextmv/golden/python-nextroute/inputs/input.json.golden @@ -1,85 +1,47 @@ { "options": { - "nextmv": { - "format_disable_progression": true, - "input": "input.json", - "output": "output.json", - "solve_duration": 3, - "solve_iterations": 50, - "solve_parallelruns": 1, - "solve_rundeterministically": true, - "solve_startsolutions": 1 - }, - "nextroute": { - "check": { - "duration": 30, - "verbosity": "off" - }, - "format": { - "disable": { - "progression": true - } - }, - "model": { - "constraints": { - "disable": { - "attributes": false, - "capacities": [], - "capacity": false, - "distance_limit": false, - "groups": false, - "maximum_duration": false, - "maximum_stops": false, - "maximum_wait_stop": false, - "maximum_wait_vehicle": false, - "mixing_items": false, - "precedence": false, - "start_time_windows": false, - "vehicle_end_time": false, - "vehicle_start_time": false - }, - "enable": { - "cluster": false - } - }, - "objectives": { - "capacities": "", - "cluster": 0, - "early_arrival_penalty": 1, - "late_arrival_penalty": 1, - "min_stops": 1, - "travel_duration": 0, - "unplanned_penalty": 1, - "vehicle_activation_penalty": 1, - "vehicles_duration": 1 - }, - "properties": { - "disable": { - "duration_groups": false, - "durations": false, - "initial_solution": false, - "stop_duration_multipliers": false - } - }, - "validate": { - "disable": { - "resources": false, - "start_time": false - }, - "enable": { - "matrix": false, - "matrix_asymmetry_tolerance": 20 - } - } - }, - "solve": { - "duration": 3, - "iterations": 50, - "parallel_runs": 1, - "run_deterministically": true, - "start_solutions": 1 - } - } + "check_duration": 30, + "check_verbosity": "off", + "format_disable_progression": true, + "input": "input.json", + "model_constraints_disable_attributes": false, + "model_constraints_disable_capacities": [], + "model_constraints_disable_capacity": false, + "model_constraints_disable_distancelimit": false, + "model_constraints_disable_groups": false, + "model_constraints_disable_maximumduration": false, + "model_constraints_disable_maximumstops": false, + "model_constraints_disable_maximumwaitstop": false, + "model_constraints_disable_maximumwaitvehicle": false, + "model_constraints_disable_mixingitems": false, + "model_constraints_disable_precedence": false, + "model_constraints_disable_starttimewindows": false, + "model_constraints_disable_vehicleendtime": false, + "model_constraints_disable_vehiclestarttime": false, + "model_constraints_enable_cluster": false, + "model_objectives_capacities": "", + "model_objectives_cluster": 0, + "model_objectives_earlyarrivalpenalty": 1, + "model_objectives_latearrivalpenalty": 1, + "model_objectives_minstops": 1, + "model_objectives_travelduration": 0, + "model_objectives_unplannedpenalty": 1, + "model_objectives_vehicleactivationpenalty": 1, + "model_objectives_vehiclesduration": 1, + "model_properties_disable_durationgroups": false, + "model_properties_disable_durations": false, + "model_properties_disable_initialsolution": false, + "model_properties_disable_stopdurationmultipliers": false, + "model_validate_disable_resources": false, + "model_validate_disable_starttime": false, + "model_validate_enable_matrix": false, + "model_validate_enable_matrixasymmetrytolerance": 20, + "output": "output.json", + "solve_duration": 3, + "solve_iterations": 50, + "solve_parallelruns": 1, + "solve_rundeterministically": true, + "solve_startsolutions": 1 }, "solution": { "objective": { diff --git a/.nextmv/golden/python-nextroute/main_test.go b/.nextmv/golden/python-nextroute/main_test.go index ef7ff59..22be848 100644 --- a/.nextmv/golden/python-nextroute/main_test.go +++ b/.nextmv/golden/python-nextroute/main_test.go @@ -29,8 +29,8 @@ func TestGolden(t *testing.T) { TransientFields: []golden.TransientField{ {Key: "$.statistics.result.duration", Replacement: golden.StableFloat}, {Key: "$.statistics.run.duration", Replacement: golden.StableFloat}, - {Key: "$.options.nextmv.output", Replacement: "output.json"}, - {Key: "$.options.nextmv.input", Replacement: "input.json"}, + {Key: "$.options.output", Replacement: "output.json"}, + {Key: "$.options.input", Replacement: "input.json"}, }, Thresholds: golden.Tresholds{ Float: 0.01, diff --git a/python-nextroute/requirements.txt b/python-nextroute/requirements.txt index b9a5490..556f029 100644 --- a/python-nextroute/requirements.txt +++ b/python-nextroute/requirements.txt @@ -1,2 +1,2 @@ -nextroute==1.8.0 +nextroute==1.8.1 nextmv==0.13.1