java.lang.Object
java.lang.Record
es.urjc.etsii.grafo.executors.WorkUnitResult<S,I>
public record WorkUnitResult<S extends Solution<S,I>, I extends Instance> (UUID resultId, boolean success, String experimentName, String instancePath, String instanceId, Algorithm<S extends Solution<S,I>, I extends Instance> algorithm, String iteration, S extends Solution<S,I> solution, Map<String,Double> objectives, Map<String,Object> solutionProperties, long executionTime, long timeToTarget, MetricsStorage metrics, List<TimeStatsEvent> timeData)
extends Record
Result of executing one work unit.
Objective values and custom properties are evaluated when the result is created. They therefore describe the solution at the end of the work unit, even if the solution is later mutated or released from memory.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWorkUnitResult(UUID resultId, boolean success, String experimentName, String instancePath, String instanceId, Algorithm<S, I> algorithm, String iteration, S solution, Map<String, Double> objectives, Map<String, Object> solutionProperties, long executionTime, long timeToTarget, MetricsStorage metrics, List<TimeStatsEvent> timeData) Creates an instance of aWorkUnitResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thealgorithmrecord component.computeObjectives(S solution) Evaluate all configured objectives once, retaining their declaration order.computeSolutionProperties(S solution) Evaluate all solution-defined custom properties once.static <S extends Solution<S,I>, I extends Instance>
WorkUnitResult<S, I> copyBestAlg(WorkUnitResult<S, I> workUnit) static <S extends Solution<S,I>, I extends Instance>
WorkUnitResult<S, I> copyBestInstance(WorkUnitResult<S, I> workUnit) final booleanIndicates whether some other object is "equal to" this one.longReturns the value of theexecutionTimerecord component.Returns the value of theexperimentNamerecord component.static <S extends Solution<S,I>, I extends Instance>
WorkUnitResult<S, I> failure(WorkUnit<S, I> workUnit, String instanceId, long executionTime, long timeToTarget, List<TimeStatsEvent> timeData) final inthashCode()Returns a hash code value for this object.Returns the value of theinstanceIdrecord component.Returns the value of theinstancePathrecord component.Returns the value of theiterationrecord component.doubleValue of the first declared objective, orDouble.NaNwhen no objective value is available.metrics()Returns the value of themetricsrecord component.Returns the value of theobjectivesrecord component.static <S extends Solution<S,I>, I extends Instance>
WorkUnitResult<S, I> ok(WorkUnit<S, I> workUnit, String instanceId, S solution, long executionTime, long timeToTarget, MetricsStorage metrics, List<TimeStatsEvent> timeData) resultId()Returns the value of theresultIdrecord component.solution()Returns the value of thesolutionrecord component.Returns the value of thesolutionPropertiesrecord component.booleansuccess()Returns the value of thesuccessrecord component.timeData()Returns the value of thetimeDatarecord component.longReturns the value of thetimeToTargetrecord component.final StringtoString()Returns a string representation of this record class.Return a copy that no longer strongly references its solution.
-
Field Details
-
BEST_ALGORITHM
- See Also:
-
BEST_ITERATION
- See Also:
-
-
Constructor Details
-
WorkUnitResult
public WorkUnitResult(UUID resultId, boolean success, String experimentName, String instancePath, String instanceId, Algorithm<S, I> algorithm, String iteration, S solution, Map<String, Double> objectives, Map<String, Object> solutionProperties, long executionTime, long timeToTarget, MetricsStorage metrics, List<TimeStatsEvent> timeData) Creates an instance of aWorkUnitResultrecord class.- Parameters:
resultId- the value for theresultIdrecord componentsuccess- the value for thesuccessrecord componentexperimentName- the value for theexperimentNamerecord componentinstancePath- the value for theinstancePathrecord componentinstanceId- the value for theinstanceIdrecord componentalgorithm- the value for thealgorithmrecord componentiteration- the value for theiterationrecord componentsolution- the value for thesolutionrecord componentobjectives- the value for theobjectivesrecord componentsolutionProperties- the value for thesolutionPropertiesrecord componentexecutionTime- the value for theexecutionTimerecord componenttimeToTarget- the value for thetimeToTargetrecord componentmetrics- the value for themetricsrecord componenttimeData- the value for thetimeDatarecord component
-
-
Method Details
-
ok
public static <S extends Solution<S,I>, I extends Instance> WorkUnitResult<S,I> ok(WorkUnit<S, I> workUnit, String instanceId, S solution, long executionTime, long timeToTarget, MetricsStorage metrics, List<TimeStatsEvent> timeData) -
failure
public static <S extends Solution<S,I>, I extends Instance> WorkUnitResult<S,I> failure(WorkUnit<S, I> workUnit, String instanceId, long executionTime, long timeToTarget, List<TimeStatsEvent> timeData) -
copyBestAlg
public static <S extends Solution<S,I>, I extends Instance> WorkUnitResult<S,I> copyBestAlg(WorkUnitResult<S, I> workUnit) -
copyBestInstance
public static <S extends Solution<S,I>, I extends Instance> WorkUnitResult<S,I> copyBestInstance(WorkUnitResult<S, I> workUnit) -
computeObjectives
-
computeSolutionProperties
-
mainObjectiveValue
public double mainObjectiveValue()Value of the first declared objective, orDouble.NaNwhen no objective value is available. -
withoutSolution
Return a copy that no longer strongly references its solution. -
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
resultId
Returns the value of theresultIdrecord component.- Returns:
- the value of the
resultIdrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
experimentName
Returns the value of theexperimentNamerecord component.- Returns:
- the value of the
experimentNamerecord component
-
instancePath
Returns the value of theinstancePathrecord component.- Returns:
- the value of the
instancePathrecord component
-
instanceId
Returns the value of theinstanceIdrecord component.- Returns:
- the value of the
instanceIdrecord component
-
algorithm
-
iteration
Returns the value of theiterationrecord component.- Returns:
- the value of the
iterationrecord component
-
solution
Returns the value of thesolutionrecord component.- Returns:
- the value of the
solutionrecord component
-
objectives
-
solutionProperties
-
executionTime
public long executionTime()Returns the value of theexecutionTimerecord component.- Returns:
- the value of the
executionTimerecord component
-
timeToTarget
public long timeToTarget()Returns the value of thetimeToTargetrecord component.- Returns:
- the value of the
timeToTargetrecord component
-
metrics
Returns the value of themetricsrecord component.- Returns:
- the value of the
metricsrecord component
-
timeData
Returns the value of thetimeDatarecord component.- Returns:
- the value of the
timeDatarecord component
-