Example #1
0
def compute_tt_vmt(damaged_graph, demand):
	start = time.time()
	it = ita.ITA(damaged_graph,demand)
	newG = it.assign()
	print 'time to assign: ', time.time()-start
	travel_time = util.find_travel_time(damaged_graph)
	vmt = util.find_vmt(damaged_graph)
	''' in the undamaged case, this should be around 172 million (http://www.mtc.ca.gov/maps_and_data/datamart/stats/vmt.htm) over the course of a day, so divide by 0.053 (see demand note in main). BUT our trip table has only around 11 million trips (instead of the 22 million mentioned here: http://www.mtc.ca.gov/maps_and_data/datamart/stats/baydemo.htm because we are looking at vehicle-driver only and not transit, walking, biking, being a passenger in a car, etc. So, that's **8-9 million vehicle-miles divided by 2, which equals around 4 million vehicle-miles!**
	'''
	return travel_time, vmt
def compute_tt_vmt(damaged_graph, demand):
  start = time.time()
  it = ita.ITA(damaged_graph,demand)
  newG = it.assign()
  print 'time to assign: ', time.time()-start
 # for n,nbrsdict in newG.adjacency_iter():
 #   for nbr,keydict in nbrsdict.items():
 #     for key,eattr in keydict.items():
 #       if eattr['flow']>0:
 #         print (n, nbr, eattr['flow'])
  travel_time = util.find_travel_time(damaged_graph) #this should be a little less than 252850.3941hours or **910,261,418.76seconds. **
  vmt = util.find_vmt(damaged_graph) #in the undamaged case, this should be around 172 million (http://www.mtc.ca.gov/maps_and_data/datamart/stats/vmt.htm) over the course of a day, so divide by 0.053 (see demand note in main). So, that's **8-9 million vehicle-miles**
  # print travel_time
  # print 'vmt: ', vmt
  return travel_time, vmt
Example #3
0
def run_iteration(G, ground_motion, demand):
  #change edge properties
  newG = damage_network(G, ground_motion)

  #call ita
  start = time.time()
#  print 'starting iterative travel assignment'
  it = ita.ITA(G,demand)
  newG = it.assign()
  print 'time to assign: ', time.time()-start
#  for n,nbrsdict in newG.adjacency_iter():
#    for nbr,keydict in nbrsdict.items():
#      for key,eattr in keydict.items():
#        if eattr['flow']>0:
#          print (n, nbr, eattr['flow'])
  travel_time = util.find_travel_time(newG)
  vmt = util.find_vmt(G)
#  print 'travel time: ', travel_time
#  print 'vmt: ', util.find_vmt(G) #in the undamaged case, this should be around 172 million (http://www.mtc.ca.gov/maps_and_data/datamart/stats/vmt.htm)
  newG = util.clean_up_graph(newG)
  return (travel_time, vmt)
def run_iteration(G, ground_motion, demand, damagedG, clean_up=True):
  '''this function runs iterative traffic assignment to find the vehicle miles traveled (VMT) and the travel time'''
  if damagedG == None:
    print 'damaging network'
    damagedG = damage_network(G, ground_motion)
  travel_time = -1
  vmt = -1
  #call ita
  start = time.time()
  it = ita.ITA(damagedG,demand)
  newG = it.assign()
  print 'time to assign: ', time.time()-start
 # for n,nbrsdict in newG.adjacency_iter():
 #   for nbr,keydict in nbrsdict.items():
 #     for key,eattr in keydict.items():
 #       if eattr['flow']>0:
 #         print (n, nbr, eattr['flow'])
  travel_time = util.find_travel_time(damagedG) #this should be a little less than 252850.3941hours or **910,261,418.76seconds. **
  vmt = util.find_vmt(damagedG) #in the undamaged case, this should be around 172 million (http://www.mtc.ca.gov/maps_and_data/datamart/stats/vmt.htm) over the course of a day, so divide by 0.053 (see demand note in main). So, that's **8-9 million vehicle-miles**
  if clean_up == True:
    damagedG= util.clean_up_graph(damagedG)
  return (travel_time, vmt)