AnsweredAssumed Answered

Vehicle Routing Problem Solver takes too long and gives Time Out error

Question asked by sgunes_UW on Oct 7, 2020
Latest reply on Oct 8, 2020 by

I have been working on coding a Vehicle Routing Problem Solver, mostly by following ArcGIS Guide online (Guide to Network Analysis (Part 7 - Vehicle Routing Problem) | ArcGIS for Developers ). My code is as follows:

from arcgis.gis import GIS
import pandas as pd
import getpass
from IPython.display import HTML
import arcgis

from arcgis.features import Feature, FeatureSet, GeoAccessor, GeoSeriesAccessor
import networkx as nx
import osmnx as ox
import requests
import as cm
import matplotlib.colors as colors
from pathlib import Path
import geopandas as gpd # combines the capabilities of pandas and shapely for geospatial operations

#connect to your GIS
gis = GIS( client_id='Db8G5Jo6FCgLqTLk')
print("Successfully logged in as: " +

data_path = Path('./data')

if not data_path.exists():

#read shape file

addresses = gpd.read_file('data/Addresses_in_King_County___address_point-shp/Addresses_in_King_County___address_point.shp')


Please sign in to your GIS and paste the code that is obtained below. If a web browser does not automatically open, please navigate to the URL below yourself instead. Opening web browser to navigate to: code obtained on signing in using SAML: ········
/Users/seymagunes/opt/anaconda3/envs/ox/lib/python3.8/site-packages/urllib3/ InsecureRequestWarning: Unverified HTTPS request is being made to host ''. Adding certificate verification is strongly advised. See:  warnings.warn(
Successfully logged in as: XXXXX

sea = addresses[addresses['CTYNAME']=="SEATTLE"]
pd.set_option('display.max_columns', None)
df_o = pd.DataFrame(sea.sample(N), columns = ['LON', 'LAT'])
#print (df_o)
orders_sdf = pd.DataFrame.spatial.from_xy(df_o, 'LON', 'LAT')
orders_sdf = orders_sdf.drop(axis=1, labels=['LON', 'LAT'])
orders_fset = orders_sdf.spatial.to_featureset()

r = {'ObjectID': ['1','2'],
'Name': ['Route1', 'Route2'],
'StartDepotName': ['Warehouse', 'Warehouse'],
'EndDepotName': ['Warehouse', 'Warehouse'],
#'EarliestStartTime': [1.573546e+12, 1.573546e+12 ],
# 'LatestStartTime': [8.00, 8.00 ],
'Capacities':[200, 50],
'CostPerUnitTime': [1,1],
# 'MaxTotalTime': [8,8],
'AssignmentRule': [1,1]

df = pd.DataFrame(r, columns = ['ObjectID',
# 'EarliestStartTime',
# 'LatestStartTime',
# 'MaxTotalTime',

#df["LatestStartTime"] = df["LatestStartTime"].astype("int64")/ 10 ** 6
#df["EarliestStartTime"] = df["EarliestStartTime"].astype("int64")/ 10 ** 6

routes_fset = arcgis.features.FeatureSet.from_dataframe(df)

# 1 depot
w = {'Latitude': [47.618011],
'Longitude': [-122.329422],
'Name': ['Warehouse']

df_w = pd.DataFrame(w, columns = ['Latitude',

depots_sdf = pd.DataFrame.spatial.from_xy(df_w, "Longitude", "Latitude")
depots_sdf = depots_sdf.drop(axis=1, labels=["Longitude", "Latitude"])
depots_fset = depots_sdf.spatial.to_featureset()

import datetime as dt
import as network

if_async = False
current_date =

result1 = network.analysis.solve_vehicle_routing_problem(orders=orders_fset, depots=depots_fset,
routes=routes_fset, populate_route_lines=True,

runs for 20+ minutes ends with error