diff --git a/VRPTW.ipynb b/VRPTW.ipynb
new file mode 100644
index 0000000..e1193a3
--- /dev/null
+++ b/VRPTW.ipynb
@@ -0,0 +1,1403 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 201,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "exists\n"
+ ]
+ }
+ ],
+ "source": [
+ "# import libraries\n",
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "from math import sin, cos, sqrt, atan2, radians\n",
+ "import os.path\n",
+ "\n",
+ "\n",
+ "# define functions\n",
+ "%run distanceMatrix.py\n",
+ "# instance size\n",
+ "N=30\n",
+ "# number of trucks\n",
+ "K=10\n",
+ "# maximum tour time\n",
+ "T=int(10 * 60) # 4.5h = 270min\n",
+ "\n",
+ "# load the data and files\n",
+ "clientsFile = 'clients'+str(N)+'.csv'\n",
+ "# 0 =7am\n",
+ "# 600 =5pm\n",
+ "# noon =300\n",
+ "# 1pm =360\n",
+ "# 4pm =540\n",
+ "clients = pd.read_csv(clientsFile)\n",
+ "wpfsFile = 'WPF.csv'\n",
+ "citiesFile = 'belgian-cities-geocoded.csv'\n",
+ "cities = pd.read_csv(citiesFile)\n",
+ "distanceMatrixFile = 'distanceMatrix'+str(N)+'.csv'\n",
+ "\n",
+ "\n",
+ "# get the matrix and save it if necessary\n",
+ "if os.path.isfile(distanceMatrixFile):\n",
+ " print('exists')\n",
+ " distanceMatrix = pd.read_csv(distanceMatrixFile).to_numpy()\n",
+ "else:\n",
+ " print('does not exist')\n",
+ " distanceMatrix = createDistanceMatrix(clientsFile, citiesFile, wpfsFile)\n",
+ " pd.DataFrame(distanceMatrix).to_csv(distanceMatrixFile, index=False) \n",
+ "\n",
+ "# get coordinates \n",
+ "coords = [(50.9338827,4.5605498)] # depot\n",
+ "for client in clients['Place']:\n",
+ " idx = cities.index[cities['name']==client].tolist()[0]\n",
+ " coords.append((cities.iloc[idx]['lat'],cities.iloc[idx]['lng']))\n",
+ "\n",
+ "# get timewindows\n",
+ "timeWindows=[(0,600)] #depot\n",
+ "for id in clients['ClientID']:\n",
+ " opening=clients['opening'][id-1]\n",
+ " closing=clients['closing'][id-1]\n",
+ " opening=int(opening)\n",
+ " closing=int(closing)\n",
+ " timeWindow=(opening,closing)\n",
+ " timeWindows.append(timeWindow)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 202,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Objective: 4071\n",
+ "Route for vehicle 0:\n",
+ "0 Time(0,0) -> 3 Time(44,44) -> 27 Time(162,162) -> 12 Time(263,263) -> 1 Time(294,294) -> 0 Time(334,334)\n",
+ "Time of the route: 334min\n",
+ "\n",
+ "Route for vehicle 1:\n",
+ "0 Time(0,0) -> 22 Time(44,44) -> 9 Time(219,219) -> 18 Time(403,403) -> 13 Time(511,511) -> 0 Time(578,578)\n",
+ "Time of the route: 578min\n",
+ "\n",
+ "Route for vehicle 2:\n",
+ "0 Time(0,0) -> 10 Time(62,62) -> 29 Time(287,287) -> 28 Time(440,440) -> 0 Time(590,590)\n",
+ "Time of the route: 590min\n",
+ "\n",
+ "Route for vehicle 3:\n",
+ "0 Time(0,0) -> 4 Time(45,45) -> 19 Time(242,242) -> 11 Time(449,449) -> 7 Time(544,544) -> 0 Time(562,562)\n",
+ "Time of the route: 562min\n",
+ "\n",
+ "Route for vehicle 4:\n",
+ "0 Time(0,0) -> 26 Time(121,127) -> 8 Time(360,360) -> 0 Time(426,426)\n",
+ "Time of the route: 426min\n",
+ "\n",
+ "Route for vehicle 5:\n",
+ "0 Time(0,0) -> 24 Time(72,72) -> 25 Time(218,218) -> 17 Time(394,394) -> 0 Time(452,452)\n",
+ "Time of the route: 452min\n",
+ "\n",
+ "Route for vehicle 6:\n",
+ "0 Time(0,0) -> 30 Time(67,67) -> 21 Time(221,221) -> 6 Time(290,290) -> 15 Time(386,386) -> 2 Time(574,574) -> 0 Time(589,589)\n",
+ "Time of the route: 589min\n",
+ "\n",
+ "Route for vehicle 7:\n",
+ "0 Time(0,0) -> 0 Time(0,0)\n",
+ "Time of the route: 0min\n",
+ "\n",
+ "Route for vehicle 8:\n",
+ "0 Time(133,133) -> 20 Time(215,215) -> 23 Time(360,360) -> 0 Time(383,383)\n",
+ "Time of the route: 383min\n",
+ "\n",
+ "Route for vehicle 9:\n",
+ "0 Time(0,0) -> 14 Time(44,44) -> 5 Time(135,135) -> 16 Time(288,288) -> 0 Time(356,356)\n",
+ "Time of the route: 356min\n",
+ "\n",
+ "Total time of all routes: 4270min\n"
+ ]
+ }
+ ],
+ "source": [
+ "# build the model and solve it\n",
+ "from ortools.constraint_solver import routing_enums_pb2\n",
+ "from ortools.constraint_solver import pywrapcp\n",
+ "\n",
+ "def create_data_model():\n",
+ " \"\"\"Stores the data for the problem.\"\"\"\n",
+ " data = {}\n",
+ " # data['time_matrix'] = [\n",
+ " # [0,7.07,7.07,7.07,7.07],\n",
+ " # [7.07,0,10,2*7.07,10],\n",
+ " # [7.07,10,0,10,2*7.07],\n",
+ " # [7.07,2*7.07,10,0,10],\n",
+ " # [7.07,10,2*7.07,10,0]\n",
+ " # ]\n",
+ " data['time_matrix'] = distanceMatrix\n",
+ " data['time_windows'] = timeWindows\n",
+ " # data['time_windows'] = [\n",
+ " # (0, 600), # depot\n",
+ " # (0, 600), # 1\n",
+ " # (0, 600), # 2\n",
+ " # (0, 600), # 3\n",
+ " # (0, 600), # 4\n",
+ " # (0, 600)\n",
+ " # ]\n",
+ " data['num_vehicles'] = K\n",
+ " data['depot'] = 0\n",
+ " return data\n",
+ "\n",
+ "def print_solution(data, manager, routing, solution):\n",
+ " \"\"\"Prints solution on console.\"\"\"\n",
+ " print(f'Objective: {solution.ObjectiveValue()}')\n",
+ " time_dimension = routing.GetDimensionOrDie('Time')\n",
+ " total_time = 0\n",
+ " for vehicle_id in range(data['num_vehicles']):\n",
+ " index = routing.Start(vehicle_id)\n",
+ " plan_output = 'Route for vehicle {}:\\n'.format(vehicle_id)\n",
+ " while not routing.IsEnd(index):\n",
+ " time_var = time_dimension.CumulVar(index)\n",
+ " plan_output += '{0} Time({1},{2}) -> '.format(\n",
+ " manager.IndexToNode(index), solution.Min(time_var),\n",
+ " solution.Max(time_var))\n",
+ " index = solution.Value(routing.NextVar(index))\n",
+ " time_var = time_dimension.CumulVar(index)\n",
+ " plan_output += '{0} Time({1},{2})\\n'.format(manager.IndexToNode(index),\n",
+ " solution.Min(time_var),\n",
+ " solution.Max(time_var))\n",
+ " plan_output += 'Time of the route: {}min\\n'.format(\n",
+ " solution.Min(time_var))\n",
+ " print(plan_output)\n",
+ " total_time += solution.Min(time_var)\n",
+ " print('Total time of all routes: {}min'.format(total_time))\n",
+ "\n",
+ "def get_cumul_data(solution, routing, dimension):\n",
+ " \"\"\"Get cumulative data from a dimension and store it in an array.\"\"\"\n",
+ " # Returns an array cumul_data whose i,j entry contains the minimum and\n",
+ " # maximum of CumulVar for the dimension at the jth node on route :\n",
+ " # - cumul_data[i][j][0] is the minimum.\n",
+ " # - cumul_data[i][j][1] is the maximum.\n",
+ "\n",
+ " cumul_data = []\n",
+ " for route_nbr in range(routing.vehicles()):\n",
+ " route_data = []\n",
+ " index = routing.Start(route_nbr)\n",
+ " dim_var = dimension.CumulVar(index)\n",
+ " route_data.append([solution.Min(dim_var), solution.Max(dim_var)])\n",
+ " while not routing.IsEnd(index):\n",
+ " index = solution.Value(routing.NextVar(index))\n",
+ " dim_var = dimension.CumulVar(index)\n",
+ " route_data.append([solution.Min(dim_var), solution.Max(dim_var)])\n",
+ " cumul_data.append(route_data)\n",
+ " return cumul_data\n",
+ "\n",
+ "def get_routes(solution, routing, manager):\n",
+ " \"\"\"Get vehicle routes from a solution and store them in an array.\"\"\"\n",
+ " # Get vehicle routes and store them in a two dimensional array whose\n",
+ " # i,j entry is the jth location visited by vehicle i along its route.\n",
+ " routes = []\n",
+ " for route_nbr in range(routing.vehicles()):\n",
+ " index = routing.Start(route_nbr)\n",
+ " route = [manager.IndexToNode(index)]\n",
+ " while not routing.IsEnd(index):\n",
+ " index = solution.Value(routing.NextVar(index))\n",
+ " route.append(manager.IndexToNode(index))\n",
+ " routes.append(route)\n",
+ " return routes\n",
+ "\n",
+ "########################################\n",
+ "# Instantiate the data problem.\n",
+ "data = create_data_model()\n",
+ "\n",
+ "# Create the routing index manager.\n",
+ "manager = pywrapcp.RoutingIndexManager(len(data['time_matrix']),data['num_vehicles'], data['depot'])\n",
+ "\n",
+ "# Create Routing Model.\n",
+ "routing = pywrapcp.RoutingModel(manager)\n",
+ "\n",
+ "# Create and register a transit callback.\n",
+ "def time_callback(from_index, to_index):\n",
+ " \"\"\"Returns the travel time between the two nodes.\"\"\"\n",
+ " # Convert from routing variable Index to time matrix NodeIndex.\n",
+ " from_node = manager.IndexToNode(from_index)\n",
+ " to_node = manager.IndexToNode(to_index)\n",
+ " return data['time_matrix'][from_node][to_node]\n",
+ "\n",
+ "transit_callback_index = routing.RegisterTransitCallback(time_callback)\n",
+ "\n",
+ "# Define cost of each arc.\n",
+ "routing.SetArcCostEvaluatorOfAllVehicles(transit_callback_index)\n",
+ "\n",
+ "# Add Time Windows constraint.\n",
+ "time = 'Time'\n",
+ "routing.AddDimension(\n",
+ " transit_callback_index,\n",
+ " 30, # allow waiting time\n",
+ " T, # maximum time per vehicle\n",
+ " False, # Don't force start cumul to zero.\n",
+ " time)\n",
+ "time_dimension = routing.GetDimensionOrDie(time)\n",
+ "# Add time window constraints for each location except depot.\n",
+ "for location_idx, time_window in enumerate(data['time_windows']):\n",
+ " if location_idx == data['depot']:\n",
+ " continue\n",
+ " index = manager.NodeToIndex(location_idx)\n",
+ " time_dimension.CumulVar(index).SetRange(time_window[0], time_window[1])\n",
+ "# Add time window constraints for each vehicle start node.\n",
+ "depot_idx = data['depot']\n",
+ "for vehicle_id in range(data['num_vehicles']):\n",
+ " index = routing.Start(vehicle_id)\n",
+ " time_dimension.CumulVar(index).SetRange(\n",
+ " data['time_windows'][depot_idx][0],\n",
+ " data['time_windows'][depot_idx][1])\n",
+ "\n",
+ "# Instantiate route start and end times to produce feasible times.\n",
+ "for i in range(data['num_vehicles']):\n",
+ " routing.AddVariableMinimizedByFinalizer(\n",
+ " time_dimension.CumulVar(routing.Start(i)))\n",
+ " routing.AddVariableMinimizedByFinalizer(\n",
+ " time_dimension.CumulVar(routing.End(i)))\n",
+ "\n",
+ "# Setting first solution heuristic.\n",
+ "search_parameters = pywrapcp.DefaultRoutingSearchParameters()\n",
+ "search_parameters.first_solution_strategy = (\n",
+ " routing_enums_pb2.FirstSolutionStrategy.AUTOMATIC)\n",
+ "# maximum computation time\n",
+ "search_parameters.time_limit.seconds = 30\n",
+ "\n",
+ "# search_parameters = pywrapcp.DefaultRoutingSearchParameters()\n",
+ "# search_parameters.local_search_metaheuristic = (\n",
+ "# routing_enums_pb2.LocalSearchMetaheuristic.AUTOMATIC)\n",
+ "# search_parameters.time_limit.seconds = 60\n",
+ "# search_parameters.log_search = True\n",
+ "\n",
+ "\n",
+ "# Solve the problem.\n",
+ "solution = routing.SolveWithParameters(search_parameters)\n",
+ "\n",
+ "# Print solution on console.\n",
+ "if solution:\n",
+ " print_solution(data, manager, routing, solution)\n",
+ " # get solution windows\n",
+ " solution_windows=get_cumul_data(solution,routing,time_dimension)\n",
+ " solution_routes=get_routes(solution,routing,manager)\n",
+ " \n",
+ "else:\n",
+ " print(\"INFEASIBLE or RAN OUT OF COMPUTATION TIME\") "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 210,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
Make this Notebook Trusted to load map: File -> Trust Notebook
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 210,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Map the solution\n",
+ "import folium\n",
+ "\n",
+ "# list of colors to be used in the map\n",
+ "colors = ['red', 'blue', 'green', 'purple', 'orange', 'darkred','black', 'beige', 'darkblue', 'darkgreen', 'cadetblue', 'darkpurple', 'white', 'pink', 'lightblue', 'lightgreen', 'gray', 'black', 'lightgray','red', 'blue', 'green', 'purple', 'orange', 'darkred','lightred', 'beige', 'darkblue', 'darkgreen', 'cadetblue', 'darkpurple', 'white', 'pink', 'lightblue', 'lightgreen', 'gray', 'black', 'lightgray']\n",
+ "\n",
+ "# zoom in on Belgium\n",
+ "map = folium.Map(location=[51,5], zoom_start = 8)\n",
+ "\n",
+ "# visualize the routes\n",
+ "for idx,route in enumerate(solution_routes):\n",
+ " route_coords=[]\n",
+ " for node in route:\n",
+ " route_coords.append(coords[node])\n",
+ " folium.PolyLine(route_coords,weight=5,color=colors[idx],popup=route).add_to(map)\n",
+ "\n",
+ "# visualize the nodes\n",
+ "for idx,coord in enumerate(coords):\n",
+ " if(idx == 0):\n",
+ " folium.Marker(\n",
+ " location=[coord[0], coord[1]],\n",
+ " popup='Kampenhout-0',\n",
+ " icon=folium.Icon(color='black',icon=\"home\"),\n",
+ " ).add_to(map)\n",
+ " else:\n",
+ " colors = ['green','lightblue','cadetblue','orange','lightgray','red']\n",
+ " folium.Marker(\n",
+ " location=[coord[0], coord[1]],\n",
+ " popup=clients['Place'][idx-1]+'-'+str(clients['ActionType'][idx-1]),\n",
+ " icon=folium.Icon(color=colors[clients['ActionType'][idx-1]-1], icon='', prefix='fa')\n",
+ " ).add_to(map)\n",
+ "\n",
+ "map"
+ ]
+ }
+ ],
+ "metadata": {
+ "interpreter": {
+ "hash": "1ebd53531a265123f8d6b96a0394cf5c6958acea593669dc45d7411847354196"
+ },
+ "kernelspec": {
+ "display_name": "Python 3.9.7 ('ip1')",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.9.7"
+ },
+ "orig_nbformat": 4
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/clients10.csv b/clients10.csv
new file mode 100644
index 0000000..a4e0f49
--- /dev/null
+++ b/clients10.csv
@@ -0,0 +1,11 @@
+ClientID,ClientName,ContainerSize,Waste,ActionType,Additional,opening,closing,Place
+1,bookstore,20,general,3,0,0,600,Antwerpen
+2,bookstore,15,general,3,0,0,600,Grimbergen
+3,fish shop,20,general,4,0,0,600,Leuven
+4,restaurant,18,general,4,0,0,300,Mechelen
+5,garage,15,general,4,0,0,600,Zaventem
+6,construction,20,construction,5,0,0,600,Gent
+7,bookstore,20,general,3,0,0,600,Sint-Katelijne-Waver
+8,lab,18,dangerous,6,0,360,540,Hasselt
+9,vegetables,20,general,4,0,0,600,Glain
+10,construction,20,construction,5,0,0,600,Boutersem
\ No newline at end of file
diff --git a/clients30.csv b/clients30.csv
new file mode 100644
index 0000000..289a71b
--- /dev/null
+++ b/clients30.csv
@@ -0,0 +1,31 @@
+ClientID,ClientName,ContainerSize,Waste,ActionType,Additional,opening,closing,Place
+1,bookstore,20,general,3,0,0,600,Antwerpen
+2,bookstore,15,general,3,0,0,600,Grimbergen
+3,fish shop,20,general,4,0,0,600,Leuven
+4,restaurant,18,general,4,0,0,300,Mechelen
+5,garage,15,general,4,0,0,600,Zaventem
+6,construction,20,construction,5,0,0,600,Gent
+7,bookstore,20,general,3,0,0,600,Sint-Katelijne-Waver
+8,lab,18,dangerous,6,0,360,540,Hasselt
+9,vegetables,20,general,4,0,0,600,Glain
+10,construction,20,construction,5,0,0,600,Boutersem
+11,fish shop,18,general,4,0,0,600,Boom
+12,electronics,20,general,1,0,0,600,Duffel
+13,vegetables,20,general,4,15,0,600,Brussel
+14,restaurant,15,general,4,0,0,300,Leuven
+15,garage,20,general,4,0,0,600,Brugge
+16,bookstore,20,general,3,0,0,600,Zonhoven
+17,bookstore,20,general,3,0,0,600,Mol
+18,fish shop,20,general,4,0,0,600,Herentals
+19,restaurant,18,general,4,15,0,300,Veurne
+20,garage,17,general,4,0,0,600,Brussel
+21,construction,20,construction,5,0,0,600,Zelzate
+22,bookstore,20,general,4,0,0,600,Leuven
+23,lab,18,dangerous,6,0,360,540,Aarschot
+24,vegetables,20,general,2,15,0,600,Diest
+25,construction,20,construction,5,0,0,600,Tienen
+26,restaurant,18,general,4,0,0,300,Liers
+27,electronics,20,general,4,0,0,600,Geel
+28,vegetables,20,general,4,0,0,600,Kortrijk
+29,restaurant,20,general,4,0,0,300,Ieper
+30,garage,20,general,4,0,0,600,Louvain-La-Neuve
\ No newline at end of file
diff --git a/clients5.csv b/clients5.csv
new file mode 100644
index 0000000..ee4780e
--- /dev/null
+++ b/clients5.csv
@@ -0,0 +1,6 @@
+ClientID,ClientName,ContainerSize,Waste,ActionType,Additional,opening,closing,Place
+1,bookstore,20,general,3,0,0,600,Antwerpen
+2,bookstore,15,general,3,0,0,600,Grimbergen
+3,fish shop,20,general,4,0,0,600,Leuven
+4,restaurant,18,general,4,0,0,300,Mechelen
+5,garage,15,general,4,0,0,600,Zaventem
\ No newline at end of file
diff --git a/clientsTest copy.csv b/clientsTest copy.csv
new file mode 100644
index 0000000..5b8b172
--- /dev/null
+++ b/clientsTest copy.csv
@@ -0,0 +1,57 @@
+ClientID,ClientName,ContainerSize,Waste,Place,ActionType,Additional
+1,bookstore,20,paper,Antwerpen,3,
+13,vegetables,20,general,Veurne,4,15
+18,fish shop,20,general,Herentals,4,
+8,labo,18,dangerous,Leuven,6,
+12,electronics,20,general,Duffel,1,
+24,vegetables,20,general,Diest,2,
+25,construction,20,construction,Zelzate,5,
+69,shit,15,dangerous,Antwerpen,6
+1,bookstore,20,paper,Antwerpen,3,
+13,vegetables,20,general,Veurne,4,15
+18,fish shop,20,general,Herentals,4,
+8,labo,18,dangerous,Leuven,6,
+12,electronics,20,general,Duffel,1,
+24,vegetables,20,general,Diest,2,
+25,construction,20,construction,Zelzate,5,
+69,shit,15,dangerous,Antwerpen,6
+1,bookstore,20,paper,Antwerpen,3,
+13,vegetables,20,general,Veurne,4,15
+18,fish shop,20,general,Herentals,4,
+8,labo,18,dangerous,Leuven,6,
+12,electronics,20,general,Duffel,1,
+24,vegetables,20,general,Diest,2,
+25,construction,20,construction,Zelzate,5,
+69,shit,15,dangerous,Antwerpen,6
+1,bookstore,20,paper,Antwerpen,3,
+13,vegetables,20,general,Veurne,4,15
+18,fish shop,20,general,Herentals,4,
+8,labo,18,dangerous,Leuven,6,
+12,electronics,20,general,Duffel,1,
+24,vegetables,20,general,Diest,2,
+25,construction,20,construction,Zelzate,5,
+69,shit,15,dangerous,Antwerpen,6
+1,bookstore,20,paper,Antwerpen,3,
+13,vegetables,20,general,Veurne,4,15
+18,fish shop,20,general,Herentals,4,
+8,labo,18,dangerous,Leuven,6,
+12,electronics,20,general,Duffel,1,
+24,vegetables,20,general,Diest,2,
+25,construction,20,construction,Zelzate,5,
+69,shit,15,dangerous,Antwerpen,6
+1,bookstore,20,paper,Antwerpen,3,
+13,vegetables,20,general,Veurne,4,15
+18,fish shop,20,general,Herentals,4,
+8,labo,18,dangerous,Leuven,6,
+12,electronics,20,general,Duffel,1,
+24,vegetables,20,general,Diest,2,
+25,construction,20,construction,Zelzate,5,
+69,shit,15,dangerous,Antwerpen,6
+1,bookstore,20,paper,Antwerpen,3,
+13,vegetables,20,general,Veurne,4,15
+18,fish shop,20,general,Herentals,4,
+8,labo,18,dangerous,Leuven,6,
+12,electronics,20,general,Duffel,1,
+24,vegetables,20,general,Diest,2,
+25,construction,20,construction,Zelzate,5,
+69,shit,15,dangerous,Antwerpen,6
\ No newline at end of file
diff --git a/clientsTest.csv b/clientsTest.csv
index f20eff3..4d52752 100644
--- a/clientsTest.csv
+++ b/clientsTest.csv
@@ -1,57 +1,9 @@
-ClientID,ClientName,ContainerSize,Waste,Place,ActionType,Additional
-1,bookstore,20,paper,Antwerpen,3,
-13,vegetables,20,general,Veurne,4,15
-18,fish shop,20,general,Herentals,4,
-8,labo,18,dangerous,Leuven,6,
-12,electronics,20,general,Duffel,1,
-24,vegetables,20,general,Diest,2,
-25,construction,20,construction,Zelzate,5,
-69,shit,15,dangerous,Antwerpen,6
-1,bookstore,20,paper,Antwerpen,3,
-13,vegetables,20,general,Veurne,4,15
-18,fish shop,20,general,Herentals,4,
-8,labo,18,dangerous,Leuven,6,
-12,electronics,20,general,Duffel,1,
-24,vegetables,20,general,Diest,2,
-25,construction,20,construction,Zelzate,5,
-69,shit,15,dangerous,Antwerpen,6
-1,bookstore,20,paper,Antwerpen,3,
-13,vegetables,20,general,Veurne,4,15
-18,fish shop,20,general,Herentals,4,
-8,labo,18,dangerous,Leuven,6,
-12,electronics,20,general,Duffel,1,
-24,vegetables,20,general,Diest,2,
-25,construction,20,construction,Zelzate,5,
-69,shit,15,dangerous,Antwerpen,6
-1,bookstore,20,paper,Antwerpen,3,
-13,vegetables,20,general,Veurne,4,15
-18,fish shop,20,general,Herentals,4,
-8,labo,18,dangerous,Leuven,6,
-12,electronics,20,general,Duffel,1,
-24,vegetables,20,general,Diest,2,
-25,construction,20,construction,Zelzate,5,
-69,shit,15,dangerous,Antwerpen,6
-1,bookstore,20,paper,Antwerpen,3,
-13,vegetables,20,general,Veurne,4,15
-18,fish shop,20,general,Herentals,4,
-8,labo,18,dangerous,Leuven,6,
-12,electronics,20,general,Duffel,1,
-24,vegetables,20,general,Diest,2,
-25,construction,20,construction,Zelzate,5,
-69,shit,15,dangerous,Antwerpen,6
-1,bookstore,20,paper,Antwerpen,3,
-13,vegetables,20,general,Veurne,4,15
-18,fish shop,20,general,Herentals,4,
-8,labo,18,dangerous,Leuven,6,
-12,electronics,20,general,Duffel,1,
-24,vegetables,20,general,Diest,2,
-25,construction,20,construction,Zelzate,5,
-69,shit,15,dangerous,Antwerpen,6
-1,bookstore,20,paper,Antwerpen,3,
-13,vegetables,20,general,Veurne,4,15
-18,fish shop,20,general,Herentals,4,
-8,labo,18,dangerous,Leuven,6,
-12,electronics,20,general,Duffel,1,
-24,vegetables,20,general,Diest,2,
-25,construction,20,construction,Zelzate,5,
-69,shit,15,dangerous,Antwerpen,6
\ No newline at end of file
+ClientID,ClientName,ContainerSize,Waste,Place,ActionType,Additional,Opening,Closing
+1,bookstore,20,paper,Antwerpen,3,0,0,600
+13,vegetables,20,general,Veurne,4,15,0,600
+18,fish shop,20,general,Herentals,4,0,0,600
+8,labo,18,dangerous,Leuven,6,0,0,600
+12,electronics,20,general,Duffel,1,0,0,600
+24,vegetables,20,general,Diest,2,0,0,600
+25,construction,20,construction,Zelzate,5,0,0,600
+69,shit,15,dangerous,Antwerpen,6,0,0,600
\ No newline at end of file
diff --git a/clientsTest2.csv b/clientsTest2.csv
deleted file mode 100644
index eb03a9e..0000000
--- a/clientsTest2.csv
+++ /dev/null
@@ -1,4 +0,0 @@
-ClientID,ClientName,ContainerSize,Waste,Place,ActionType,Additional
-12,electronics,20,general,Brussel,4,
-24,vegetables,20,dangerous,Leuven,4,
-1,bookstore,20,paper,Antwerpen,4,
\ No newline at end of file
diff --git a/distanceMatrix.csv b/distanceMatrix.csv
deleted file mode 100644
index dccdbb3..0000000
--- a/distanceMatrix.csv
+++ /dev/null
@@ -1,58 +0,0 @@
-,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56
-0,0.0,137.0,206.0,71.0,160.0,40.0,57.0,108.0,84.0,137.0,206.0,71.0,160.0,40.0,57.0,108.0,84.0,137.0,206.0,71.0,160.0,40.0,57.0,108.0,84.0,137.0,206.0,71.0,160.0,40.0,57.0,108.0,84.0,137.0,206.0,71.0,160.0,40.0,57.0,108.0,84.0,137.0,206.0,71.0,160.0,40.0,57.0,108.0,84.0,137.0,206.0,71.0,160.0,40.0,57.0,108.0,84.0
-1,40.0,0.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0
-2,194.0,274.0,0.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0
-3,76.0,142.0,233.0,0.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0
-4,13.0,199.0,326.0,206.0,0.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0
-5,22.0,31.0,200.0,80.0,45.0,0.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0
-6,91.0,144.0,235.0,119.0,117.0,93.0,0.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0
-7,117.0,187.0,158.0,163.0,160.0,134.0,192.0,0.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0
-8,40.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,0.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0
-9,40.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,0.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0
-10,194.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,0.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0
-11,76.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,0.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0
-12,13.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,0.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0
-13,22.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,0.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0
-14,91.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,0.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0
-15,117.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,0.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0
-16,40.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,0.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0
-17,40.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,0.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0
-18,194.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,0.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0
-19,76.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,0.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0
-20,13.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,0.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0
-21,22.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,0.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0
-22,91.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,0.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0
-23,117.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,0.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0
-24,40.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,0.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0
-25,40.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,0.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0
-26,194.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,0.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0
-27,76.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,0.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0
-28,13.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,0.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0
-29,22.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,0.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0
-30,91.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,0.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0
-31,117.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,0.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0
-32,40.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,0.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0
-33,40.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,0.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0
-34,194.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,0.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0
-35,76.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,0.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0
-36,13.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,0.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0
-37,22.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,0.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0
-38,91.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,0.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0
-39,117.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,0.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0
-40,40.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,0.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0
-41,40.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,0.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0
-42,194.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,0.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0
-43,76.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,0.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0
-44,13.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,0.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0
-45,22.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,0.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0
-46,91.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,0.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0
-47,117.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,0.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0
-48,40.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,0.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0
-49,40.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,97.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0,0.0,303.0,183.0,149.0,165.0,161.0,216.0,97.0
-50,194.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,160.0,245.0,247.0,218.0,279.0,159.0,274.0,274.0,0.0,245.0,247.0,218.0,279.0,159.0,274.0
-51,76.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,117.0,115.0,91.0,146.0,142.0,142.0,142.0,233.0,0.0,115.0,91.0,146.0,142.0,142.0
-52,13.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,147.0,188.0,183.0,238.0,199.0,199.0,326.0,206.0,0.0,188.0,183.0,238.0,199.0
-53,22.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,62.0,62.0,112.0,31.0,31.0,200.0,80.0,45.0,0.0,62.0,112.0,31.0
-54,91.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,148.0,143.0,144.0,144.0,235.0,119.0,117.0,93.0,0.0,143.0,144.0
-55,117.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,88.0,187.0,187.0,158.0,163.0,160.0,134.0,192.0,0.0,187.0
-56,40.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,44.0,44.0,250.0,130.0,96.0,112.0,108.0,163.0,0.0
diff --git a/distanceMatrix.py b/distanceMatrix.py
index 71937e4..89238de 100644
--- a/distanceMatrix.py
+++ b/distanceMatrix.py
@@ -58,7 +58,7 @@ def createDistanceMatrix(csvClientFile, cityNames, wpf):
endMatrix = np.c_[np.append(0, lastToDepot(csvClientFile, wpf, cityNames))]
distanceMatrix=np.append(endMatrix,distanceMatrix,axis=1)
- print(distanceMatrix)
+ # print(distanceMatrix)
return distanceMatrix
@@ -701,10 +701,8 @@ def getServiceTime(client, cityNames, wpf):
serviceTime += client['Additional']
return round(serviceTime)
-start = time.time()
-matrix = createDistanceMatrix('clientsTest.csv', 'belgian-cities-geocoded.csv', 'WPF.csv')
-end = time.time()
-
-print(end-start)
-pd.DataFrame(matrix).to_csv('distanceMatrix.csv')
+# start = time.time()
+# matrix = createDistanceMatrix('clientsTest.csv', 'belgian-cities-geocoded.csv', 'WPF.csv')
+# end = time.time()
+# print(end-start)
\ No newline at end of file
diff --git a/distanceMatrix30.csv b/distanceMatrix30.csv
new file mode 100644
index 0000000..bec944d
--- /dev/null
+++ b/distanceMatrix30.csv
@@ -0,0 +1,32 @@
+0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
+0.0,137.0,88.0,44.0,45.0,41.0,108.0,73.0,287.0,122.0,62.0,57.0,40.0,67.0,44.0,149.0,262.0,218.0,71.0,206.0,52.0,108.0,44.0,163.0,72.0,72.0,121.0,78.0,142.0,173.0,67.0
+40.0,0.0,135.0,157.0,158.0,153.0,216.0,120.0,186.0,235.0,170.0,169.0,165.0,165.0,157.0,261.0,184.0,157.0,183.0,303.0,165.0,216.0,157.0,145.0,161.0,179.0,234.0,191.0,254.0,286.0,179.0
+15.0,111.0,0.0,108.0,108.0,104.0,166.0,93.0,154.0,186.0,121.0,120.0,116.0,116.0,108.0,212.0,156.0,144.0,134.0,254.0,116.0,166.0,108.0,111.0,133.0,130.0,185.0,142.0,205.0,236.0,130.0
+67.0,132.0,107.0,0.0,106.0,102.0,135.0,109.0,158.0,175.0,111.0,118.0,81.0,98.0,105.0,179.0,160.0,150.0,108.0,252.0,113.0,132.0,98.0,115.0,137.0,120.0,182.0,118.0,178.0,208.0,121.0
+40.0,106.0,80.0,79.0,0.0,75.0,137.0,83.0,131.0,156.0,91.0,57.0,87.0,87.0,79.0,183.0,133.0,123.0,105.0,197.0,87.0,137.0,79.0,88.0,110.0,101.0,147.0,112.0,176.0,207.0,101.0
+60.0,125.0,100.0,98.0,99.0,0.0,157.0,102.0,151.0,176.0,111.0,111.0,107.0,106.0,91.0,203.0,153.0,143.0,124.0,245.0,106.0,157.0,98.0,108.0,130.0,120.0,175.0,132.0,195.0,227.0,120.0
+190.0,261.0,235.0,227.0,234.0,230.0,0.0,238.0,286.0,305.0,240.0,246.0,205.0,203.0,234.0,96.0,288.0,278.0,231.0,380.0,242.0,145.0,227.0,243.0,265.0,250.0,311.0,244.0,148.0,152.0,233.0
+18.0,78.0,75.0,92.0,93.0,88.0,151.0,0.0,128.0,170.0,105.0,105.0,101.0,100.0,92.0,197.0,128.0,109.0,118.0,239.0,100.0,151.0,92.0,84.0,104.0,114.0,169.0,126.0,189.0,221.0,114.0
+66.0,310.0,302.0,306.0,307.0,303.0,365.0,294.0,0.0,384.0,319.0,319.0,315.0,314.0,306.0,411.0,230.0,262.0,333.0,453.0,314.0,365.0,306.0,265.0,245.0,329.0,383.0,340.0,404.0,435.0,329.0
+143.0,209.0,183.0,175.0,182.0,178.0,211.0,186.0,234.0,0.0,187.0,194.0,158.0,175.0,182.0,256.0,236.0,226.0,184.0,328.0,190.0,208.0,175.0,191.0,213.0,196.0,259.0,195.0,254.0,285.0,197.0
+79.0,149.0,124.0,116.0,123.0,119.0,152.0,127.0,175.0,192.0,0.0,135.0,98.0,116.0,122.0,197.0,177.0,167.0,125.0,269.0,130.0,149.0,116.0,132.0,154.0,137.0,199.0,136.0,195.0,225.0,138.0
+52.0,118.0,93.0,91.0,57.0,87.0,150.0,95.0,143.0,169.0,104.0,0.0,99.0,99.0,91.0,195.0,146.0,135.0,117.0,209.0,99.0,149.0,91.0,101.0,122.0,113.0,159.0,125.0,188.0,220.0,113.0
+22.0,31.0,36.0,53.0,54.0,50.0,112.0,17.0,86.0,131.0,66.0,66.0,0.0,61.0,53.0,158.0,86.0,65.0,80.0,200.0,61.0,112.0,53.0,43.0,62.0,76.0,131.0,87.0,151.0,182.0,76.0
+67.0,147.0,122.0,113.0,121.0,117.0,150.0,124.0,173.0,190.0,126.0,133.0,96.0,0.0,120.0,194.0,175.0,165.0,123.0,267.0,128.0,147.0,113.0,130.0,152.0,135.0,197.0,133.0,193.0,223.0,136.0
+67.0,132.0,107.0,105.0,106.0,91.0,164.0,109.0,158.0,183.0,118.0,118.0,114.0,113.0,0.0,210.0,160.0,150.0,132.0,252.0,113.0,164.0,105.0,115.0,137.0,127.0,182.0,139.0,203.0,234.0,128.0
+148.0,213.0,188.0,179.0,187.0,183.0,216.0,191.0,239.0,256.0,192.0,199.0,162.0,179.0,186.0,0.0,241.0,231.0,189.0,333.0,194.0,213.0,179.0,196.0,218.0,201.0,263.0,200.0,259.0,289.0,202.0
+68.0,281.0,277.0,282.0,282.0,278.0,340.0,267.0,203.0,359.0,294.0,294.0,290.0,290.0,282.0,386.0,0.0,228.0,308.0,428.0,290.0,340.0,282.0,239.0,218.0,304.0,359.0,315.0,379.0,410.0,304.0
+58.0,220.0,231.0,237.0,238.0,234.0,296.0,214.0,201.0,315.0,250.0,250.0,246.0,245.0,237.0,342.0,194.0,0.0,264.0,384.0,245.0,296.0,237.0,197.0,186.0,260.0,314.0,271.0,335.0,366.0,260.0
+76.0,142.0,117.0,108.0,115.0,111.0,144.0,119.0,167.0,184.0,120.0,127.0,91.0,108.0,115.0,189.0,169.0,159.0,0.0,261.0,123.0,142.0,108.0,125.0,146.0,129.0,192.0,128.0,187.0,218.0,130.0
+194.0,274.0,249.0,247.0,218.0,244.0,306.0,252.0,300.0,325.0,260.0,207.0,256.0,255.0,247.0,352.0,302.0,292.0,274.0,0.0,255.0,306.0,247.0,257.0,279.0,270.0,318.0,281.0,345.0,376.0,270.0
+67.0,132.0,107.0,105.0,106.0,102.0,164.0,109.0,158.0,183.0,118.0,118.0,114.0,113.0,105.0,210.0,160.0,150.0,132.0,252.0,0.0,164.0,105.0,115.0,137.0,127.0,182.0,139.0,203.0,234.0,128.0
+117.0,187.0,162.0,154.0,161.0,157.0,69.0,165.0,213.0,232.0,167.0,173.0,134.0,129.0,160.0,115.0,215.0,205.0,163.0,307.0,168.0,0.0,154.0,170.0,192.0,176.0,237.0,175.0,120.0,146.0,160.0
+67.0,132.0,107.0,98.0,106.0,102.0,135.0,109.0,158.0,175.0,111.0,118.0,81.0,98.0,105.0,179.0,160.0,150.0,108.0,252.0,113.0,132.0,0.0,115.0,137.0,120.0,182.0,118.0,178.0,208.0,121.0
+23.0,188.0,178.0,183.0,183.0,179.0,241.0,169.0,184.0,261.0,195.0,195.0,191.0,191.0,183.0,287.0,185.0,177.0,209.0,329.0,191.0,241.0,183.0,0.0,162.0,205.0,260.0,217.0,280.0,311.0,205.0
+91.0,159.0,134.0,125.0,132.0,128.0,161.0,136.0,184.0,201.0,137.0,144.0,108.0,125.0,132.0,206.0,186.0,176.0,134.0,278.0,140.0,158.0,125.0,142.0,0.0,146.0,209.0,145.0,204.0,235.0,147.0
+88.0,159.0,134.0,125.0,132.0,128.0,161.0,136.0,184.0,201.0,137.0,144.0,108.0,125.0,132.0,206.0,186.0,176.0,134.0,278.0,140.0,158.0,125.0,142.0,163.0,0.0,209.0,145.0,204.0,235.0,147.0
+142.0,207.0,182.0,180.0,147.0,177.0,239.0,184.0,233.0,258.0,193.0,159.0,189.0,188.0,180.0,285.0,235.0,225.0,207.0,299.0,188.0,239.0,180.0,190.0,212.0,202.0,0.0,214.0,278.0,309.0,203.0
+87.0,152.0,127.0,118.0,126.0,122.0,155.0,129.0,178.0,195.0,131.0,138.0,101.0,118.0,125.0,200.0,180.0,170.0,128.0,272.0,133.0,152.0,118.0,135.0,157.0,140.0,202.0,0.0,198.0,228.0,141.0
+150.0,215.0,190.0,182.0,189.0,185.0,97.0,192.0,241.0,260.0,194.0,201.0,162.0,157.0,188.0,143.0,243.0,233.0,191.0,335.0,196.0,115.0,182.0,198.0,220.0,204.0,265.0,203.0,0.0,174.0,188.0
+200.0,266.0,240.0,232.0,239.0,235.0,147.0,243.0,291.0,310.0,245.0,251.0,209.0,208.0,239.0,101.0,293.0,283.0,236.0,385.0,247.0,150.0,232.0,248.0,270.0,254.0,316.0,249.0,153.0,0.0,238.0
+89.0,155.0,130.0,121.0,128.0,124.0,157.0,132.0,180.0,197.0,133.0,140.0,104.0,121.0,128.0,202.0,182.0,172.0,130.0,274.0,136.0,154.0,121.0,137.0,159.0,142.0,205.0,141.0,200.0,231.0,0.0
diff --git a/distanceMatrix5.csv b/distanceMatrix5.csv
new file mode 100644
index 0000000..4e461b8
--- /dev/null
+++ b/distanceMatrix5.csv
@@ -0,0 +1,7 @@
+0,1,2,3,4,5
+0.0,137.0,88.0,44.0,45.0,41.0
+40.0,0.0,135.0,157.0,158.0,153.0
+15.0,111.0,0.0,108.0,108.0,104.0
+67.0,132.0,107.0,0.0,106.0,102.0
+40.0,106.0,80.0,79.0,0.0,75.0
+60.0,125.0,100.0,98.0,99.0,0.0
diff --git a/g.ipynb b/g.ipynb
deleted file mode 100644
index 1c44ea3..0000000
--- a/g.ipynb
+++ /dev/null
@@ -1,412 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 83,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[[0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]]\n"
- ]
- }
- ],
- "source": [
- "%run distanceMatrix.py"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 82,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[[0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]\n",
- " [0.]]\n"
- ]
- }
- ],
- "source": [
- "print(np.zeros([5+1,1]))"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 34,
- "metadata": {},
- "outputs": [],
- "source": [
- "#KAMPENHOUT 1910,\"Kampenhout\",50.9338827,4.5605498\n",
- "#BRU 1000,\"Brussel\",50.8427501,4.3515499\n",
- "#LEUV 3000,\"Leuven\",50.8815197,4.6967578\n",
- "#ANT 2000,\"Antwerpen\",51.2198771,4.4011356\n",
- "#GENT 9000,\"Gent\",51.0678307,3.7290914\n",
- "\n",
- "coords = [\n",
- " (50.9338827,4.5605498),\n",
- " (50.8427501,4.3515499),\n",
- " (50.8815197,4.6967578),\n",
- " (51.2198771,4.4011356),\n",
- " (51.0678307,3.7290914),\n",
- " (51.0678307,4.0090914)\n",
- "]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 35,
- "metadata": {},
- "outputs": [],
- "source": [
- "\"\"\"Vehicles Routing Problem (VRP) with Time Windows.\"\"\"\n",
- "\n",
- "from ortools.constraint_solver import routing_enums_pb2\n",
- "from ortools.constraint_solver import pywrapcp\n",
- "\n",
- "\n",
- "def create_data_model():\n",
- " \"\"\"Stores the data for the problem.\"\"\"\n",
- " data = {}\n",
- " data['time_matrix'] = [\n",
- " [0,7.07,7.07,7.07,7.07],\n",
- " [7.07,0,10,2*7.07,10],\n",
- " [7.07,10,0,10,2*7.07],\n",
- " [7.07,2*7.07,10,0,10],\n",
- " [7.07,10,2*7.07,10,0]\n",
- " ]\n",
- " data['time_windows'] = [\n",
- " (0, 5), # depot\n",
- " (7, 12), # 1\n",
- " (10, 70), # 2\n",
- " (16, 80), # 3\n",
- " (10, 80), # 4\n",
- " ]\n",
- " data['num_vehicles'] = 3\n",
- " data['depot'] = 0\n",
- " return data\n",
- "\n",
- "\n",
- "def print_solution(data, manager, routing, solution):\n",
- " \"\"\"Prints solution on console.\"\"\"\n",
- " print(f'Objective: {solution.ObjectiveValue()}')\n",
- " time_dimension = routing.GetDimensionOrDie('Time')\n",
- " total_time = 0\n",
- " for vehicle_id in range(data['num_vehicles']):\n",
- " index = routing.Start(vehicle_id)\n",
- " plan_output = 'Route for vehicle {}:\\n'.format(vehicle_id)\n",
- " while not routing.IsEnd(index):\n",
- " time_var = time_dimension.CumulVar(index)\n",
- " plan_output += '{0} Time({1},{2}) -> '.format(\n",
- " manager.IndexToNode(index), solution.Min(time_var),\n",
- " solution.Max(time_var))\n",
- " index = solution.Value(routing.NextVar(index))\n",
- " time_var = time_dimension.CumulVar(index)\n",
- " plan_output += '{0} Time({1},{2})\\n'.format(manager.IndexToNode(index),\n",
- " solution.Min(time_var),\n",
- " solution.Max(time_var))\n",
- " plan_output += 'Time of the route: {}min\\n'.format(\n",
- " solution.Min(time_var))\n",
- " print(plan_output)\n",
- " total_time += solution.Min(time_var)\n",
- " print('Total time of all routes: {}min'.format(total_time))\n",
- "\n",
- "\n",
- "def get_cumul_data(solution, routing, dimension):\n",
- " \"\"\"Get cumulative data from a dimension and store it in an array.\"\"\"\n",
- " # Returns an array cumul_data whose i,j entry contains the minimum and\n",
- " # maximum of CumulVar for the dimension at the jth node on route :\n",
- " # - cumul_data[i][j][0] is the minimum.\n",
- " # - cumul_data[i][j][1] is the maximum.\n",
- "\n",
- " cumul_data = []\n",
- " for route_nbr in range(routing.vehicles()):\n",
- " route_data = []\n",
- " index = routing.Start(route_nbr)\n",
- " dim_var = dimension.CumulVar(index)\n",
- " route_data.append([solution.Min(dim_var), solution.Max(dim_var)])\n",
- " while not routing.IsEnd(index):\n",
- " index = solution.Value(routing.NextVar(index))\n",
- " dim_var = dimension.CumulVar(index)\n",
- " route_data.append([solution.Min(dim_var), solution.Max(dim_var)])\n",
- " cumul_data.append(route_data)\n",
- " return cumul_data\n",
- "\n",
- "\n",
- "def get_routes(solution, routing, manager):\n",
- " \"\"\"Get vehicle routes from a solution and store them in an array.\"\"\"\n",
- " # Get vehicle routes and store them in a two dimensional array whose\n",
- " # i,j entry is the jth location visited by vehicle i along its route.\n",
- " routes = []\n",
- " for route_nbr in range(routing.vehicles()):\n",
- " index = routing.Start(route_nbr)\n",
- " route = [manager.IndexToNode(index)]\n",
- " while not routing.IsEnd(index):\n",
- " index = solution.Value(routing.NextVar(index))\n",
- " route.append(manager.IndexToNode(index))\n",
- " routes.append(route)\n",
- " return routes"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 36,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Objective: 48\n",
- "Route for vehicle 0:\n",
- "0 Time(0,0) -> 0 Time(0,0)\n",
- "Time of the route: 0min\n",
- "\n",
- "Route for vehicle 1:\n",
- "0 Time(0,0) -> 1 Time(7,7) -> 2 Time(17,17) -> 0 Time(24,24)\n",
- "Time of the route: 24min\n",
- "\n",
- "Route for vehicle 2:\n",
- "0 Time(0,0) -> 4 Time(10,10) -> 3 Time(20,20) -> 0 Time(27,27)\n",
- "Time of the route: 27min\n",
- "\n",
- "Total time of all routes: 51min\n"
- ]
- }
- ],
- "source": [
- "# Instantiate the data problem.\n",
- "data = create_data_model()\n",
- "\n",
- "# Create the routing index manager.\n",
- "manager = pywrapcp.RoutingIndexManager(len(data['time_matrix']),\n",
- " data['num_vehicles'], data['depot'])\n",
- "\n",
- "# Create Routing Model.\n",
- "routing = pywrapcp.RoutingModel(manager)\n",
- "\n",
- "\n",
- "# Create and register a transit callback.\n",
- "def time_callback(from_index, to_index):\n",
- " \"\"\"Returns the travel time between the two nodes.\"\"\"\n",
- " # Convert from routing variable Index to time matrix NodeIndex.\n",
- " from_node = manager.IndexToNode(from_index)\n",
- " to_node = manager.IndexToNode(to_index)\n",
- " return data['time_matrix'][from_node][to_node]\n",
- "\n",
- "transit_callback_index = routing.RegisterTransitCallback(time_callback)\n",
- "\n",
- "# Define cost of each arc.\n",
- "routing.SetArcCostEvaluatorOfAllVehicles(transit_callback_index)\n",
- "\n",
- "# Add Time Windows constraint.\n",
- "time = 'Time'\n",
- "routing.AddDimension(\n",
- " transit_callback_index,\n",
- " 30, # allow waiting time\n",
- " 30, # maximum time per vehicle\n",
- " False, # Don't force start cumul to zero.\n",
- " time)\n",
- "time_dimension = routing.GetDimensionOrDie(time)\n",
- "# Add time window constraints for each location except depot.\n",
- "for location_idx, time_window in enumerate(data['time_windows']):\n",
- " if location_idx == data['depot']:\n",
- " continue\n",
- " index = manager.NodeToIndex(location_idx)\n",
- " time_dimension.CumulVar(index).SetRange(time_window[0], time_window[1])\n",
- "# Add time window constraints for each vehicle start node.\n",
- "depot_idx = data['depot']\n",
- "for vehicle_id in range(data['num_vehicles']):\n",
- " index = routing.Start(vehicle_id)\n",
- " time_dimension.CumulVar(index).SetRange(\n",
- " data['time_windows'][depot_idx][0],\n",
- " data['time_windows'][depot_idx][1])\n",
- "\n",
- "# Instantiate route start and end times to produce feasible times.\n",
- "for i in range(data['num_vehicles']):\n",
- " routing.AddVariableMinimizedByFinalizer(\n",
- " time_dimension.CumulVar(routing.Start(i)))\n",
- " routing.AddVariableMinimizedByFinalizer(\n",
- " time_dimension.CumulVar(routing.End(i)))\n",
- "\n",
- "# Setting first solution heuristic.\n",
- "search_parameters = pywrapcp.DefaultRoutingSearchParameters()\n",
- "search_parameters.first_solution_strategy = (\n",
- " routing_enums_pb2.FirstSolutionStrategy.PATH_CHEAPEST_ARC)\n",
- "\n",
- "# Solve the problem.\n",
- "solution = routing.SolveWithParameters(search_parameters)\n",
- "\n",
- "# Print solution on console.\n",
- "if solution:\n",
- " print_solution(data, manager, routing, solution)\n",
- " # get solution windows\n",
- " solution_windows=get_cumul_data(solution,routing,time_dimension)\n",
- " solution_routes=get_routes(solution,routing,manager)\n",
- " \n",
- "else:\n",
- " print(\"INFEASIBLE\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 37,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "Make this Notebook Trusted to load map: File -> Trust Notebook
"
- ],
- "text/plain": [
- ""
- ]
- },
- "execution_count": 37,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# Map the solution\n",
- "import folium\n",
- "\n",
- "colors = ['red', 'blue', 'green', 'purple', 'orange', 'darkred','lightred', 'beige', 'darkblue', 'darkgreen', 'cadetblue', 'darkpurple', 'white', 'pink', 'lightblue', 'lightgreen', 'gray', 'black', 'lightgray']\n",
- "\n",
- "map = folium.Map(location=[51,5], zoom_start = 8)\n",
- "\n",
- "for idx,route in enumerate(solution_routes):\n",
- " route_coords=[]\n",
- " for node in route:\n",
- " route_coords.append(coords[node])\n",
- " folium.PolyLine(route_coords,weight=3,color=colors[idx]).add_to(map)\n",
- "\n",
- "\n",
- "map"
- ]
- }
- ],
- "metadata": {
- "interpreter": {
- "hash": "1ebd53531a265123f8d6b96a0394cf5c6958acea593669dc45d7411847354196"
- },
- "kernelspec": {
- "display_name": "Python 3.9.7 ('ip1')",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.9.7"
- },
- "orig_nbformat": 4
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}