Package es.urjc.etsii.grafo.events.types
Class SolutionGeneratedEvent<S extends Solution<S,I>,I extends Instance>
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
es.urjc.etsii.grafo.events.types.MorkEvent
es.urjc.etsii.grafo.events.types.SolutionGeneratedEvent<S,I>
- Type Parameters:
S
- Solution typeI
- Instance type
- All Implemented Interfaces:
Serializable
Event triggered each time an algorithm finishes creating a solution.
Contains information about the different solution characteristics.
This event is created and dispatched automatically.
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorsConstructorDescriptionSolutionGeneratedEvent
(boolean success, String iteration, String instancePath, S solution, String experimentName, Algorithm<S, I> algorithm, long executionTime, long timeToBest, MetricsStorage metrics, List<TimeStatsEvent> timeStatsEvents) Create a new SolutionGeneratedEvent -
Method Summary
Modifier and TypeMethodDescriptionAlgorithm that created this solutionGet short algorithm name that generated this solutionlong
Total execution time in nanoseconds used by the algorithm to create the solution.Experiment nameInstance used to create this solutionWhich iteration this solution corresponds toGet both framework calculated and user defined propertiesSolution score when finished processing a solution.Get solution instance IF AVAILABLE Storing all generated solutions is too memory expensive.long
Execution time until last modification in nanosecondsboolean
Was the solution generated successfully?Methods inherited from class es.urjc.etsii.grafo.events.types.MorkEvent
equals, getEventId, getType, getWorkerName, hashCode
Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
SolutionGeneratedEvent
public SolutionGeneratedEvent(boolean success, String iteration, String instancePath, S solution, String experimentName, Algorithm<S, I> algorithm, long executionTime, long timeToBest, MetricsStorage metrics, List<TimeStatsEvent> timeStatsEvents) Create a new SolutionGeneratedEvent- Parameters:
iteration
- solution iterationsolution
- generated solutionexperimentName
- experiment namealgorithm
- algorithm that generated this solutionexecutionTime
- time used to generate this solutiontimeToBest
- time needed ot reach the best solution. timeToBest = totalTime - timeSinceLastModificationmetrics
- both framework calculated and user defined metricstimeStatsEvents
-
-
-
Method Details
-
getIteration
Which iteration this solution corresponds to- Returns:
- iteration
-
getExperimentName
Experiment name- Returns:
- String representing the experiment name
-
getAlgorithm
Algorithm that created this solution- Returns:
- Algorithm configuration
-
getInstanceName
Instance used to create this solution- Returns:
- Instance name
-
getObjectives
Solution score when finished processing a solution.- Returns:
- solution score
-
getExecutionTime
public long getExecutionTime()Total execution time in nanoseconds used by the algorithm to create the solution.- Returns:
- time in nanos
-
getTimeToBest
public long getTimeToBest()Execution time until last modification in nanoseconds- Returns:
- time in nanos
-
getAlgorithmName
Get short algorithm name that generated this solution- Returns:
- Short string representing the algorithm that generated this solution
-
getSolution
Get solution instance IF AVAILABLE Storing all generated solutions is too memory expensive.- Returns:
- Empty optional if solution has been garbage collected, solution data if not.
-
getMetrics
Get both framework calculated and user defined properties- Returns:
- Map where key is metric name, value property value as calculated by the user provided function
-
isSuccess
public boolean isSuccess()Was the solution generated successfully?- Returns:
- true if the solution was generated successfully, false otherwise
-