def visualize_result_ratio_study(fileName, ratio, name, mode): net, demand, node, features = load_network_data(name) #Loading the flow per link resulting from frank-wolfe f = np.loadtxt(fileName, delimiter=',', skiprows=0) #Location of the features featureLocation = 'data/' + name + '_net.txt' features = np.zeros((f.shape[0], 4)) features[:, :3] = extract_features(featureLocation) #Multiply the flow obtained by 4000 since we initially divided by 4000 before frank-wolfs f = np.divide(f * 4000, features[:, 0]) features[:, 3] = f links = process_links(net, node, features, in_order=True) #creates color array used to visulized the links #values useful in differenciating links based of flow on links color = 2.0 * f + 1.0 #Keeping track of the percentage of congestion links_congested = len(color[np.where(color >= 3)]) percentage_of_congestion = float(links_congested) / float(len(color)) print("congestion is at %3f " % percentage_of_congestion) geojson_link_Scenario_Study( ratio, links, ['capacity', 'length', 'fftt', 'flow_over_capacity'], color, name, mode)
def visualize_LA_result_Scenario_Study(fileName, ratio): net, demand, node = load_LA() f = np.loadtxt(fileName, delimiter=',', skiprows=0) features = np.zeros((f.shape[0], 4)) features[:, :3] = extract_features('data/LA_net.txt') #features[:,:3] = extract_features('data/ChicagoRegional_net.txt') f = np.divide(f * 4000, features[:, 0]) features[:, 3] = f links = process_links(net, node, features, in_order=True) #creates color array used to visulized the links #values useful in differenciating links based of flow on links color = 2.0 * f + 1.0 #Keeping track of the percentage of congestion links_congested = len(color[np.where(color >= 3)]) percentage_of_congestion = float(links_congested) / float(len(color)) print("congestion is at %3f " % percentage_of_congestion) geojson_link_Scenario_Study( ratio, links, ['capacity', 'length', 'fftt', 'flow_over_capacity'], color)