diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend index 74500cc2..d879d4cc 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/ViatraReasonerSolutionSaver.xtend | |||
@@ -14,9 +14,12 @@ import org.eclipse.xtend.lib.annotations.Accessors | |||
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Based on {@link SolutionStore.BestSolutionSaver}. | 16 | * Based on {@link SolutionStore.BestSolutionSaver}. |
17 | * | ||
18 | * Will also automatically fill any missing numerical values in the saved solutions | ||
19 | * using the supplied {@link NumericSolver}. | ||
17 | */ | 20 | */ |
18 | class ViatraReasonerSolutionSaver implements ISolutionSaver { | 21 | class ViatraReasonerSolutionSaver implements ISolutionSaver { |
19 | @Accessors val solutionCopier = new SolutionCopier | 22 | @Accessors val SolutionCopier solutionCopier |
20 | @Accessors val DiversityChecker diversityChecker | 23 | @Accessors val DiversityChecker diversityChecker |
21 | val boolean hasExtremalObjectives | 24 | val boolean hasExtremalObjectives |
22 | val int numberOfRequiredSolutions | 25 | val int numberOfRequiredSolutions |
@@ -25,11 +28,12 @@ class ViatraReasonerSolutionSaver implements ISolutionSaver { | |||
25 | 28 | ||
26 | @Accessors(PUBLIC_SETTER) var Map<Object, Solution> solutionsCollection | 29 | @Accessors(PUBLIC_SETTER) var Map<Object, Solution> solutionsCollection |
27 | 30 | ||
28 | new(IObjective[][] leveledExtremalObjectives, int numberOfRequiredSolutions, DiversityChecker diversityChecker) { | 31 | new(IObjective[][] leveledExtremalObjectives, int numberOfRequiredSolutions, DiversityChecker diversityChecker, NumericSolver numericSolver) { |
29 | this.diversityChecker = diversityChecker | 32 | this.diversityChecker = diversityChecker |
30 | comparatorHelper = new ObjectiveComparatorHelper(leveledExtremalObjectives) | 33 | comparatorHelper = new ObjectiveComparatorHelper(leveledExtremalObjectives) |
31 | hasExtremalObjectives = leveledExtremalObjectives.exists[!empty] | 34 | hasExtremalObjectives = leveledExtremalObjectives.exists[!empty] |
32 | this.numberOfRequiredSolutions = numberOfRequiredSolutions | 35 | this.numberOfRequiredSolutions = numberOfRequiredSolutions |
36 | this.solutionCopier = new SolutionCopier(numericSolver) | ||
33 | } | 37 | } |
34 | 38 | ||
35 | override saveSolution(ThreadContext context, Object id, SolutionTrajectory solutionTrajectory) { | 39 | override saveSolution(ThreadContext context, Object id, SolutionTrajectory solutionTrajectory) { |
@@ -139,4 +143,8 @@ class ViatraReasonerSolutionSaver implements ISolutionSaver { | |||
139 | } | 143 | } |
140 | solutionsCollection.size < numberOfRequiredSolutions | 144 | solutionsCollection.size < numberOfRequiredSolutions |
141 | } | 145 | } |
146 | |||
147 | def getTotalCopierRuntime() { | ||
148 | solutionCopier.totalCopierRuntime | ||
149 | } | ||
142 | } | 150 | } |