From 81814e6a09c58943618fbf78ad8fde567c9e6857 Mon Sep 17 00:00:00 2001 From: Arnab Animesh Das <arnabanimesh@gmail.com> Date: Thu, 30 Jan 2025 16:04:29 +0530 Subject: [PATCH] Update python notebook and minor formatting --- examples/notebook/routing/cvrp_reload.ipynb | 8 ++++---- ortools/routing/samples/cvrp_reload.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/notebook/routing/cvrp_reload.ipynb b/examples/notebook/routing/cvrp_reload.ipynb index 82bd9c5375..413e72cfb7 100644 --- a/examples/notebook/routing/cvrp_reload.ipynb +++ b/examples/notebook/routing/cvrp_reload.ipynb @@ -401,7 +401,7 @@ " for vehicle_id in range(data[\"num_vehicles\"]):\n", " index = routing.Start(vehicle_id)\n", " plan_output = f\"Route for vehicle {vehicle_id}:\\n\"\n", - " load_var = 0\n", + " load_value = 0\n", " distance = 0\n", " while not routing.IsEnd(index):\n", " time_var = time_dimension.CumulVar(index)\n", @@ -416,7 +416,7 @@ " # capacity dimension TransitVar is negative at reload stations during replenishment\n", " # don't want to consider those values when calculating the total load of the route\n", " # hence only considering the positive values\n", - " load_var += max(0,capacity_dimension.GetTransitValue(previous_index,index,vehicle_id))\n", + " load_value += max(0, capacity_dimension.GetTransitValue(previous_index, index, vehicle_id))\n", " time_var = time_dimension.CumulVar(index)\n", " plan_output += (\n", " f\" {manager.IndexToNode(index)} \"\n", @@ -424,11 +424,11 @@ " f\"Time({assignment.Min(time_var)},{assignment.Max(time_var)})\\n\"\n", " )\n", " plan_output += f\"Distance of the route: {distance}m\\n\"\n", - " plan_output += f\"Load of the route: {load_var}\\n\"\n", + " plan_output += f\"Load of the route: {load_value}\\n\"\n", " plan_output += f\"Time of the route: {assignment.Min(time_var)}min\\n\"\n", " print(plan_output)\n", " total_distance += distance\n", - " total_load += load_var\n", + " total_load += load_value\n", " total_time += assignment.Min(time_var)\n", " print(f\"Total Distance of all routes: {total_distance}m\")\n", " print(f\"Total Load of all routes: {total_load}\")\n", diff --git a/ortools/routing/samples/cvrp_reload.py b/ortools/routing/samples/cvrp_reload.py index fb51127560..f77076991e 100755 --- a/ortools/routing/samples/cvrp_reload.py +++ b/ortools/routing/samples/cvrp_reload.py @@ -349,7 +349,7 @@ def print_solution( # capacity dimension TransitVar is negative at reload stations during replenishment # don't want to consider those values when calculating the total load of the route # hence only considering the positive values - load_value += max(0,capacity_dimension.GetTransitValue(previous_index,index,vehicle_id)) + load_value += max(0, capacity_dimension.GetTransitValue(previous_index, index, vehicle_id)) time_var = time_dimension.CumulVar(index) plan_output += ( f" {manager.IndexToNode(index)} "