def __init__(self): super(BDDStrategy, self).__init__() # We will have a state collection just in order to provide a context # for states (FIXME?) self.states = strategy.StateCollection() self.strategy = None self.var_name_to_BDD = {} self.BDD_to_var_name = {} self.strat_type_var = None self.mgr = pycudd.DdManager() self.mgr.SetDefault() # TODO: why is garbage collection crashing?? :( [e.g. on firefighting] self.mgr.DisableGarbageCollection()
def __init__(self, environment, logic, options=None): Solver.__init__(self, environment=environment, logic=logic, options=options) self.mgr = environment.formula_manager self.ddmanager = pycudd.DdManager() self.converter = BddConverter(environment=self.environment, ddmanager=self.ddmanager) # This stack keeps a pair (Expr, Bdd), with the semantics that # the bdd at the i-th element of the list contains the bdd of # the conjunction of all previous expressions. # The construction of the Bdd is done during solve() self.assertions_stack = None self.reset_assertions() # Initialize the stack self.backtrack = [] self.latest_model = None
def __init__(self): # BDD engine self.mgr = pycudd.DdManager() self.mgr.SetDefault() # Boolean constants self.T = self.mgr.One() self.F = self.mgr.Zero() # Conditional symbol table for variables self.variables = defaultdict( lambda: [VariableEntry(None, self.T, Flavor.RECURSIVE)]) # None means the variable is undefined. Variables are # recursively-expanded by default, e.g., when += is used on an # undefined variable. # Mapping of boolean variable names to BDD variable number. # Automatically increments the variable number. self.boolean_variables = defaultdict(lambda: BooleanVariable( self.mgr.IthVar(len(self.boolean_variables)), len(self.boolean_variables)))
sys.exit(1) print "%s: ordering %d variables..." % (cur_time(), len(used_vars)) used_vars.sort(cmp_vars) f = open('vars.ord', 'w+') var_order = {} for i, v in enumerate(used_vars): var_order[v] = i f.write("%d -> %s\n" % (i, v)) f.close() smv_vars = mk_smv_vars(used_vars) write_smv_template(used_vars, smv_vars) mgr = pycudd.DdManager() mgr.SetDefault() print "%s: parsing again + constructing BDDs..." % cur_time() bdder = Bdder(mgr, var_order) parser = Parser(bdder.let_to_bdd) parser.parse_forms(filename) print "%s: saving BDDs..." % cur_time() # TODO: plumbing code, extract into a separate function DDDMP_MODE_TEXT = ord('A') # undefined in pycudd DDDMP_VAR_MATCHNAMES = 3 # undefined in pycudd dds = pycudd.DdArray(1) dds[0] = bdder.bdd_map["R"] dd_names = pycudd.StringArray(1) dd_names[0] = "TRANS"
def init_cudd(): global cudd cudd = pycudd.DdManager() cudd.SetDefault() #cudd.AutodynEnable(5) # SIFT_CONV cudd.AutodynEnable(4) # SIFT