[−][src]Trait ddo::core::implementation::mdd::config::Config
The config trait describes the configuration of an MDD. In other words, it encapsulates the configurable behavior (problem, relaxation, heuristics,..) of an MDD. Such a configuration is typically obtained from a builder.
Required methods
fn root_node(&self) -> Node<T>
Yields the root node of the (exact) MDD standing for the problem to solve.
fn impacted_by(&self, state: &T, v: Variable) -> bool
This method returns true iff taking a decision on variable
might
have an impact (state or longest path) on a node having the given state
fn load_vars(&mut self, root: &Node<T>)
Returns the minimal set of free variables for the given problem
when
starting an exploration in the given node
.
fn nb_free_vars(&self) -> usize
Returns the number of variables which may still be decided upon in this
unrolling of the (approximate) MDD. Note: This number varies during the
unrolling of the MDD. Whenever you call remove_var
, this number should
decrease.
fn select_var(&self, current: Layer<T>, next: Layer<T>) -> Option<Variable>
Returns the best variable to branch on from the set of 'free' variables
(variables that may still be branched upon in this unrolling of the MDD).
It returns None
in case no branching is useful (ie when no decision is
left to make, etc...).
fn remove_var(&mut self, v: Variable)
Removes v
from the set of free variables (which may be branched upon).
That is, it alters the configuration so that v
is considered to have
been assigned with a value. Note: As a side effect, it should decrease
the value of nb_free_vars
and make v
impossible to select (during
this unrolling of the MDD) with select_var
.
fn domain_of<'a>(&self, state: &'a T, v: Variable) -> Domain<'a>
Returns the domain of variable v
in the given state
. These are the
possible values that might possibly be affected to v
when the system
has taken decisions leading to state
.
fn max_width(&self) -> usize
Returns the maximum width allowed for the next layer in this unrolling of the MDD.
fn branch(&self, state: &T, info: Arc<NodeInfo>, d: Decision) -> Node<T>
Returns the node which is reached by taking decision d
from the node
(state
, info
).
fn estimate_ub(&self, state: &T, info: &NodeInfo) -> i32
Returns a rough upper bound on the maximum objective function value
reachable by passing through the node characterized by the given
state
and node info
.
fn compare(&self, x: &Node<T>, y: &Node<T>) -> Ordering
Compares two nodes according to the node selection ranking. That is,
it derives an ordering for x
and y
where the Gretest node has more
chances of remaining in the layer (in case a restriction or merge needs
to occur). In other words, if x > y
according to this ordering, it
means that x
is more promising than y
. A consequence of which,
x
has more chances of not being dropped/merged into an other node.
fn merge_nodes(&self, nodes: &[Node<T>]) -> Node<T>
This method merges the given set of nodes
into a new inexact node.
The role of this method is really to only provide an inexact
node to use as a replacement for the selected nodes
. It is the MDD
implementation 's responsibility to take care of maintaining a cutset.
fn transition_state(&self, state: &T, d: Decision) -> T
This method is just a shortcut to get the next state by applying the
transition (as described per the problem) from state
and taking the
given decision
.
Visually
Calling this method returns (new state).
(state) --- [decision] ---> (new_state)
fn transition_cost(&self, state: &T, d: Decision) -> i32
This method is just a shortcut to get the cost of going to next state by
applying the transition cost function (as described per the problem);
starting from state
and taking the given decision
.
Visually
Calling this method returns the cost of taking decision.
(state) --- [decision] ---> (new_state)
^
|
cost of taking decision
Implementors
impl<T, PB, RLX, LV, VS, WIDTH, NS> Config<T> for MDDConfig<T, PB, RLX, LV, VS, WIDTH, NS> where
T: Eq + Hash + Clone,
PB: Problem<T>,
RLX: Relaxation<T>,
LV: LoadVars<T>,
VS: VariableHeuristic<T>,
WIDTH: WidthHeuristic,
NS: Compare<Node<T>>,
[src]
T: Eq + Hash + Clone,
PB: Problem<T>,
RLX: Relaxation<T>,
LV: LoadVars<T>,
VS: VariableHeuristic<T>,
WIDTH: WidthHeuristic,
NS: Compare<Node<T>>,
This is how an MDDConfig
object implements the the Config
trait.
fn root_node(&self) -> Node<T>
[src]
Yields the root node of the (exact) MDD standing for the problem to solve.
Note:
This is a pass through to the problem method.
fn impacted_by(&self, state: &T, v: Variable) -> bool
[src]
This method returns true iff taking a decision on variable
might
have an impact (state or longest path) on a node having the given state
Note:
This is a pass through to the problem method.
fn load_vars(&mut self, root: &Node<T>)
[src]
Returns the minimal set of free variables for the given problem
when
starting an exploration in the given node
.
Note:
This is a pass through to the load vars heuristic.
fn nb_free_vars(&self) -> usize
[src]
Returns the number of variables which may still be decided upon in this
unrolling of the (approximate) MDD. Note: This number varies during the
unrolling of the MDD. Whenever you call remove_var
, this number should
decrease.
fn select_var(&self, current: Layer<T>, next: Layer<T>) -> Option<Variable>
[src]
Returns the best variable to branch on from the set of 'free' variables
(variables that may still be branched upon in this unrolling of the MDD).
It returns None
in case no branching is useful (ie when no decision is
left to make, etc...).
Note:
This is almost a pass through to the node selection heuristic.
fn remove_var(&mut self, v: Variable)
[src]
Removes v
from the set of free variables (which may be branched upon).
That is, it alters the configuration so that v
is considered to have
been assigned with a value. Note: As a side effect, it should decrease
the value of nb_free_vars
and make v
impossible to select (during
this unrolling of the MDD) with select_var
.
fn domain_of<'b>(&self, state: &'b T, v: Variable) -> Domain<'b>
[src]
Returns the domain of variable v
in the given state
. These are the
possible values that might possibly be affected to v
when the system
has taken decisions leading to state
.
Note:
This is a pass through to the problem method.
fn max_width(&self) -> usize
[src]
Returns the maximum width allowed for the next layer in this unrolling of the MDD.
Note:
This is a pass through to the max width heuristic.
fn branch(&self, state: &T, info: Arc<NodeInfo>, d: Decision) -> Node<T>
[src]
Returns the node which is reached by taking decision d
from the node
(state
, info
).
fn estimate_ub(&self, state: &T, info: &NodeInfo) -> i32
[src]
Returns a rough upper bound on the maximum objective function value
reachable by passing through the node characterized by the given
state
and node info
.
Note:
This is a pass through to the relaxation method.
fn compare(&self, x: &Node<T>, y: &Node<T>) -> Ordering
[src]
Compares two nodes according to the node selection ranking. That is,
it derives an ordering for x
and y
where the Gretest node has more
chances of remaining in the layer (in case a restriction or merge needs
to occur). In other words, if x > y
according to this ordering, it
means that x
is more promising than y
. A consequence of which,
x
has more chances of not being dropped/merged into an other node.
Note:
This is a pass through to the node selection heuristic.
fn merge_nodes(&self, nodes: &[Node<T>]) -> Node<T>
[src]
This method merges the given set of nodes
into a new inexact node.
The role of this method is really to only provide an inexact
node to use as a replacement for the selected nodes
. It is the MDD
implementation 's responsibility to take care of maintaining a cutset.
Note:
This is a pass through to the relaxation method.
fn transition_state(&self, state: &T, d: Decision) -> T
[src]
This method is just a shortcut to get the next state by applying the
transition (as described per the problem) from state
and taking the
given decision
.
Visually
Calling this method returns (new state).
(state) --- [decision] ---> (new_state)
fn transition_cost(&self, state: &T, d: Decision) -> i32
[src]
This method is just a shortcut to get the cost of going to next state by
applying the transition cost function (as described per the problem);
starting from state
and taking the given decision
.
Visually
Calling this method returns the cost of taking decision.
(state) --- [decision] ---> (new_state)
^
|
cost of taking decision