Пример #1
0
    def __call__(self, solver):
        """Handle Options"""
        pico = solver.pico
        if self.random_seed is not None:
            picosat.picosat_set_seed(pico, self.random_seed)

        if self.preprocessing is True:
            picosat.picosat_set_plain(pico, 0)
        else:
            picosat.picosat_set_plain(pico, 1)

        if self.propagation_limit is not None:
            picosat.picosat_set_propagation_limit(pico, self.propagation_limit)

        if self.more_important_lit is not None:
            for x in self.more_important_lit:
                lit = solver._get_var_id(x)  #pylint: disable=protected-access
                picosat.picosat_set_more_important_lit(pico, lit)

        if self.less_important_lit is not None:
            for x in self.less_important_lit:
                lit = solver._get_var_id(x)  #pylint: disable=protected-access
                picosat.picosat_set_less_important_lit(pico, lit)

        if self.global_default_phase is not None:
            picosat.picosat_set_global_default_phase(pico,
                                                     self.global_default_phase)

        if self.output is not None:
            self._log_file_handler = picosat.picosat_set_output(
                pico, self.output)

        if self.enable_trace_generation:
            rv = picosat.picosat_enable_trace_generation(pico)
            if rv == 0:
                raise PysmtValueError("Picosat: Cannot enable Trace"
                                      " Generation")

        if self.verbosity > 0:
            picosat.picosat_set_verbosity(pico, self.verbosity)
Пример #2
0
    def __call__(self, solver):
        """Handle Options"""
        pico = solver.pico
        if self.random_seed is not None:
            picosat.picosat_set_seed(pico, self.random_seed)

        if self.preprocessing is True:
            picosat.picosat_set_plain(pico, 0)
        else:
            picosat.picosat_set_plain(pico, 1)

        if self.propagation_limit is not None:
            picosat.picosat_set_propagation_limit(pico,
                                                  self.propagation_limit)

        if self.more_important_lit is not None:
            for x in self.more_important_lit:
                lit = solver._get_var_id(x) #pylint: disable=protected-access
                picosat.picosat_set_more_important_lit(pico, lit)

        if self.less_important_lit is not None:
            for x in self.less_important_lit:
                lit = solver._get_var_id(x) #pylint: disable=protected-access
                picosat.picosat_set_less_important_lit(pico, lit)

        if self.global_default_phase is not None:
            picosat.picosat_set_global_default_phase(pico,
                                                     self.global_default_phase)

        if self.output is not None:
            self._log_file_handler = picosat.picosat_set_output(pico, self.output)

        if self.enable_trace_generation:
            rv = picosat.picosat_enable_trace_generation(pico)
            if rv == 0: raise PysmtValueError("Picosat: Cannot enable Trace"
                                              " Generation")

        if self.verbosity > 0:
            picosat.picosat_set_verbosity(pico, self.verbosity)