Class LinkedDecisionDiagram<T>
java.lang.Object
org.ddolib.layered.solving.ddo.core.mdd.LinkedDecisionDiagram<T>
- Type Parameters:
T- the type of state used in the problem modeled by this decision diagram
- All Implemented Interfaces:
DecisionDiagram<T>
This class implements a decision diagram as a linked structure (linked MDD).
Each node in the diagram is represented by a Node object, and edges between nodes
represent decisions made during the problem-solving process. This class supports the compilation
of exact, relaxed, and restricted decision diagrams using various heuristics and dominance rules.
The main responsibilities of this class include:
- Building the decision diagram layer by layer from an initial state.
- Managing exact and relaxed cutsets of nodes.
- Applying restrictions and relaxations to limit layer width.
- Computing local bounds and fast lower bounds.
- Exporting the decision diagram to DOT format for visualization.
- Interfacing with caches to optimize repeated computations.
-
Constructor Summary
ConstructorsConstructorDescriptionLinkedDecisionDiagram(CompilationConfig<T> config) Creates a new linked decision diagram. -
Method Summary
Modifier and TypeMethodDescriptionReturns the set of decisions representing the best solution found in this MDD.Returns the value of the best solution found in this decision diagram, if any.voidcompile()Compiles the decision diagram according to the configuration.Returns an iterator over the nodes in the exact cutset, transformed into subproblems.Exports the compiled decision diagram in DOT format.booleanisExact()Returns whether the decision diagram is exact.booleanIndicates whether the compilation was interrupted by its stop criterion (for instance a time limit) before reaching the last layer.doubleReturns the minimum lower bound of expanded nodes of the MDD during the LNS compilation.intReturns the number of nodes pruned during the compilation of this decision diagram because they were dominated.longReturns the number of nodes expanded during the compilation: the nodes whose successors were computed.intReturns the number of nodes pruned during the compilation of this decision diagram because their fast lower bound could not improve the best known solution.longReturns the number of successors computed during the compilation (one per transition applied, before any pruning or merge with an existing node).intnbNodes()Returns the total number of nodes created during the compilation of this decision diagram.booleanChecks whether the best path found in a relaxed MDD consists entirely of exact nodes.
-
Constructor Details
-
LinkedDecisionDiagram
Creates a new linked decision diagram.- Parameters:
config- the configuration object containing problem parameters, heuristics, relaxation operators, dominance checkers, and compilation settings
-
-
Method Details
-
compile
public void compile()Compiles the decision diagram according to the configuration.The compilation handles:
- Exact, relaxed, or restricted compilation type.
- Layer-wise variable ordering and heuristics.
- Application of relaxations or restrictions based on width limits.
- Construction of the DOT graph if export or debugging is enabled.
- Optional caching of thresholds for faster branch-and-bound computations.
- Specified by:
compilein interfaceDecisionDiagram<T>
-
isExact
public boolean isExact()Returns whether the decision diagram is exact.- Specified by:
isExactin interfaceDecisionDiagram<T>- Returns:
trueif the MDD is exact,falseif relaxed/restricted nodes exist
-
isInterrupted
public boolean isInterrupted()Description copied from interface:DecisionDiagramIndicates whether the compilation was interrupted by its stop criterion (for instance a time limit) before reaching the last layer. An interrupted DD is incomplete: its solutions, bounds and exactness must not be used.- Specified by:
isInterruptedin interfaceDecisionDiagram<T>- Returns:
trueif the compilation was interrupted
-
nbExpandedNodes
public long nbExpandedNodes()Description copied from interface:DecisionDiagramReturns the number of nodes expanded during the compilation: the nodes whose successors were computed.- Specified by:
nbExpandedNodesin interfaceDecisionDiagram<T>- Returns:
- the number of expanded nodes
-
nbGeneratedNodes
public long nbGeneratedNodes()Description copied from interface:DecisionDiagramReturns the number of successors computed during the compilation (one per transition applied, before any pruning or merge with an existing node).- Specified by:
nbGeneratedNodesin interfaceDecisionDiagram<T>- Returns:
- the number of generated nodes
-
bestValue
Returns the value of the best solution found in this decision diagram, if any.- Specified by:
bestValuein interfaceDecisionDiagram<T>- Returns:
- an
Optionalcontaining the best value or empty if no solution exists
-
bestSolution
Returns the set of decisions representing the best solution found in this MDD.- Specified by:
bestSolutionin interfaceDecisionDiagram<T>- Returns:
- an
Optionalcontaining the set of decisions in the best solution, or empty if no solution exists
-
exactCutset
Returns an iterator over the nodes in the exact cutset, transformed into subproblems.- Specified by:
exactCutsetin interfaceDecisionDiagram<T>- Returns:
- iterator of subproblems in the exact cutset
-
relaxedBestPathIsExact
public boolean relaxedBestPathIsExact()Checks whether the best path found in a relaxed MDD consists entirely of exact nodes.- Specified by:
relaxedBestPathIsExactin interfaceDecisionDiagram<T>- Returns:
trueif the best path contains only exact nodes,falseotherwise
-
exportAsDot
Exports the compiled decision diagram in DOT format.- Specified by:
exportAsDotin interfaceDecisionDiagram<T>- Returns:
- a string containing the DOT representation of the MDD
-
nbNodes
public int nbNodes()Description copied from interface:DecisionDiagramReturns the total number of nodes created during the compilation of this decision diagram.- Specified by:
nbNodesin interfaceDecisionDiagram<T>- Returns:
- the number of nodes
-
nbFastLowerBoundPruning
public int nbFastLowerBoundPruning()Description copied from interface:DecisionDiagramReturns the number of nodes pruned during the compilation of this decision diagram because their fast lower bound could not improve the best known solution.- Specified by:
nbFastLowerBoundPruningin interfaceDecisionDiagram<T>- Returns:
- the number of nodes pruned by the fast lower bound
-
nbDominancePruning
public int nbDominancePruning()Description copied from interface:DecisionDiagramReturns the number of nodes pruned during the compilation of this decision diagram because they were dominated.- Specified by:
nbDominancePruningin interfaceDecisionDiagram<T>- Returns:
- the number of nodes pruned by dominance
-
minLowerBound
public double minLowerBound()Returns the minimum lower bound of expanded nodes of the MDD during the LNS compilation.- Specified by:
minLowerBoundin interfaceDecisionDiagram<T>- Returns:
- a double, minimum lower bound of expanded nodes of the MDD for the LNS
-