pub struct DualModuleInterface {
pub unit_index: usize,
pub nodes: Vec<Option<DualNodePtr>>,
pub nodes_length: usize,
pub is_fusion: bool,
pub sum_grow_speed: Weight,
pub sum_dual_variables: Weight,
pub debug_print_actions: bool,
pub parent: Option<DualModuleInterfaceWeak>,
pub index_bias: NodeIndex,
pub children: Option<((DualModuleInterfaceWeak, NodeIndex), (DualModuleInterfaceWeak, NodeIndex))>,
/* private fields */
}Expand description
a sharable array of dual nodes, supporting dynamic partitioning; note that a node can be destructed and we do not reuse its index, leaving a blank space
Fields§
§unit_index: usizeunit index of this interface, default to 0
nodes: Vec<Option<DualNodePtr>>all the dual node that can be used to control a concrete dual module implementation
nodes_length: usizecurrent nodes length, to enable constant-time clear operation
is_fusion: boolallow pointer reuse will reduce the time of reallocation, but it’s unsafe if not owning it;
this will be automatically disabled when [DualModuleInterface::fuse] is called;
if an interface is involved in a fusion operation (whether as parent or child), it will be set.
sum_grow_speed: Weightrecord the total growing nodes, should be non-negative in a normal running algorithm
sum_dual_variables: Weightrecord the total sum of dual variables
debug_print_actions: booldebug mode: only resolve one conflict each time
parent: Option<DualModuleInterfaceWeak>the parent of this interface, when fused
index_bias: NodeIndexwhen fused, this will indicate the relative bias given by the parent
children: Option<((DualModuleInterfaceWeak, NodeIndex), (DualModuleInterfaceWeak, NodeIndex))>the two children of this interface, when fused; following the length of this child, given that fused children interface will not have new nodes anymore
Implementations§
Source§impl DualModuleInterface
impl DualModuleInterface
Sourcepub fn nodes_count(&self) -> NodeNum
pub fn nodes_count(&self) -> NodeNum
return the count of all nodes including those of the children interfaces
Sourcepub fn get_node(&self, relative_node_index: NodeIndex) -> Option<DualNodePtr>
pub fn get_node(&self, relative_node_index: NodeIndex) -> Option<DualNodePtr>
get node ptr by index; if calling from the ancestor interface, node_index is absolute, otherwise it’s relative
Sourcepub fn remove_node(&mut self, relative_node_index: NodeIndex)
pub fn remove_node(&mut self, relative_node_index: NodeIndex)
set the corresponding node index to None
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DualModuleInterface
impl !RefUnwindSafe for DualModuleInterface
impl Send for DualModuleInterface
impl Sync for DualModuleInterface
impl Unpin for DualModuleInterface
impl !UnwindSafe for DualModuleInterface
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more