Struct ddo::FixedWidth
source · pub struct FixedWidth(pub usize);
Expand description
This strategy specifies a fixed maximum width for all the layers of an approximate MDD. This is a static heuristic as the width will remain fixed regardless of the approximate MDD to generate.
§Example
Assuming a fixed width of 100, and problem with 5 variables (0..=4). The heuristic will return 100 regardles of the suproblem being processed.
let heuristic = FixedWidth(100); // assume a fixed width of 100
// assume the exsitence of whatever subroblem you like..
let subproblem = SubProblem {state: Arc::new('a'), value: 42, ub: 100, depth: 0, path: vec![]};
// still, the heuristic always return 100.
assert_eq!(100, heuristic.max_width(&subproblem));
§Typical usage example
Typically, you will only ever create a FixedWidth policy when instanciating your solver. The following example shows how you create a solver that imposes a fixed maximum layer width to all layers it compiles.
let mut solver = DefaultSolver::new(
&problem,
&relaxation,
&heuristic,
&FixedWidth(100), // all DDs will be compiled with a maximum width of 100 nodes
&dominance,
&cutoff,
&mut fringe);
Tuple Fields§
§0: usize
Trait Implementations§
source§impl Clone for FixedWidth
impl Clone for FixedWidth
source§fn clone(&self) -> FixedWidth
fn clone(&self) -> FixedWidth
Returns a copy of the value. Read more
1.0.0 · 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 FixedWidth
impl Debug for FixedWidth
source§impl<X> WidthHeuristic<X> for FixedWidth
impl<X> WidthHeuristic<X> for FixedWidth
source§fn max_width(&self, _: &SubProblem<X>) -> usize
fn max_width(&self, _: &SubProblem<X>) -> usize
Estimates a good maximum width for an MDD rooted in the given state
impl Copy for FixedWidth
Auto Trait Implementations§
impl RefUnwindSafe for FixedWidth
impl Send for FixedWidth
impl Sync for FixedWidth
impl Unpin for FixedWidth
impl UnwindSafe for FixedWidth
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