Record Class SolutionSpec
java.lang.Object
java.lang.Record
com.graphhopper.jsprit.core.problem.solution.spec.SolutionSpec
- Record Components:
routes- the list of route specifications
Specifies a complete solution.
This is pure data - no actual Solution, Route, or Activity objects are referenced. The spec is materialized into a real solution when building against a VRP.
Unassigned jobs are derived during materialization: any job in the VRP that is not referenced in any route spec is considered unassigned.
-
Constructor Summary
ConstructorsConstructorDescriptionSolutionSpec(List<RouteSpec> routes) Creates an instance of aSolutionSpecrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic SolutionSpecempty()Creates an empty solution spec (all jobs unassigned).final booleanIndicates whether some other object is "equal to" this one.static SolutionSpecfrom(VehicleRoutingProblemSolution solution) Extracts a solution spec from an existing solution.final inthashCode()Returns a hash code value for this object.static SolutionSpecCreates a solution spec with the given routes.static SolutionSpecCreates a solution spec with the given routes.routes()Returns the value of theroutesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SolutionSpec
Creates an instance of aSolutionSpecrecord class.- Parameters:
routes- the value for theroutesrecord component
-
-
Method Details
-
of
Creates a solution spec with the given routes. -
of
Creates a solution spec with the given routes. -
empty
Creates an empty solution spec (all jobs unassigned). -
from
Extracts a solution spec from an existing solution.This allows reusing a solution's structure as an initial solution for another VRP run or a modified problem.
- Parameters:
solution- the solution to extract from- Returns:
- a spec representing the solution's structure
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
routes
Returns the value of theroutesrecord component.- Returns:
- the value of the
routesrecord component
-