def CalculatePrefer(self, ListVehicle): tmp = ManagerPrefer() for subVehicle in ListVehicle: tmpLocation = subVehicle[ID] tmpCost = self[F] * subVehicle[PT] tmp.add(Prefer(tmpLocation, tmpCost)) Descending(tmp) self[P] = tmp
def CalculatePrefer(self,ListVehicle): tmp = ManagerPrefer() for subVehicle in ListVehicle: tmpLocation = subVehicle[ID] tmpCost = self[F]*subVehicle[PT] tmp.add(Prefer(tmpLocation,tmpCost)) Descending(tmp) self[P] = tmp
def CalculatePrefer(self,Parking,Destination): TmpP = ManagerPrefer() for Slot in Parking['SlotList']: TmpLocation = Slot[ID] TmpCost = Slot[F]*self[PT] + CONST_COST_DRIVING*(self[ID] - Slot[ID])/10 + CONST_COST_WALKING*(Slot[ID] - Destination)/10 TmpP.add(Prefer(TmpLocation,TmpCost)) Ascending(TmpP.ListPrefer) self[P] = TmpP
def CalculatePrefer(self, Parking, Destination): TmpP = ManagerPrefer() for Slot in Parking['SlotList']: TmpLocation = Slot[ID] TmpCost = Slot[F] * self[PT] + CONST_COST_DRIVING * ( self[ID] - Slot[ID]) / 10 + CONST_COST_WALKING * ( Slot[ID] - Destination) / 10 TmpP.add(Prefer(TmpLocation, TmpCost)) Ascending(TmpP.ListPrefer) self[P] = TmpP