diff options
author | 2019-04-09 23:11:20 +0200 | |
---|---|---|
committer | 2019-04-09 23:11:20 +0200 | |
commit | ec11efe9e0c3863be32e740b28e124499ad653f9 (patch) | |
tree | 7e4c5b1c6d501aa3ac53e66546a1625f91d11572 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend | |
parent | Fix solution store for optimization (diff) | |
download | VIATRA-Generator-ec11efe9e0c3863be32e740b28e124499ad653f9.tar.gz VIATRA-Generator-ec11efe9e0c3863be32e740b28e124499ad653f9.tar.zst VIATRA-Generator-ec11efe9e0c3863be32e740b28e124499ad653f9.zip |
Make diversity checking work with optimization
Proof of concept implementation, mixing diversity checking and optimization
may not be very effective in practice
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend index c022beac..edcca676 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend | |||
@@ -19,6 +19,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.par | |||
19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.IdentifierBasedStateCoderFactory | 19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.IdentifierBasedStateCoderFactory |
20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.NeighbourhoodBasedStateCoderFactory | 20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.NeighbourhoodBasedStateCoderFactory |
21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.BestFirstStrategyForModelGeneration | 21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.BestFirstStrategyForModelGeneration |
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.DiversityChecker | ||
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.LoggerSolutionFoundHandler | 23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.LoggerSolutionFoundHandler |
23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.ModelGenerationCompositeObjective | 24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.ModelGenerationCompositeObjective |
24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.PartialModelAsLogicInterpretation | 25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.PartialModelAsLogicInterpretation |
@@ -122,7 +123,9 @@ class ViatraReasoner extends LogicReasoner { | |||
122 | new SolutionStore() | 123 | new SolutionStore() |
123 | } | 124 | } |
124 | solutionStore.registerSolutionFoundHandler(new LoggerSolutionFoundHandler(viatraConfig)) | 125 | solutionStore.registerSolutionFoundHandler(new LoggerSolutionFoundHandler(viatraConfig)) |
125 | val solutionSaver = new ViatraReasonerSolutionSaver(newArrayList(extremalObjectives), numberOfRequiredSolutions) | 126 | val diversityChecker = DiversityChecker.of(viatraConfig.diversityRequirement) |
127 | val solutionSaver = new ViatraReasonerSolutionSaver(newArrayList(extremalObjectives), numberOfRequiredSolutions, | ||
128 | diversityChecker) | ||
126 | val solutionCopier = solutionSaver.solutionCopier | 129 | val solutionCopier = solutionSaver.solutionCopier |
127 | solutionStore.withSolutionSaver(solutionSaver) | 130 | solutionStore.withSolutionSaver(solutionSaver) |
128 | dse.solutionStore = solutionStore | 131 | dse.solutionStore = solutionStore |
@@ -197,14 +200,14 @@ class ViatraReasoner extends LogicReasoner { | |||
197 | it.name = "SolutionCopyTime" | 200 | it.name = "SolutionCopyTime" |
198 | it.value = (solutionCopier.getTotalCopierRuntime / 1000000) as int | 201 | it.value = (solutionCopier.getTotalCopierRuntime / 1000000) as int |
199 | ] | 202 | ] |
200 | if (strategy.solutionStoreWithDiversityDescriptor.isActive) { | 203 | if (diversityChecker.isActive) { |
201 | it.entries += createIntStatisticEntry => [ | 204 | it.entries += createIntStatisticEntry => [ |
202 | it.name = "SolutionDiversityCheckTime" | 205 | it.name = "SolutionDiversityCheckTime" |
203 | it.value = (strategy.solutionStoreWithDiversityDescriptor.sumRuntime / 1000000) as int | 206 | it.value = (diversityChecker.totalRuntime / 1000000) as int |
204 | ] | 207 | ] |
205 | it.entries += createRealStatisticEntry => [ | 208 | it.entries += createRealStatisticEntry => [ |
206 | it.name = "SolutionDiversitySuccessRate" | 209 | it.name = "SolutionDiversitySuccessRate" |
207 | it.value = strategy.solutionStoreWithDiversityDescriptor.successRate | 210 | it.value = diversityChecker.successRate |
208 | ] | 211 | ] |
209 | } | 212 | } |
210 | ] | 213 | ] |