pub struct AddManager { /* private fields */ }Expand description
ADD manager for rational-valued functions.
Implementations§
Source§impl AddManager
impl AddManager
Sourcepub fn constant(&mut self, value: BigRational) -> NodeId
pub fn constant(&mut self, value: BigRational) -> NodeId
Creates a constant ADD.
Sourcepub fn variable(&mut self, var: VarId) -> NodeId
pub fn variable(&mut self, var: VarId) -> NodeId
Creates an ADD for a single variable (returns 1 if true, 0 if false).
Sourcepub fn eval(
&self,
node: NodeId,
assignment: &FxHashMap<VarId, bool>,
) -> BigRational
pub fn eval( &self, node: NodeId, assignment: &FxHashMap<VarId, bool>, ) -> BigRational
Evaluates the ADD given a variable assignment.
Sourcepub fn scale(&mut self, node: NodeId, scalar: &BigRational) -> NodeId
pub fn scale(&mut self, node: NodeId, scalar: &BigRational) -> NodeId
Multiplies an ADD by a scalar.
Sourcepub fn ite(
&mut self,
cond: NodeId,
then_add: NodeId,
else_add: NodeId,
) -> NodeId
pub fn ite( &mut self, cond: NodeId, then_add: NodeId, else_add: NodeId, ) -> NodeId
If-then-else operation for ADDs.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes in the manager.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clears the operation cache.
Sourcepub fn get_var(&self, node: NodeId) -> Option<VarId>
pub fn get_var(&self, node: NodeId) -> Option<VarId>
Gets the variable of a node, if it’s internal.
Sourcepub fn get_value(&self, node: NodeId) -> Option<&BigRational>
pub fn get_value(&self, node: NodeId) -> Option<&BigRational>
Gets the terminal value of a node, if it’s a terminal.
Trait Implementations§
Source§impl Clone for AddManager
impl Clone for AddManager
Source§fn clone(&self) -> AddManager
fn clone(&self) -> AddManager
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AddManager
impl Debug for AddManager
Source§impl Default for AddManager
impl Default for AddManager
Auto Trait Implementations§
impl Freeze for AddManager
impl RefUnwindSafe for AddManager
impl Send for AddManager
impl Sync for AddManager
impl Unpin for AddManager
impl UnsafeUnpin for AddManager
impl UnwindSafe for AddManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more