src/TrafficCoordinator.py
def remove_expired_intervals_from_matrix(self, current_time=None):
        ''' Helper function to frequently cleanup the matrix interval dictionary with expired intervals'''
        if current_time == None:
            current_time = self.time 
        epsilon = 0.001
        for i in self.time_matrix_intervals.keys():
            for j in self.time_matrix_intervals[i].keys():
                cleaned_list_of_intervals = []
                for (start, end, agent_id) in self.time_matrix_intervals[i][j]:
                    if current_time < (end + epsilon):
                        cleaned_list_of_intervals += [(start, end, agent_id)]
                        # self.time_matrix_intervals[i][j].remove((start,end))
                self.time_matrix_intervals[i][j] = cleaned_list_of_intervals
 Helper function to frequently cleanup the matrix interval dictionary with expired intervals
Helper function to frequently cleanup the matrix interval dictionary with expired intervals
Helper function to frequently cleanup the matrix interval dictionary with expired intervals
def remove_expired_intervals_from_matrix(self, current_time=None):
        if current_time == None:
            current_time = self.time 
        epsilon = 0.001
        for i in self.time_matrix_intervals.keys():
            for j in self.time_matrix_intervals[i].keys():
                cleaned_list_of_intervals = []
                for (start, end, agent_id) in self.time_matrix_intervals[i][j]:
                    if current_time < (end + epsilon):
                        cleaned_list_of_intervals += [(start, end, agent_id)]
                self.time_matrix_intervals[i][j] = cleaned_list_of_intervals
def remove_expired_intervals_from_matrix ( self , current_time = None ) : if current_time == None : current_time = self . time epsilon = 0.001 for i in self . time_matrix_intervals . keys ( ) : for j in self . time_matrix_intervals [ i ] . keys ( ) : cleaned_list_of_intervals = [ ] for ( start , end , agent_id ) in self . time_matrix_intervals [ i ] [ j ] : if current_time < ( end + epsilon ) : cleaned_list_of_intervals += [ ( start , end , agent_id ) ] self . time_matrix_intervals [ i ] [ j ] = cleaned_list_of_intervals
Helper function to frequently cleanup the matrix interval dictionary with expired intervals
Helper function to frequently cleanup the matrix interval dictionary with expired intervals
''' Helper function to frequently cleanup the matrix interval dictionary with expired intervals''' # self.time_matrix_intervals[i][j].remove((start,end))
self
current_time