def LA_metrics_attacks_all(beta, thres): net, d, node, features = load_LA_3() # import pdb; pdb.set_trace() d[:,2] = d[:,2] / 4000. # modify all small capacity links links_affected = (features[:,0] < thres) net2 = modify_capacity(net, links_affected, beta) return net2, d, node, features
def LA_metrics_attacks_all(beta, thres): net, d, node, features = load_LA_3() # import pdb; pdb.set_trace() d[:, 2] = d[:, 2] / 4000. # modify all small capacity links links_affected = (features[:, 0] < thres) net2 = modify_capacity(net, links_affected, beta) return net2, d, node, features
def visualize_links_by_city(city): # visualize the links from a specific city graph, demand, node, features = load_LA_3() linkToCity = np.genfromtxt('data/LA/link_to_cities.csv', delimiter=',', \ skiprows=1, dtype='str') links = process_links(graph, node, features, in_order=True) names = ['capacity', 'length', 'fftt'] color = 3*(linkToCity[:,1] == city) color = color + 10*(features[:,0] > 900.) weight = (features[:,0] <= 900.) + 3.*(features[:,0] > 900.) geojson_link(links, names, color, weight)
def visualize_links_by_city(city): # visualize the links from a specific city graph, demand, node, features = load_LA_3() linkToCity = np.genfromtxt('data/LA/link_to_cities.csv', delimiter=',', \ skiprows=1, dtype='str') links = process_links(graph, node, features, in_order=True) names = ['capacity', 'length', 'fftt'] color = 3 * (linkToCity[:, 1] == city) color = color + 10 * (features[:, 0] > 900.) weight = (features[:, 0] <= 900.) + 3. * (features[:, 0] > 900.) geojson_link(links, names, color, weight)
def LA_metrics_attacks_city(beta, thres, city): net, d, node, features = load_LA_3() # import pdb; pdb.set_trace() d[:,2] = d[:,2] / 4000. # extract the mapping from links to cities linkToCity = np.genfromtxt('data/LA/link_to_cities.csv', delimiter=',', \ skiprows=1, dtype='str') print linkToCity links_affected = np.logical_and(linkToCity[:,1] == city, features[:,0] < thres) print np.sum(links_affected) # modify all small capacity links in GLendale net2 = modify_capacity(net, links_affected, beta)
def LA_metrics_attacks_city(beta, thres, city): net, d, node, features = load_LA_3() # import pdb; pdb.set_trace() d[:, 2] = d[:, 2] / 4000. # extract the mapping from links to cities linkToCity = np.genfromtxt('data/LA/link_to_cities.csv', delimiter=',', \ skiprows=1, dtype='str') print linkToCity links_affected = np.logical_and(linkToCity[:, 1] == city, features[:, 0] < thres) print np.sum(links_affected) # modify all small capacity links in GLendale net2 = modify_capacity(net, links_affected, beta)