[−][src]Struct ddo::core::implementation::mdd::flat::FlatMDD
This is the structure implementing flat MDD. This is a kind of
bounded width MDD which offers a real guarantee wrt to the maximum amount
of used memory. This should be your go-to implementation of a bounded-width
MDD, and it is the default type of MDD built by the mdd_builder
.
A flat mdd is highly efficient in the sense that it only maintains one 'slice' of the current MDD unrolling. That is, at any time, it only knows the current layer, and the next layer (being developed). All previous layers are irremediably forgotten (but this causes absolutely no harm). Alongside the current and next layers, this structure also knows of a 3rd layer which materializes the last exact layer (exact cutset) of this mdd. Moving from one layer to the next (after the next layer has been expanded) is extremely inexpensive as it only amounts to swapping two integer indices.
Remark
So far, the FlatMDD
implementation only supports the last exact layer
(LEL) kind of exact cutset. This might change in the future, but it is your
only option at the time being since it keeps the code clean and simple.
Note
The behavior of this MDD is heavily dependent on the configuration you
provide. Therefore, and although a public constructor exists for this
structure, it it recommended that you build this type of mdd using the
mdd_builder
functionality as shown in the following examples.
Example
let problem = MockProblem; let relaxation = MockRelax; // Following line configure and builds a flat mdd. let flat_mdd = mdd_builder(problem, relaxation).build(); // ... or equivalently (where you emphasize the use of a *flat* mdd) let problem = MockProblem; let relaxation = MockRelax; let flat_mdd = mdd_builder(problem, relaxation).into_flat(); // Naturally, you can also provide configuration parameters to customize // the behavior of your MDD. For instance, you can use a custom max width // heuristic as follows (below, a fixed width) let problem = MockProblem; let relaxation = MockRelax; let flat_mdd = mdd_builder(problem, relaxation) .with_max_width(FixedWidth(100)) .build();
Methods
impl<T, C> FlatMDD<T, C> where
T: Hash + Eq + Clone,
C: Config<T>,
[src]
T: Hash + Eq + Clone,
C: Config<T>,
Private functions
pub fn new(config: C) -> Self
[src]
Constructor, uses the given config to parameterize the mdd's behavior
Trait Implementations
impl<T: Clone, C: Clone> Clone for FlatMDD<T, C> where
T: Hash + Eq + Clone,
C: Config<T>,
[src]
T: Hash + Eq + Clone,
C: Config<T>,
impl<T, C> MDD<T> for FlatMDD<T, C> where
T: Hash + Eq + Clone,
C: Config<T>,
[src]
T: Hash + Eq + Clone,
C: Config<T>,
FlatMDD implements the MDD abstract data type. Check its documentation for further details.
fn mdd_type(&self) -> MDDType
[src]
fn root(&self) -> Node<T>
[src]
fn exact(&mut self, root: &Node<T>, best_lb: i32)
[src]
fn restricted(&mut self, root: &Node<T>, best_lb: i32)
[src]
fn relaxed(&mut self, root: &Node<T>, best_lb: i32)
[src]
fn consume_cutset<F>(&mut self, f: F) where
F: FnMut(T, NodeInfo),
[src]
F: FnMut(T, NodeInfo),
fn is_exact(&self) -> bool
[src]
fn best_value(&self) -> i32
[src]
fn best_node(&self) -> &Option<NodeInfo>
[src]
fn longest_path(&self) -> Vec<Decision>
[src]
Auto Trait Implementations
impl<T, C> RefUnwindSafe for FlatMDD<T, C> where
C: RefUnwindSafe,
T: RefUnwindSafe,
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, C> Send for FlatMDD<T, C> where
C: Send,
T: Send,
C: Send,
T: Send,
impl<T, C> Sync for FlatMDD<T, C> where
C: Sync,
T: Sync,
C: Sync,
T: Sync,
impl<T, C> Unpin for FlatMDD<T, C> where
C: Unpin,
T: Unpin,
C: Unpin,
T: Unpin,
impl<T, C> UnwindSafe for FlatMDD<T, C> where
C: UnwindSafe,
T: UnwindSafe,
C: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,