Beispiel #1
0
    def simplify_states(self):
        self.get_aut().purge_dead_states()
        settings.log(
            3, lambda: 'after purge_dead_states: {}'.format(self.num_states()))
        self.get_aut().purge_unreachable_states()
        settings.log(
            3, lambda: 'after purge_unreachable_states: {}'.format(
                self.num_states()))

        self.aut = self.get_aut().scc_filter()
        settings.log(3,
                     lambda: 'after scc_filter: {}'.format(self.num_states()))

        if self.num_states() < 10 & self.get_aut().is_deterministic():
            self.aut = spot.sat_minimize(self.get_aut())
            settings.log(
                3, lambda: 'after sat_minimize: {}'.format(self.num_states()))

        if settings.use_heuristics():
            self.merge_states()
        else:
            if self.num_states() < 50000:
                self.merge_states()

        return self
Beispiel #2
0
    def postprocess(self, level=None):
        settings.log(3, lambda: 'Empty: {}'.format(self.is_empty()))
        # settings.log(3, lambda: 'Universal: {}'.format(spot.is_universal(self.get_aut())))

        postprocess_settings = ['BA']
        if level is not None:
            postprocess_settings.append(level)
        if not self.aut.is_sba():
            # Use 'BA' in the option list to ensure that the automata we have is a Buchi (possible nondeterministic) automata
            if settings.use_heuristics():
                postprocess_settings.append('Deterministic')
                if level is None:
                    if self.aut.num_states() > 300:
                        postprocess_settings.append('Low')
                    elif self.aut.num_states() > 100:
                        postprocess_settings.append('Medium')
                    else:
                        postprocess_settings.append('High')

            settings.log(
                1, lambda:
                'Postprocessing (before) using {}: {} states and {} edges'.
                format(postprocess_settings, self.num_states(), self.num_edges(
                )))

            self.aut = self.aut.postprocess(*postprocess_settings)

            settings.log(
                1, lambda: 'Postprocessing (after): {} states and {} edges'.
                format(self.num_states(), self.num_edges()))
        return self
Beispiel #3
0
    def postprocess(self):
        if not self.aut.is_sba():
            # Use 'BA' in the option list to ensure that the automata we have is a Buchi (possible nondeterministic) automata
            if settings.use_heuristics():
                if self.aut.num_states() > 300:
                    postprocess_settings = ['BA', 'Deterministic', 'Low']
                elif self.aut.num_states() > 100:
                    postprocess_settings = ['BA', 'Deterministic', 'Medium']
                else:
                    postprocess_settings = ['BA', 'Deterministic', 'High']
            else:
                postprocess_settings = ['BA']

            settings.log(
                3, lambda:
                'Postprocessing (before) using {}: {} states and {} edges'.
                format(postprocess_settings, self.num_states(), self.num_edges(
                )))

            self.aut = self.aut.postprocess(*postprocess_settings)

            settings.log(
                3, lambda: 'Postprocessing (after): {} states and {} edges'.
                format(self.num_states(), self.num_edges()))
        return self