src/TrafficCoordinator.py
def increment(self, dt):
        ''' Simulator calls this method at each timestep'''
        self.dt = dt
        self.number_cars_without_reservations = len(self.bid_queue)
        #TODO:  Add something to ensure single agents can be allocated
        batch_assign_flag = False

        for bid in self.bid_queue:
            car = bid[-1]
            if car.intersection_window[0]==-1 and (car.pose.x)**2 + car.pose.y**2 <= 2.0*car.lane_width:
                batch_assign_flag = True
        
        if ((self.time - self.last_batch_assignment) > self.k_batch_intervals_time) and self.number_cars_without_reservations >= self.k_min_number_cars_without_reservations:
            batch_assign_flag = True
        

        if batch_assign_flag:
            self.bid_queue = self.one_bid_per_agent_queue(self.bid_queue)
            # self.new_batch_intersection_FCFS()    
            if len(self.bid_queue) > 0:
                reservations = self.one_swap_sort(self.bid_queue,verbose=False)
            else:
                reservations = []
            self.returned_reservations  += [reservations]
            self.last_batch_assignment = self.time    
            self.bid_queue = []
            self.max_bid_per_agent = {}
 Simulator calls this method at each timestep
Simulator calls this method at each timestep
Simulator calls this method at each timestep
def increment(self, dt):
        self.dt = dt
        self.number_cars_without_reservations = len(self.bid_queue)
        batch_assign_flag = False
        for bid in self.bid_queue:
            car = bid[-1]
            if car.intersection_window[0]==-1 and (car.pose.x)**2 + car.pose.y**2 <= 2.0*car.lane_width:
                batch_assign_flag = True
        if ((self.time - self.last_batch_assignment) > self.k_batch_intervals_time) and self.number_cars_without_reservations >= self.k_min_number_cars_without_reservations:
            batch_assign_flag = True
        if batch_assign_flag:
            self.bid_queue = self.one_bid_per_agent_queue(self.bid_queue)
            if len(self.bid_queue) > 0:
                reservations = self.one_swap_sort(self.bid_queue,verbose=False)
            else:
                reservations = []
            self.returned_reservations  += [reservations]
            self.last_batch_assignment = self.time    
            self.bid_queue = []
            self.max_bid_per_agent = {}
def increment ( self , dt ) : self . dt = dt self . number_cars_without_reservations = len ( self . bid_queue ) batch_assign_flag = False for bid in self . bid_queue : car = bid [ - 1 ] if car . intersection_window [ 0 ] == - 1 and ( car . pose . x ) ** 2 + car . pose . y ** 2 <= 2.0 * car . lane_width : batch_assign_flag = True if ( ( self . time - self . last_batch_assignment ) > self . k_batch_intervals_time ) and self . number_cars_without_reservations >= self . k_min_number_cars_without_reservations : batch_assign_flag = True if batch_assign_flag : self . bid_queue = self . one_bid_per_agent_queue ( self . bid_queue ) if len ( self . bid_queue ) > 0 : reservations = self . one_swap_sort ( self . bid_queue , verbose = False ) else : reservations = [ ] self . returned_reservations += [ reservations ] self . last_batch_assignment = self . time self . bid_queue = [ ] self . max_bid_per_agent = { }
Simulator calls this method at each timestep
Simulator calls this method at each timestep
''' Simulator calls this method at each timestep''' #TODO:  Add something to ensure single agents can be allocated # self.new_batch_intersection_FCFS()    
self
dt