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 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)