src/TrafficCoordinator.py
def add_points_to_reservation_matrix(self, intersection_points_to_reserve, agent_id, reservation_interval_matrix, reservation_available_matrix):
        ''' Add list of points with start and end times to the interval matrix'''
        #TODO:  Do some pre-processing to consolidate the number of points to add since some intervals will overlap.  Iterate over each window
        for t_start, t_end, i, j in intersection_points_to_reserve:
            if (0 <= i <= self.m-1) and (0 <= j <= self.n-1):      
                reservation_interval_matrix = self.add_interval((t_start,t_end),i,j,agent_id,reservation_interval_matrix)                                        
                reservation_available_matrix[i][j] = max(t_end + self.time_buffer_interval,reservation_available_matrix[i][j]) #I'm adding a fixed buffer size
        return reservation_interval_matrix, reservation_available_matrix
 Add list of points with start and end times to the interval matrix
Add list of points with start and end times to the interval matrix
Add list of points with start and end times to the interval matrix
def add_points_to_reservation_matrix(self, intersection_points_to_reserve, agent_id, reservation_interval_matrix, reservation_available_matrix):
        for t_start, t_end, i, j in intersection_points_to_reserve:
            if (0 <= i <= self.m-1) and (0 <= j <= self.n-1):      
                reservation_interval_matrix = self.add_interval((t_start,t_end),i,j,agent_id,reservation_interval_matrix)                                        
                reservation_available_matrix[i][j] = max(t_end + self.time_buffer_interval,reservation_available_matrix[i][j]) 
        return reservation_interval_matrix, reservation_available_matrix
def add_points_to_reservation_matrix ( self , intersection_points_to_reserve , agent_id , reservation_interval_matrix , reservation_available_matrix ) : for t_start , t_end , i , j in intersection_points_to_reserve : if ( 0 <= i <= self . m - 1 ) and ( 0 <= j <= self . n - 1 ) : reservation_interval_matrix = self . add_interval ( ( t_start , t_end ) , i , j , agent_id , reservation_interval_matrix ) reservation_available_matrix [ i ] [ j ] = max ( t_end + self . time_buffer_interval , reservation_available_matrix [ i ] [ j ] ) return reservation_interval_matrix , reservation_available_matrix
Add list of points with start and end times to the interval matrix
Add list of points with start and end times to the interval matrix
''' Add list of points with start and end times to the interval matrix''' #TODO:  Do some pre-processing to consolidate the number of points to add since some intervals will overlap.  Iterate over each window #I'm adding a fixed buffer size
self
intersection_points_to_reserve
agent_id
reservation_interval_matrix
reservation_available_matrix