def make_graph_edges(list_of_cluster_data, tour_model):
    for cd in list_of_cluster_data:
        start_loc = cd['start']
        end_loc = cd['end']
        start_loc_temp = tm.Location(start_loc, tour_model)
        start_loc_temp = tour_model.get_location(start_loc_temp)
        end_loc_temp = tm.Location(end_loc, tour_model)
        end_loc_temp = tour_model.get_location(end_loc_temp)
        e = make_graph_edge(start_loc_temp, end_loc_temp, tour_model)
        logging.debug("making edge %s" % e)
        for trip_entry in cd["sections"]:
            e.add_trip(trip_entry)
def populate_prob_field_for_locatons(list_of_cluster_data, tour_model):
    for cd in list_of_cluster_data:
        start_loc = cd['start']
        end_loc = cd['end']
        for model_trip in cd["sections"]:
            start_loc_temp = tm.Location(start_loc, tour_model)
            start_loc_temp = tour_model.get_location(start_loc_temp)
            end_loc_temp = tm.Location(end_loc, tour_model)
            end_loc_temp = tour_model.get_location(end_loc_temp)
            com = tm.Commute(start_loc_temp, end_loc_temp)
            tour_model.add_start_hour(start_loc_temp, model_trip.start_time)
            start_loc_temp.increment_successor(end_loc_temp,
                                               get_start_hour(model_trip),
                                               get_day(model_trip))
def set_up(list_of_cluster_data, user_name):
    time0 = datetime.datetime(1900, 1, 1, hour=0)
    our_tour_model = tm.TourModel(user_name, 0, time0)
    for dct in list_of_cluster_data:
        start_name = dct['start']
        end_name = dct['end']
        start_coords = dct['start_coords']
        end_coords = dct['end_coords']
        for sec in dct['sections']:
            start_loc = tm.Location(start_name, our_tour_model)
            end_loc = tm.Location(end_name, our_tour_model)
            our_tour_model.add_location(start_loc, start_coords)
            our_tour_model.add_location(end_loc, end_coords)
    return our_tour_model