pub struct NodeFlags(/* private fields */);
Expand description
This structure stores a compact set of flags relating to a given node. So far, it maintains the following:
- Exact which is true iff the current node is exact
- Relaxed which is true iff the current node is relaxed (result of a merge)
§Remark
It might seem as though ( \neg exact \equiv relaxed ). But actually it is not the case. The subtlety is the following: ( relaxed \implies \neg exact ) and ( exact \implies \neg relaxed ) but ( \neg exact \not\implies relaxed ).
In other words, a node can be inexact and not relaxed either. This happens when a node is not the result of a merge operation but one of its ancestors is.
§Important Note
For the sake of clarity, and to keep the code simple and lean, it was decided that the setters would not enforce the above relationships. The only exception to this rule being that a node is always considered inexact when the relaxed flag is on.
§Default
By default, a node is considered exact, not relaxed and not feasible (because this field is not set until local bounds computation).
Implementations§
source§impl NodeFlags
impl NodeFlags
sourcepub const F_ABOVE_CUTSET: u8 = 64u8
pub const F_ABOVE_CUTSET: u8 = 64u8
The position of the above cut-set flag.
sourcepub fn new(relaxed: bool) -> Self
pub fn new(relaxed: bool) -> Self
Creates a new set of flags, either initialized with exact on or with relaxed on.
sourcepub fn new_relaxed() -> Self
pub fn new_relaxed() -> Self
Creates a new set of flags having only the relaxed flag turned on.
sourcepub fn is_exact(self) -> bool
pub fn is_exact(self) -> bool
Returns true iff the exact flag is on and the relaxed flag is off
sourcepub fn is_relaxed(self) -> bool
pub fn is_relaxed(self) -> bool
Returns true iff the exact flag is turned on
sourcepub fn is_above_cutset(self) -> bool
pub fn is_above_cutset(self) -> bool
Returns true iff the above cut-set flag is turned on
sourcepub fn is_deleted(self) -> bool
pub fn is_deleted(self) -> bool
Returns true iff the deleted flag is turned on
sourcepub fn is_pruned_by_cache(self) -> bool
pub fn is_pruned_by_cache(self) -> bool
Returns true iff the cache flag is turned on
sourcepub fn set_relaxed(&mut self, relaxed: bool)
pub fn set_relaxed(&mut self, relaxed: bool)
Sets the relaxed flat to the given value
sourcepub fn set_marked(&mut self, marked: bool)
pub fn set_marked(&mut self, marked: bool)
Sets the marked flag to the given value
pub fn set_cutset(&mut self, cutset: bool)
pub fn set_above_cutset(&mut self, above: bool)
sourcepub fn set_deleted(&mut self, deleted: bool)
pub fn set_deleted(&mut self, deleted: bool)
Sets the deleted flag to the given value
sourcepub fn set_pruned_by_cache(&mut self, cache: bool)
pub fn set_pruned_by_cache(&mut self, cache: bool)
Sets the cache flag to the given value
sourcepub fn test(self, mask: u8) -> bool
pub fn test(self, mask: u8) -> bool
Checks whether all the flags encoded in the given mask are turned on. Otherwise, it returns false