Trait ddo::WidthHeuristic
source · pub trait WidthHeuristic<State> {
// Required method
fn max_width(&self, state: &SubProblem<State>) -> usize;
}
Expand description
This trait encapsulates the behavior of the heuristic that determines the maximum permitted width of a decision diagram.
§Technical Note:
Just like Problem
, Relaxation
and StateRanking
, the WidthHeuristic
trait is generic over State
s. However, rather than using the same
‘associated-type’ mechanism that was used for the former three types,
WidthHeuristic
uses a parameter type for this purpose (the type parameter
approach might feel more familiar to Java or C++ programmers than the
associated-type).
This choice was motivated by two factors:
-
The
Problem
,Relaxation
andStateRanking
are intrinsically tied to one type of state. And thus, theState
is really a part of the problem/relaxation itself. Therefore, it would not make sense to define a generic problem implementation which would be applicable to all kind of states. Instead, an implementation of theProblem
trait is the concrete implementation of a DP model (same argument holds for the other traits). -
On the other hand, it does make sense to define a
WidthHeuristic
implementation which is applicable regardless of the state of the problem which is currently being solved. For instance, the ddo framework offers theFixed
andNbUnassigned
width heuristics which are independent of the problem. TheFixed
width heuristic imposes that the maximum layer width be constant across all compiled DDs whereasNbUnassigned
lets the maximum width vary depending on the number of problem variables which have already been decided upon.
Required Methods§
sourcefn max_width(&self, state: &SubProblem<State>) -> usize
fn max_width(&self, state: &SubProblem<State>) -> usize
Estimates a good maximum width for an MDD rooted in the given state