aboutsummaryrefslogtreecommitdiffstats
path: root/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend
diff options
context:
space:
mode:
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.xtend13
1 files changed, 9 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 6898550d..c022beac 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
@@ -88,7 +88,7 @@ class ViatraReasoner extends LogicReasoner {
88 wf2ObjectiveConverter.createCompletenessObjective(method.unfinishedWF) 88 wf2ObjectiveConverter.createCompletenessObjective(method.unfinishedWF)
89 )) 89 ))
90 90
91 val extermalObjectives = Lists.newArrayListWithExpectedSize(viatraConfig.costObjectives.size) 91 val extremalObjectives = Lists.newArrayListWithExpectedSize(viatraConfig.costObjectives.size)
92 for (entry : viatraConfig.costObjectives.indexed) { 92 for (entry : viatraConfig.costObjectives.indexed) {
93 val objectiveName = '''costObjective«entry.key»''' 93 val objectiveName = '''costObjective«entry.key»'''
94 val objectiveConfig = entry.value 94 val objectiveConfig = entry.value
@@ -111,13 +111,18 @@ class ViatraReasoner extends LogicReasoner {
111 objectiveConfig.threshold, 3) 111 objectiveConfig.threshold, 3)
112 dse.addObjective(costObjective) 112 dse.addObjective(costObjective)
113 if (objectiveConfig.findExtremum) { 113 if (objectiveConfig.findExtremum) {
114 extermalObjectives += costObjective 114 extremalObjectives += costObjective
115 } 115 }
116 } 116 }
117 117
118 val solutionStore = new SolutionStore(configuration.solutionScope.numberOfRequiredSolutions) 118 val numberOfRequiredSolutions = configuration.solutionScope.numberOfRequiredSolutions
119 val solutionStore = if (extremalObjectives.empty) {
120 new SolutionStore(numberOfRequiredSolutions)
121 } else {
122 new SolutionStore()
123 }
119 solutionStore.registerSolutionFoundHandler(new LoggerSolutionFoundHandler(viatraConfig)) 124 solutionStore.registerSolutionFoundHandler(new LoggerSolutionFoundHandler(viatraConfig))
120 val solutionSaver = new ViatraReasonerSolutionSaver(newArrayList(extermalObjectives)) 125 val solutionSaver = new ViatraReasonerSolutionSaver(newArrayList(extremalObjectives), numberOfRequiredSolutions)
121 val solutionCopier = solutionSaver.solutionCopier 126 val solutionCopier = solutionSaver.solutionCopier
122 solutionStore.withSolutionSaver(solutionSaver) 127 solutionStore.withSolutionSaver(solutionSaver)
123 dse.solutionStore = solutionStore 128 dse.solutionStore = solutionStore