Class PDPTWDdoMain
java.lang.Object
org.ddolib.examples.layered.pdptw.PDPTWDdoMain
Single Vehicle Pick-up and Delivery Problem with Time Window (PDPTW) with Ddo. Main class for
solving the Pickup and Delivery Problem with Time Window (PDPTW) using the Dynamic
Decision Diagram Optimization (DDO) approach.
This class demonstrates how to build and execute a DDO-based solver for a randomly generated PDPTW instance. The PDPTW involves scheduling a set of pickup and delivery tasks while minimizing the overall cost or time, typically under precedence, capacity and time window constraints.
Execution workflow:
- A random PDPTW instance is generated using
PDPTWGenerator.genInstance(int, int, int, java.util.Random, Boolean). - The instance is encapsulated in a
DdoModel, which specifies:- the
PDPTWProblemdefinition, - the
PDPTWRelaxrelaxation used to merge states in the decision diagram, - the
PDPTWRankingheuristic to prioritize state exploration, - a
PDPTWFastLowerBoundestimator to guide pruning, - a
SimpleFrontierstructure withCutSetType.Frontierfor node management, - a width control strategy via
FixedWidthto limit the diagram size.
- the
- The DDO solver is executed through
Solvers.minimizeDdo(DdoModel, java.util.function.BiConsumer). - Each valid solution found is displayed using
SolutionPrinter.printSolution(SearchStatistics, int[]). - Global search statistics are printed at the end of execution.
Usage example:
// Run the DDO solver on a randomly generated PDPTW instance
java PDPTWDdoMain
// Example output:
Solution: [0, 2, 5, 7, ...]
SearchStatistics{status=OPTIMAL, nodes=..., time=...}
Notes:
- The PDPTW instance is generated with a fixed random seed (
new Random(1)) to ensure reproducible results. - DDO explores an approximation of the full search space by iteratively refining decision diagrams, offering a good trade-off between accuracy and performance.
- Caching is enabled (
useCache() = true) to avoid redundant computations across iterations.
- See Also:
-
Method Summary
-
Method Details
-
main
Entry point for solving a randomly generated Pickup and Delivery Problem (PDPTW) instance using the Dynamic Decision Diagram Optimization (DDO) method.The instance is created with predefined parameters and solved using a DDO model that integrates relaxation, ranking, lower bounds, and frontier management heuristics.
- Parameters:
args- optional command-line arguments (not used in this example)- Throws:
IOException- if an error occurs during instance generationInvalidSolutionException- if the solution found by the solver does not respect the problem's constraints
-