Class ResultStore<S extends Solution<S,I>, I extends Instance>

java.lang.Object
es.urjc.etsii.grafo.results.ResultStore<S,I>
Type Parameters:
S - solution type
I - instance type

@Service public class ResultStore<S extends Solution<S,I>, I extends Instance> extends Object
In-memory generated-result store.

Solutions are retained strongly until explicitly released after final serialization. Released solutions remain available on a best-effort basis through a SoftReference.

  • Constructor Details

    • ResultStore

      public ResultStore()
  • Method Details

    • store

      public WorkUnitResult<S,I> store(WorkUnitResult<S,I> result)
      Store a work-unit result.
      Parameters:
      result - work-unit result
      Returns:
      stored work-unit result
    • findResult

      public Optional<WorkUnitResult<S,I>> findResult(UUID resultId)
      Find the stored result metadata by id.

      After release, the returned result no longer directly contains the solution. Use findSolution(UUID) when the solution is needed.

    • findSolution

      public Optional<S> findSolution(UUID resultId)
      Find a solution by result id.

      After release this lookup is best-effort and may be empty if memory pressure has cleared the soft reference.

    • getResultsForExperiment

      public List<WorkUnitResult<S,I>> getResultsForExperiment(String experimentName)
      Get an immutable insertion-ordered snapshot for an experiment.
    • releaseSolutionsForExperiment

      public void releaseSolutionsForExperiment(String experimentName)
      Release all strong solution references belonging to an experiment. Cached objective values and custom properties remain in the stored result.