pub struct DDManager {
    pub nodes: HashMap<NodeID, DDNode>,
    order: Vec<u32>,
    var2nodes: Vec<HashSet<DDNode>>,
    c_table: HashMap<(NodeID, NodeID, NodeID), NodeID>,
}
Expand description

Container combining the nodes list, unique tables, information about current variable ordering and computed table.

Fields

nodes: HashMap<NodeID, DDNode>

Node List

order: Vec<u32>

Variable ordering: order[v.0] is the depth of variable v in the tree

var2nodes: Vec<HashSet<DDNode>>

Unique Table for each variable. Note that the order (depth) in the BDD may be different than the order of this vec, and is only determined by order!

c_table: HashMap<(NodeID, NodeID, NodeID), NodeID>

Computed Table: maps (f,g,h) to ite(f,g,h)

Implementations

Find the variable at specified level

Swap layer containing specified variable first to the bottom of the BDD, then to the top, and then to the position which resulted in smallest BDD size. Optional parameter max_increase stops swapping in either direction once the difference between BDD size and current optimum exceeds threshold.

Perform sifting for every layer containing at least one variable. If progressbar is true, display a progress bar in the terminal which shows the number of layers already processed. See Self::sift_single_var() for max_increase parameter.

Builds a BDD from a CNF read from DIMACS.

  • instance - Input CNF
  • order - Optional initial variable ordering, see crate::static_ordering for implementations
  • options - DVO and progress bar settings
let mut instance = dimacs::parse_dimacs("examples/trivial.dimacs");
let order = Some(static_ordering::force(&instance));
let dvo = dvo_schedules::SiftingAtThreshold::new(5);
let (man, bdd) = DDManager::from_instance(
    &mut instance,
    order,
    Options::default().with_progressbars().with_dvo(dvo.into()),
).unwrap();

Collect all nodes that are part of the specified function

Generate graphviz for the provided function, not including any graph nodes not part of the function. TODO: Graphviz of all functions in DDManager

Reduces the BDD. This changes Node IDs, the new Node ID of the function passed to the function is returned. All other known Node IDs are invalid after reduce. Note: Reduction does not imply removing nodes not part of the specified function. Other functions may be present in the tree (multiple root nodes, or root above function).

See also “Graph-Based Algorithms for Boolean Function Manipulation” by Bryant (10.1109/TC.1986.1676819)

Swaps graph layers of variables a and b. Requires a to be directly above b. Performs reduction which may change NodeIDs. Returns new NodeID of f.

Initialize the BDD with zero and one constant nodes

Ensure order vec is valid up to specified variable

Insert Node. ID is assigned for nonterminal nodes (var != 0). This does not check the unique table, you should do so before using!

Search for Node, create if it doesnt exist

Find top variable: Highest in tree according to order

Creates an XOR “ladder”

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.