def __init__(self, wait_dict, serve_dict, finish_dict, cancel_dict): self.__logger = Logger("RiderStatusTracker") self.__wait_dict = wait_dict self.__serve_dict = serve_dict self.__finish_dict = finish_dict self.__cancel_dict = cancel_dict
def __init__(self, uID, sT, sZ, dZ, dP, pat, srcX, srcY, destX, destY): # logger in Dispatcher self.__logger = Logger('Rider') #self.__logger.setLevel(logging.DEBUG) self.__logger.info(Rider.timestamp, "__INIT__", None, None, "Create A Rider Object") self.__id = uID self.__request_timestamp = sT self.__srcZone = sZ self.__destZone = dZ self.__default_price = dP self.__price = math.inf self.__patience = pat self.__dirID = self.__assignDirID(srcX, srcY, destX, destY) self.__shortest_time = Graph.queryTravelCost(sZ, dZ) self.__arrival_timestamp = None self.__groupID = None self.__status = WAITING self.__wait_time = 0 self.__detour_time = -1 self.__sat = 0 if self.__default_price > 100: self.__logger.warning(Rider.timestamp, "__INIT__", None, self.getID(), str(self))
def __init__(self): self.__logger = Logger('Simulation') #self.__logger.setLevel(logging.DEBUG) self.__logger.info(-1, "__INIT__", None, None, "Create Simulation Object.") self.__driver_list = RequestList() self.__rider_list = RequestList() self.__dispatcher = Dispatcher() self.__cycle = 0 self.__sim_time = []
def __init__(self): #logger in Dispatcher self.__logger = Logger('Dispatcher') self.__logger.setLevel(logging.DEBUG) self.__logger.info(Dispatcher.timestamp, "__INIT__", None, None, "Create A Dispatcher Object") #Storage for drivers and riders self.__driver_dict = {} self.__rider_wait_dict = {} self.__rider_serve_dict = {} self.__rider_finish_dict = {} self.__rider_cancel_dict = {} #Performance of driver and rider self.wait_rider={} self.no_work_driver={} self.idle_driver_before_match={} self.grp_in_4=0 self.grp_in_3=0 self.grp_in_2=0 self.grp_in_1=0 #Cluser Strategy self.__cluster_strategy = ClusteringByDir(self.__rider_wait_dict) #Matching Strategy self.__match_strategy = MatchingInQueue(self.__driver_dict, self.__rider_wait_dict, self.__rider_serve_dict) #Driver Status Tracker self.__driver_tracker = DriverStatusTracker(self.__driver_dict) #Rider Status tracker self.__rider_tracker = RiderStatusTracker(self.__rider_wait_dict, self.__rider_serve_dict, self.__rider_finish_dict, self.__rider_cancel_dict) #Driver Dict for zone_id in range(1,78): self.__driver_dict[zone_id] = {} #Rider Dict for zone_id in range(1,78): self.__rider_wait_dict[zone_id] = {} for dir_id in range(-1, 12): self.__rider_wait_dict[zone_id][dir_id] = defaultdict(dict) # for cycle in range(SIMULATION_CYCLE_START, SIMULATION_CYCLE_END): self.wait_rider[cycle] = [] self.no_work_driver[cycle] = [] for zone_id in range(0,78): self.wait_rider[cycle].append(0) self.no_work_driver[cycle].append(0)
def __init__(self, rider_waiting_dict): self.logger = Logger('ClusteringStrategy') # self.logger.setLevel(logging.DEBUG) self.logger.info(ClusteringStrategy.timestamp, "__INIT__", None, None, "Initialize ClusteringStrategy") self.__assign_gid_dict = {} self.__rider_dict = rider_waiting_dict # Assign Group ID for zone_id in range(1, 78): self.__assign_gid_dict[zone_id] = {} for dir_id in range(-1, 12): self.__assign_gid_dict[zone_id][dir_id] = 1
def __init__(self, id, pCurr): # logger in Dispatcher self.__logger = Logger('Driver') #self.__logger.setLevel(logging.DEBUG) self.__logger.info(Driver.timestamp, "__INIT__", None, None, "Create A Driver Object") self.__id = id self.__pos = pCurr self.__status = IDLE self.__riders = {} self.__trip_route = [] self.__trip_effort = 0 self.__trip_profit = 0 self.__idle_time = 0 self.__finish_trip_time = -1
def __init__(self, driver_dict): self.__logger = Logger("DriverStatusTracker") self.__driver_dict = driver_dict
def __init__(self): self.logger = Logger('MatchingStrategy')
def __init__(self): self.__logger = Logger("RequestList") #self.__logger.setLevel(logging.INFO) self.__logger.info(RequestList.timestamp, "__INIT__", None, None, "Create RequestList Object.") self.__items = []
def __init__(self, riders, route): self.logger = Logger('RoutingStrategy') self.riders = riders self.route = route