def convert_to_iclique_data_from_mesh_cloak(): map_data = Map() map_data.read_map(option.MAP_PATH, option.MAP_FILE) f = open(option.QUERY_PATH + option.QUERY_FILE, "r") fstr = f.read() f.close() # f = open(option.QUERY_PATH + "iclique_" + option.QUERY_FILE, "w") timestamp = 0 LARGE_STEP = 90 #60,90,120 seconds : for separating time steps NUM_RANGES = 10 #5,10 : for sub-dividing in each time step SMALL_STEP = LARGE_STEP / NUM_RANGES #ranges NUM_USERS = 5000 REQUESTS_PER_RANGE = NUM_USERS / NUM_RANGES request_id = 0 for line in fstr.split("\n"): if line == "": # EOF break items = line.split("\t") ### 1 - FOR Brinkhoff generator # # timestamp # timestamp = int(items[4]) # if timestamp > 5: # break # # # area min (generated randomly from range 0.00005-0.0001) # a_min_ratio = generate_a_min_ratio() # a_min = map_data.area * a_min_ratio # # # # timestep = timestamp * LARGE_STEP + (request_id % NUM_USERS) / REQUESTS_PER_RANGE * SMALL_STEP # f.write("%s\t%s\t%s\t%d\t%s\t%s\t%f"%(items[1],items[5],items[6],timestep,items[7],items[10],a_min)) ### 2 - FOR TraceGenerator # timestamp timestamp = int(items[1]) if timestamp > 5: break # area min (generated randomly from range 0.00005-0.0001) a_min_ratio = generate_a_min_ratio() a_min = map_data.area * a_min_ratio # timestep = timestamp * LARGE_STEP + ( request_id % NUM_USERS) / REQUESTS_PER_RANGE * SMALL_STEP f.write("%s\t%s\t%s\t%d\t%s\t%s\t%f" % (items[0], items[2], items[3], timestep, items[4], items[7], a_min)) # (End) 2 - FOR TraceGenerator f.write("\n") request_id += 1 f.close()
def convert_to_iclique_data(): map_data = Map() map_data.read_map(MAP_PATH, MAP_FILE) f = open(QUERY_PATH + QUERY_FILE, "r") fstr = f.read() f.close() # f = open(QUERY_PATH + "iclique_" + QUERY_FILE, "w") timestamp = 0 for line in fstr.split("\n"): if line == "": # EOF break items = line.split("\t") # timestamp timestamp = int(items[4]) # area min (generated a_min_ratio = float(items[11]) a_min = map_data.area * a_min_ratio #### #f.write("%s\t%s\t%s\t%s\t%s\t%s\t%f"%(items[1],items[5],items[6],items[4],items[7],items[10],a_min)) f.write("%s\t%s\t%s\t%d\t%s\t%s\t%f" % (items[1], items[5], items[6], timestamp * 60, items[7], items[10], a_min)) #f.write("%s\t%s\t%s\t%d\t%s\t%s\t%f"%(items[1],items[5],items[6],timestamp,items[7],items[10],a_min)) #timestamp += 1 f.write("\n") f.close()
####################################################### # MAIN (test) ####################################################### if __name__ == "__main__": # mc_set_1 = [set([1,2,3]), set([1,3,4])] # mc_set_2 = [set([1,5,6]), set([1,4,5]), set([1,3,4])] # # Graph.intersect_mc_set(mc_set_1, mc_set_2) start_time = time.clock() map_data = Map() map_data.read_map(option.MAP_PATH, option.MAP_FILE) print "Load Map : DONE" query_log = QueryLog(map_data) query_log.read_query(option.QUERY_PATH, option.QUERY_FILE, max_time_stamp = 10) print "Load Query : DONE" print "max_speed = ", query_log.max_speed print "elapsed : ", (time.clock() - start_time) graph = Graph(0, map_data, query_log, None) graph.init_mc_set() #TEST
timestep = int(sys.argv[2]) option.DISTANCE_CONSTRAINT = int(sys.argv[3]) if len(sys.argv) > 4: option.K_GLOBAL = int(sys.argv[4]) if len(sys.argv) > 5: option.INIT_COVER_KEEP_RATIO = float(sys.argv[5]) if len(sys.argv) > 6: option.NEXT_COVER_KEEP_RATIO = float(sys.argv[6]) # start_time = time.clock() map_data = Map() map_data.read_map(option.MAP_PATH, option.MAP_FILE) print "Load Map : DONE" query_log = QueryLog(map_data) query_log.read_query( option.QUERY_PATH, option.QUERY_FILE, max_time_stamp=40 ) # default: max_time_stamp = 10 (40: only for attack) print "Load Query : DONE" print "max_speed = ", query_log.max_speed print "elapsed : ", (time.clock() - start_time) graph = Graph(0, map_data, query_log, None) #TEST graph.run_timestamps(0, timestep)
# ac_events[0].append(2) # ac_events[0].append(3) # ac_events[3].append([1,4,3]) # print ac_events # TEST Map.compute_fixed_expanding(), EdgeSegmentSet.clean_fixed_expanding() timestep = 3 print "MAP_FILE =", option.MAP_FILE print "timestep =", timestep print "QUERY_FILE =", option.QUERY_FILE print "DISTANCE_CONSTRAINT =", option.DISTANCE_CONSTRAINT # start_time = time.clock() map_data = Map() map_data.read_map(option.MAP_PATH, option.MAP_FILE) print "Load Map : DONE" query_log = QueryLog(map_data) query_log.read_query(option.QUERY_PATH, option.QUERY_FILE, timestep, option.QUERY_TYPE) # default: max_time_stamp = 10 (40: only for attack) print "Load Query : DONE" print "max_speed = ", query_log.max_speed print "elapsed : ", (time.clock() - start_time) # timestamp = 0; expanding_list = {} #dict of lists query_list = query_log.frames[timestamp] # timestamp
full_edge_meshes[e.cur_edge_id] = [] full_edge_meshes[e.cur_edge_id].append(obj_id) else: #PARTIAL edge part_edges.append((e, obj_id)) # "list" of only one point mesh(obj_id) covers e return full_edge_meshes, part_edges ####################################################### # MAIN (test) ####################################################### if __name__ == "__main__": start_time = time.clock() map_data = Map() map_data.read_map(option.MAP_PATH, option.MAP_FILE) print "Load Map : DONE" query_log = QueryLog(map_data) query_log.read_query(option.QUERY_PATH, option.QUERY_FILE, max_time_stamp = 5) print "Load Query : DONE" print "max_speed = ", query_log.max_speed print "elapsed : ", (time.clock() - start_time) graph = Graph(0, map_data, query_log, None) # timestamp = 0 if len(sys.argv) > 1: timestamp = int(sys.argv[1])
seg_list = edge_segment_set.clean_fixed_expanding(seg_list) result.append(seg_list) return result ####################################################### # MAIN (test) ####################################################### if __name__ == "__main__": start_time = time.clock() map_data = Map() map_data.read_map(option.MAP_PATH, option.MAP_FILE) print "Load Map : DONE" query_log = QueryLog(map_data) query_log.read_query(option.QUERY_PATH, option.QUERY_FILE, max_time_stamp = 5) print "Load Query : DONE" print "max_speed = ", query_log.max_speed print "elapsed : ", (time.clock() - start_time) print "size(map_data) =", sys.getsizeof(map_data) # expanding_list_1 = {} #dict of lists timestamp = 0
query.cur_edge_id, init_graph_distance) seg_list = edge_segment_set.clean_fixed_expanding(seg_list) result.append(seg_list) return result ####################################################### # MAIN (test) ####################################################### if __name__ == "__main__": start_time = time.clock() map_data = Map() map_data.read_map(option.MAP_PATH, option.MAP_FILE) print "Load Map : DONE" query_log = QueryLog(map_data) query_log.read_query(option.QUERY_PATH, option.QUERY_FILE, max_time_stamp=5) print "Load Query : DONE" print "max_speed = ", query_log.max_speed print "elapsed : ", (time.clock() - start_time) print "size(map_data) =", sys.getsizeof(map_data) # expanding_list_1 = {} #dict of lists
self.height - end_y, fill=color) ####################################################### def draw_rectangle(self, x1, y1, x2, y2, color): self.draw_line(x1, y1, x1, y2, color) self.draw_line(x2, y1, x2, y2, color) self.draw_line(x1, y1, x2, y1, color) self.draw_line(x1, y2, x2, y2, color) ####################################################### # MAIN (test) ####################################################### if __name__ == "__main__": map_data = Map() map_data.read_map( "D:/Documents/Paper-code/Network-based-Generator-of-Moving-Objects/DataFiles/", "oldenburgGen") query_log = QueryLog(map_data) query_log.read_query( "D:/Documents/Paper-code/Network-based-Generator-of-Moving-Objects/DataFiles/oldenburgGen/", "oldenburgGen.txt") # master = Tk() width = 700 map_visualizer = MapVisualizer(map_data, query_log, width)
####################################################### def draw_rectangle(self, x1, y1, x2, y2, color): self.draw_line(x1, y1, x1, y2, color) self.draw_line(x2, y1, x2, y2, color) self.draw_line(x1, y1, x2, y1, color) self.draw_line(x1, y2, x2, y2, color) ####################################################### # MAIN (test) ####################################################### if __name__ == "__main__": map_data = Map() map_data.read_map("D:/Documents/Paper-code/Network-based-Generator-of-Moving-Objects/DataFiles/", "oldenburgGen") query_log = QueryLog(map_data) query_log.read_query("D:/Documents/Paper-code/Network-based-Generator-of-Moving-Objects/DataFiles/oldenburgGen/", "oldenburgGen.txt") # master = Tk() width = 700 map_visualizer = MapVisualizer(map_data, query_log, width)