예제 #1
0
    def get_global_hypothesis(self, tracks, conflicting_tracks):
        """
        Generate a global hypothesis by finding the maximum weighted independent
        set of a graph with tracks as vertices, and edges between conflicting tracks.
        """
        gh_graph = WeightedGraph()
        for index, track in enumerate(tracks):
            s = track.get_track_score()
            gh_graph.add_weighted_vertex(str(index), s)

        gh_graph.set_edges(conflicting_tracks)

        mwis_ids = gh_graph.mwis()
        
        return mwis_ids
예제 #2
0
    def global_hypothesis(self, track_trees, conflicting_tracks):
        """
        Generate a global hypothesis by finding the maximum weighted independent
        set of a graph with tracks as vertices, and edges between conflicting tracks.
        """
        logging.info("Running MWIS on weighted track trees...\n")
        gh_graph = WeightedGraph()
        for index, kalman_filter in enumerate(track_trees):
            gh_graph.add_weighted_vertex(str(index),
                                         kalman_filter.get_track_score())

        gh_graph.set_edges(conflicting_tracks)

        mwis_ids = gh_graph.mwis()
        logging.info("Completed MWIS.\n")

        return mwis_ids
def global_hypothesis(track_trees, t):

    MWIS_tracks = []
    gh_graph = WeightedGraph()

    tracks = [item for sublist in track_trees for item in sublist]

    if tracks:

        conflicting_tracks = []

        for track_index, track in enumerate(tracks):
            for conflict_index, conflict_track in enumerate(
                    tracks[track_index:]):
                conflict_index += track_index

                if any(x in track.get_past_measurements()
                       for x in conflict_track.get_past_measurements()):
                    if track_index != conflict_index:
                        conflicting_tracks.append(
                            (track_index, conflict_index))

        for index, kalman_filter in enumerate(tracks):
            gh_graph.add_weighted_vertex(str(index),
                                         kalman_filter.get_score(t))

        gh_graph.set_edges(conflicting_tracks)

        mwis_ids = gh_graph.mwis()

        for index in list(mwis_ids):
            MWIS_tracks.append([tracks[index]])

        for track_index, track in enumerate(MWIS_tracks):
            track = track[0]
            for conflict_index, conflict_track in enumerate(MWIS_tracks):
                conflict_track = conflict_track[0]
                if abs(track.get_state() - conflict_track.get_state()
                       ) < 10 and conflict_track.is_con() and track.is_con():
                    if track_index != conflict_index:
                        if track.get_score(t) > conflict_track.get_score(t):
                            track.kill()

    return MWIS_tracks