Skip to content

Instantly share code, notes, and snippets.

@Westlife1002
Westlife1002 / code_VRP__addPickup_Delivery.py
Last active July 26, 2021 16:51
VRP_addPickup_Delivery
"""Capacitated Vehicle Routing Problem"""
from six.moves import xrange
from ortools.constraint_solver import pywrapcp
from ortools.constraint_solver import routing_enums_pb2
import networkx as nx
import matplotlib.pyplot as plt
import random
import math
import pandas as pd
from csv import reader
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 19 columns, instead of 7. in line 8.
ID,Data,Docket_No,Jobtype,HUB,Hub Lat,Hub Long,UDN,Col_Postcode,Del_Postcode,Customer Name,Postcode,Lat,Long,Date,Chargeable Weight,earliest,latest,cm3
0,,,,,,,,,,EI LHR DC,,51.4457678,-0.45613,,0,0,0,0
1,DelSpec,664373,Delivery,LHR,51.45682,-0.452107,444393,TW14 8QH,AL4 9LP,AL49LP,AL4,51.799089,-0.29716,3/4/2016,472,480,960,10
2,DelSpec,664203,Delivery,LHR,51.45682,-0.452107,444246,TW14 8QH,B19 1DS,B191DS,B19,52.497911,-1.903832,3/4/2016,1488,480,960,3
3,DelSpec,664717,Delivery,LHR,51.45682,-0.452107,444693,TW14 8QH,BB5 5YJ,BB55YJ,BB5,53.74589,-2.379778,3/4/2016,5652,480,960,10
4,DelSpec,664524,Delivery,LHR,51.45682,-0.452107,444528,TW14 8QH,CV23 0WA,CV230WA,CV23,52.332395,-1.346753,3/4/2016,2348,480,960,9
5,DelSpec,665329,Delivery,LHR,51.45682,-0.452107,445250,TW14 8QH,CV34 4RL,CV344RL,CV34,52.276323,-1.579845,3/4/2016,12,480,960,10
6,DelSpec,664519,Delivery,LHR,51.45682,-0.452107,444524,TW14 8QH,PE19 8JJ,PE198JJ,PE19,52.254674,-0.265726,3/4/2016,2940,480,960,5
7,DelSpec,665207,Delivery,LHR,51.45682,-0.4521
"""Capacitated Vehicle Routing Problem"""
from six.moves import xrange
from ortools.constraint_solver import pywrapcp
from ortools.constraint_solver import routing_enums_pb2
import networkx as nx
import matplotlib.pyplot as plt
import random
import math
import pandas as pd
import tkinter as tk