The unique table holds all nodes and is periodically resized when out of memory. Memory allocationīy hashconsing nodes in the unique table, the library ensures that two boolean functions are equal if and only if their pointers (indices) are equal. To uphold this invariant, the library implements a mark, sweep, and shift garbage collector that compacts nodes when necessary. This allows for various optimizations when looking up nodes in the unique table. Nodes are kept in a memory pool and the library maintains the invariant that a node allocated before another will appear earlier in this pool. This means that users of the library do not need to perform any reference counting, which is common in BDD libraries. The DD reference table uses WeakReference wrappers to integrate with the. User references to nodes ( DD type) are maintained through a separate (smaller) table. Internally decision diagram nodes are represented using integer ids that are bit-packed with other metadata such as a garbage collection mark bit, and a complemented bit. Chain-reduced binary decision diagrams ( link).The library is based on the cache-optimized implementation of decision diagrams here, and implements two variants: MSB_FIRST ) var f0 = f var f1 = f Implementation Details the bit ordering will alternate between the two variables with the MSB ordering. CreateInt64 ( ( i ) => ( i + 3 ) % 64 ) // there will be two integers in 'f', each is a 64 bit integer. LSB_FIRST ) // the ith variable in 'e' will be in the (i + 3) % 64 position. the variables in 'd' will be in order of least significat bits first. MSB_FIRST ) // all bit variables for 'd' will be after all variables for 'c'. the variables in 'c' will be allocated in order of most significant bits first. CreateBool ( ) // all bit variables for 'c' will be after 'a' and 'b'. var manager = new DDManager ( ) // the order will be 'a' before 'b'. create a manager that uses traditional binary decision diagrams. You can control the decision diagram variable ordering to improve performance in several ways: ToBitvector ( ) ) // greater than or eq signed (>=) ToBitvector ( ) ) // greater than or eq (>=) DD bv13 = manager. ToBitvector ( ) ) // less than () DD bv12 = manager. ToBitvector ( ) ) // equality (=) DD bv8 = manager. ToBitvector ( ) ) // if g then a else b DD bv7 = manager. ToBitvector ( ) ) // subtraction (-) BitVector bv6 = manager. ToBitvector ( ) ) // addition (+) BitVector bv5 = manager. ToBitvector ( ) ) // bitwise negation (~) BitVector bv4 = manager. ToBitvector ( ) ) // bitwise or (|) BitVector bv3 = manager. ToBitvector ( ) ) // bitwise and (&) BitVector bv2 = manager. CreateInterleavedInt16 ( 2 ) var a = intvars var b = intvars BitVector bv1 = manager. an interleaved ordering tends to perform the best for integer variables that are // combined with other variables using arithmetic or comparision operations. CreateBool ( ) // create two 16-bit integer variables with an interleaved variable ordering. The library supports negation, disjunction, conjunction, if-then-else, if-and-only-if, and implication. Get (b ) // valueb = true int valuec = assignment. Get (a ) // valuea = false bool valueb = assignment. Sat (f4 ) // get the values back as C# objects bool valuea = assignment. And (f2, f3 ) ) // get a satisfying assignment for a formula. a bitvector represents a set of integers by using one DD per bit in the integer. Id ( ) ) // create a DD representing whether 1 <= c <= 4 and c != 1. the Id() method returns the identity DD for the variable. CreateInt32 ( ) // take the logical or of two variables. var manager = new DDManager ( ) // allocate three variables, two booleans and one 32-bit integer // the internal ordering will match the order allocated from the manager. alternatively use `new DDManager()` for the chain-reduced variant.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |