Package io.github.nhtc2005.alns.core
Record Class AlnsResult<S extends Solution<S>>
java.lang.Object
java.lang.Record
io.github.nhtc2005.alns.core.AlnsResult<S>
- Type Parameters:
S- the solution type- Record Components:
bestSolution- the best feasible solution found by the solvertotalIterations- the number of completed iterationselapsedNanos- the search duration in nanoseconds, excluding component resetsstatistics- the collected statistics, or a disabled statistics object
public record AlnsResult<S extends Solution<S>>(S extends Solution<S> bestSolution, long totalIterations, long elapsedNanos, AlnsStatistics statistics)
extends Record
Contains the best solution and measurements from a completed ALNS search.
The best solution is returned directly; this record does not defensively copy it.
-
Constructor Summary
ConstructorsConstructorDescriptionAlnsResult(S bestSolution, long totalIterations, long elapsedNanos) Creates a result with statistics disabled.AlnsResult(S bestSolution, long totalIterations, long elapsedNanos, AlnsStatistics statistics) Creates a result with the supplied statistics. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebestSolutionrecord component.longReturns the value of theelapsedNanosrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thestatisticsrecord component.final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalIterationsrecord component.
-
Constructor Details
-
AlnsResult
public AlnsResult(S bestSolution, long totalIterations, long elapsedNanos, AlnsStatistics statistics) Creates a result with the supplied statistics.- Parameters:
bestSolution- the best feasible solution found by the solvertotalIterations- the number of completed iterationselapsedNanos- the search duration in nanoseconds, excluding component resetsstatistics- the collected statistics, or a disabled statistics object- Throws:
NullPointerException- ifstatisticsis null
-
AlnsResult
Creates a result with statistics disabled.- Parameters:
bestSolution- the best feasible solution found by the solvertotalIterations- the number of completed iterationselapsedNanos- the search duration in nanoseconds, excluding component resets
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
bestSolution
Returns the value of thebestSolutionrecord component.- Returns:
- the value of the
bestSolutionrecord component
-
totalIterations
public long totalIterations()Returns the value of thetotalIterationsrecord component.- Returns:
- the value of the
totalIterationsrecord component
-
elapsedNanos
public long elapsedNanos()Returns the value of theelapsedNanosrecord component.- Returns:
- the value of the
elapsedNanosrecord component
-
statistics
Returns the value of thestatisticsrecord component.- Returns:
- the value of the
statisticsrecord component
-