Class PDPTWAstarMain
java.lang.Object
org.ddolib.examples.layered.pdptw.PDPTWAstarMain
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 A* (A-star)
search algorithm.
This class demonstrates how to configure and execute an A* 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 details:
- A random PDPTW instance is generated using
PDPTWGenerator.genInstance(int, int, int, java.util.Random, Boolean). - The problem is wrapped into a
Modelthat specifies:- the
PDPTWProblemdefinition, - a fast lower bound through
PDPTWFastLowerBoundto guide A* search.
- the
- The solver is then launched using
Solvers.minimizeAstar(Model, java.util.function.BiConsumer). - Each discovered solution is printed using
SolutionPrinter.printSolution(SearchStatistics, int[]). - Search statistics are displayed at the end of the execution.
Usage example:
// Run the A* PDPTW solver
java PDPTWAstarMain
// Example output:
Solution: [0, 2, 5, ...]
SearchStatistics{status=OPTIMAL, iterations=..., time=...}
Notes:
- The PDPTW instance is generated with a fixed random seed (
new Random(1)) to ensure reproducible results. - This class serves as a demonstration of how to apply A* to combinatorial optimization within the PDPTW framework.
- See Also:
-
Method Summary
-
Method Details
-
main
Entry point for solving a randomly generated Pickup and Delivery Problem (PDP) instance using the A* algorithm.The instance is created with fixed parameters and solved by the A* search framework provided by the
Solversutility.- Parameters:
args- optional command-line arguments (not used in this example)- Throws:
IOException- if an error occurs while reading or generating the instance
-