Package org.ddolib.examples.pdp
Class PDPSolution
java.lang.Object
org.ddolib.examples.pdp.PDPSolution
Represents a solution to a Pickup and Delivery Problem (PDP) instance.
This class stores the sequence of visited nodes (solution), the total cost or value
of the solution, and a reference to the original PDPProblem instance.
The toString() method provides a detailed textual representation of the solution,
including for each node whether it is a pickup, a delivery, or an unrelated node,
as well as the vehicle content after visiting that node.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPDPSolution(PDPProblem problem, int[] solution, double value) Constructs a PDP solution with the given problem, solution sequence, and value. -
Method Summary
-
Field Details
-
solution
public int[] solutionThe sequence of nodes representing the solution, including pickups, deliveries, and unrelated nodes. -
value
public double valueThe total value (cost or distance) of the solution.
-
-
Constructor Details
-
PDPSolution
Constructs a PDP solution with the given problem, solution sequence, and value.- Parameters:
problem- the PDP problem instancesolution- the sequence of nodes representing the solutionvalue- the total cost or distance of the solution
-
-
Method Details
-
toString
Returns a human-readable representation of the solution.Each line represents a node visited in order. For pickups and deliveries, the output indicates the change in vehicle content and the associated pickup/delivery relationship. For unrelated nodes, only the node and current vehicle content are shown.
-