コード例 #1
0
ファイル: simpleManager.py プロジェクト: 702nADOS/sumo
 def cyberCarArrived(self, vehicleID, edge):
     step = vehicleControl.getStep()
     footEdge = edge.replace("cyber", "footmain")
     wait = 0
     load = []
     for person, target in self.cyberCarLoad.get(vehicleID, []):
         if target == footEdge:
             statistics.personUnloaded(person, step)
             wait += WAIT_PER_PERSON
         else:
             load.append((person, target))
     while self.personsWaitingAt.get(footEdge, []) and len(load) < vehicleControl.getCapacity():
         person, target = self.personsWaitingAt[footEdge].pop(0)
         vehicleControl.leaveStop(person)
         statistics.personLoaded(person, step)
         load.append((person, target))
         wait += WAIT_PER_PERSON
     vehicleControl.leaveStop(vehicleID, delay=wait)
     if edge == "cyberout" or edge == "cyberin":
         row = -1
     else:
         row = int(edge[5])
     if row < DOUBLE_ROWS - 1:
         vehicleControl.stopAt(
             vehicleID, "cyber%sto%s" % (row + 1, row + 2))
     else:
         vehicleControl.stopAt(vehicleID, "cyberout")
     self.cyberCarLoad[vehicleID] = load
コード例 #2
0
 def checkBoarding(self):
     step = vehicleControl.getStep()
     wait = 0
     running = []
     for task in self.running:
         if task.target == self.position:
             statistics.personUnloaded(task.person.id, step)
             self.load -= 1
             wait += WAIT_PER_PERSON
             self.costMatrix[(task.source,
                              task.target)] = step - task.startStep
             self.totalEstimatedCost -= task.estCost
         else:
             running.append(task)
     self.running = running
     if self.load < vehicleControl.getCapacity():
         tasks = []
         for task in self.tasks:
             if task.source == self.position and self.load < vehicleControl.getCapacity(
             ):
                 vehicleControl.leaveStop(task.person.id)
                 statistics.personLoaded(task.person.id, step)
                 self.load += 1
                 wait += WAIT_PER_PERSON
                 task.startStep = step
                 self.running.append(task)
             else:
                 tasks.append(task)
         self.tasks = tasks
     self._findNextTarget(wait)
コード例 #3
0
 def cyberCarArrived(self, vehicleID, edge):
     step = vehicleControl.getStep()
     footEdge = edge.replace("cyber", "footmain")
     wait = 0
     load = []
     for person, target in self.cyberCarLoad.get(vehicleID, []):
         if target == footEdge:
             statistics.personUnloaded(person, step)
             wait += WAIT_PER_PERSON
         else:
             load.append((person, target))
     while self.personsWaitingAt.get(
             footEdge, []) and len(load) < vehicleControl.getCapacity():
         person, target = self.personsWaitingAt[footEdge].pop(0)
         vehicleControl.leaveStop(person)
         statistics.personLoaded(person, step)
         load.append((person, target))
         wait += WAIT_PER_PERSON
     vehicleControl.leaveStop(vehicleID, delay=wait)
     if edge == "cyberout" or edge == "cyberin":
         row = -1
     else:
         row = int(edge[5])
     if row < DOUBLE_ROWS - 1:
         vehicleControl.stopAt(vehicleID,
                               "cyber%sto%s" % (row + 1, row + 2))
     else:
         vehicleControl.stopAt(vehicleID, "cyberout")
     self.cyberCarLoad[vehicleID] = load
コード例 #4
0
 def checkBoarding(self):
     step = vehicleControl.getStep()
     wait = 0
     running = []
     for task in self.running:
         if task.target == self.position:
             statistics.personUnloaded(task.person.id, step)
             self.load -= 1
             wait += WAIT_PER_PERSON
             self.costMatrix[(task.source, task.target)] = step - task.startStep
             self.totalEstimatedCost -= task.estCost
         else:
             running.append(task)
     self.running = running
     if self.load < vehicleControl.getCapacity(): 
         tasks = []
         for task in self.tasks:
             if task.source == self.position and self.load < vehicleControl.getCapacity():
                 vehicleControl.leaveStop(task.person.id)
                 statistics.personLoaded(task.person.id, step)
                 self.load += 1
                 wait += WAIT_PER_PERSON
                 task.startStep = step
                 self.running.append(task)
             else:
                 tasks.append(task)
         self.tasks = tasks
     self._findNextTarget(wait)