Package io.github.nhtc2005.alns.core
Record Class IterationContext<S extends Solution<S>>
java.lang.Object
java.lang.Record
io.github.nhtc2005.alns.core.IterationContext<S>
- Type Parameters:
S- the solution type- Record Components:
iteration- the one-based index of the completed iterationelapsedNanos- the elapsed search time in nanoseconds before this callbackstatus- the candidate outcomeisRewardEligible- whether the configured outcome score may be applied; otherwise the rejected-outcome score appliesoperatorSelection- the operator pair used in this iterationcandidateSolution- the candidate after repair and optional local search, even if rejectedcurrentSolution- the current feasible solution after evaluating the candidatebestSolution- the best feasible solution found so far
public record IterationContext<S extends Solution<S>>(long iteration, long elapsedNanos, SolutionStatus status, boolean isRewardEligible, OperatorSelection operatorSelection, S extends Solution<S> candidateSolution, S extends Solution<S> currentSolution, S extends Solution<S> bestSolution)
extends Record
Provides the search state after a completed ALNS iteration.
Solutions are shared references, not snapshots, and must not be modified by the callback.
-
Constructor Summary
ConstructorsConstructorDescriptionIterationContext(long iteration, long elapsedNanos, SolutionStatus status, boolean isRewardEligible, OperatorSelection operatorSelection, S candidateSolution, S currentSolution, S bestSolution) Creates an instance of aIterationContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebestSolutionrecord component.Returns the value of thecandidateSolutionrecord component.Returns the value of thecurrentSolutionrecord 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.booleanReturns the value of theisRewardEligiblerecord component.longReturns the value of theiterationrecord component.Returns the value of theoperatorSelectionrecord component.status()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
IterationContext
public IterationContext(long iteration, long elapsedNanos, SolutionStatus status, boolean isRewardEligible, OperatorSelection operatorSelection, S candidateSolution, S currentSolution, S bestSolution) Creates an instance of aIterationContextrecord class.- Parameters:
iteration- the value for theiterationrecord componentelapsedNanos- the value for theelapsedNanosrecord componentstatus- the value for thestatusrecord componentisRewardEligible- the value for theisRewardEligiblerecord componentoperatorSelection- the value for theoperatorSelectionrecord componentcandidateSolution- the value for thecandidateSolutionrecord componentcurrentSolution- the value for thecurrentSolutionrecord componentbestSolution- the value for thebestSolutionrecord component
-
-
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 '=='. -
iteration
public long iteration()Returns the value of theiterationrecord component.- Returns:
- the value of the
iterationrecord component
-
elapsedNanos
public long elapsedNanos()Returns the value of theelapsedNanosrecord component.- Returns:
- the value of the
elapsedNanosrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
isRewardEligible
public boolean isRewardEligible()Returns the value of theisRewardEligiblerecord component.- Returns:
- the value of the
isRewardEligiblerecord component
-
operatorSelection
Returns the value of theoperatorSelectionrecord component.- Returns:
- the value of the
operatorSelectionrecord component
-
candidateSolution
Returns the value of thecandidateSolutionrecord component.- Returns:
- the value of the
candidateSolutionrecord component
-
currentSolution
Returns the value of thecurrentSolutionrecord component.- Returns:
- the value of the
currentSolutionrecord component
-
bestSolution
Returns the value of thebestSolutionrecord component.- Returns:
- the value of the
bestSolutionrecord component
-