diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionCopier.xtend')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionCopier.xtend | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionCopier.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionCopier.xtend index d036257d..38c8f5a1 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionCopier.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/SolutionCopier.xtend | |||
@@ -19,12 +19,23 @@ class CopiedSolution { | |||
19 | @Accessors var boolean current = true | 19 | @Accessors var boolean current = true |
20 | } | 20 | } |
21 | 21 | ||
22 | /** | ||
23 | * Based on {@link SolutionStore.BestSolutionSaver}. | ||
24 | * | ||
25 | * Will also automatically fill any missing numerical values in the saved solutions | ||
26 | * using the supplied {@link NumericSolver}. | ||
27 | */ | ||
22 | class SolutionCopier { | 28 | class SolutionCopier { |
29 | val NumericSolver numericSolver | ||
23 | val copiedSolutions = new LinkedHashMap<Object, CopiedSolution> | 30 | val copiedSolutions = new LinkedHashMap<Object, CopiedSolution> |
24 | 31 | ||
25 | long startTime = System.nanoTime | 32 | long startTime = System.nanoTime |
26 | @Accessors(PUBLIC_GETTER) long totalCopierRuntime = 0 | 33 | @Accessors(PUBLIC_GETTER) long totalCopierRuntime = 0 |
27 | 34 | ||
35 | new(NumericSolver numericSolver) { | ||
36 | this.numericSolver = numericSolver | ||
37 | } | ||
38 | |||
28 | def void copySolution(ThreadContext context, Object solutionId) { | 39 | def void copySolution(ThreadContext context, Object solutionId) { |
29 | val existingCopy = copiedSolutions.get(solutionId) | 40 | val existingCopy = copiedSolutions.get(solutionId) |
30 | if (existingCopy === null) { | 41 | if (existingCopy === null) { |
@@ -36,6 +47,7 @@ class SolutionCopier { | |||
36 | totalCopierRuntime += System.nanoTime - copyStart | 47 | totalCopierRuntime += System.nanoTime - copyStart |
37 | val copierRuntime = System.nanoTime - startTime | 48 | val copierRuntime = System.nanoTime - startTime |
38 | val copiedSolution = new CopiedSolution(copiedPartialInterpretation, copier, copierRuntime) | 49 | val copiedSolution = new CopiedSolution(copiedPartialInterpretation, copier, copierRuntime) |
50 | numericSolver.fillSolutionCopy(copiedSolution.trace) | ||
39 | copiedSolutions.put(solutionId, copiedSolution) | 51 | copiedSolutions.put(solutionId, copiedSolution) |
40 | } else { | 52 | } else { |
41 | existingCopy.current = true | 53 | existingCopy.current = true |