コード例 #1
0
ファイル: Slot.py プロジェクト: trindqb/ParkingLot
 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
コード例 #2
0
ファイル: Slot.py プロジェクト: trindqb/ParkingLot
 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
コード例 #3
0
ファイル: Vehicle.py プロジェクト: trindqb/ParkingLot
 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
コード例 #4
0
 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
コード例 #5
0
 def InitVehicle(Type):
     if (Type == 'A'):
         Destination = Location(XD, YD)
     elif (Type == 'B'):
         Destination = Location(XD, -YD)
     elif (Type == 'C'):
         Destination = Location(-XD, YD)
     elif (Type == 'D'):
         Destination = Location(-XD, -YD)
     else:
         Destination = Location.InitDestination()
     TmpA = Location.InitLocation()
     while (-LOW_BOUND <= TmpA[X]) and (TmpA[X] <= LOW_BOUND) and (
             -SUP_BOUND <= TmpA[Y]) and (TmpA[Y] <= SUP_BOUND):
         TmpA = Location.InitLocation()
     TmpT = random.uniform(CONST_SUP_TIME, CONST_INF_TIME)
     TmpP = ManagerPrefer()
     TmpM = Location(0, 0)
     TmpC = 0
     return TmpA, Destination, TmpT, TmpP, TmpM, TmpC
コード例 #6
0
ファイル: ParkingLot.py プロジェクト: trindqb/ParkingLot
 def InitData(Type):
     if (Type == 'A'):
         Own = Location(XD, YD)
     elif (Type == 'B'):
         Own = Location(XD, -YD)
     elif (Type == 'C'):
         Own = Location(-XD, YD)
     elif (Type == 'D'):
         Own = Location(-XD, -YD)
     else:
         Own = Location.InitDestination()
     Xaxis = Own[X] / XD
     Yaxis = Own[Y] / YD
     TmpS = []
     for x in range(1, LOW_BOUND):
         for y in range(1, SUP_BOUND):
             TmpS.append(
                 Slot([
                     Location(x * Xaxis, y * Yaxis),
                     random.uniform(CONST_SUP_FEE, CONST_INF_FEE), True,
                     ManagerPrefer(),
                     Location(0, 0), 0
                 ]))
     return TmpS, Own