diff options
author | 2019-08-01 01:00:12 +0200 | |
---|---|---|
committer | 2019-08-01 01:00:12 +0200 | |
commit | 7021a4d1f2805ebf3145cbc3893761d12f23361f (patch) | |
tree | b75c51136d3b593f94bf517a8552a1dbf8abdd2b /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner | |
parent | Build Cbc wrapper under Ubuntu 18.04 (diff) | |
download | VIATRA-Generator-7021a4d1f2805ebf3145cbc3893761d12f23361f.tar.gz VIATRA-Generator-7021a4d1f2805ebf3145cbc3893761d12f23361f.tar.zst VIATRA-Generator-7021a4d1f2805ebf3145cbc3893761d12f23361f.zip |
Configurability and better statistics for measurements
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner')
3 files changed, 30 insertions, 7 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 a8db5e43..1abde0a8 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 | |||
@@ -39,6 +39,7 @@ import org.eclipse.viatra.dse.api.DesignSpaceExplorer | |||
39 | import org.eclipse.viatra.dse.api.DesignSpaceExplorer.DseLoggingLevel | 39 | import org.eclipse.viatra.dse.api.DesignSpaceExplorer.DseLoggingLevel |
40 | import org.eclipse.viatra.dse.solutionstore.SolutionStore | 40 | import org.eclipse.viatra.dse.solutionstore.SolutionStore |
41 | import org.eclipse.viatra.dse.statecode.IStateCoderFactory | 41 | import org.eclipse.viatra.dse.statecode.IStateCoderFactory |
42 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.NeighbourhoodBasedStateCoderFactory | ||
42 | 43 | ||
43 | class ViatraReasoner extends LogicReasoner { | 44 | class ViatraReasoner extends LogicReasoner { |
44 | val PartialInterpretationInitialiser initialiser = new PartialInterpretationInitialiser() | 45 | val PartialInterpretationInitialiser initialiser = new PartialInterpretationInitialiser() |
@@ -137,11 +138,14 @@ class ViatraReasoner extends LogicReasoner { | |||
137 | 138 | ||
138 | dse.setInitialModel(emptySolution, false) | 139 | dse.setInitialModel(emptySolution, false) |
139 | 140 | ||
140 | val IStateCoderFactory statecoder = if (viatraConfig.stateCoderStrategy == StateCoderStrategy.Neighbourhood) { | 141 | val IStateCoderFactory statecoder = switch (viatraConfig.stateCoderStrategy) { |
142 | case Neighbourhood: | ||
143 | new NeighbourhoodBasedStateCoderFactory | ||
144 | case PairwiseNeighbourhood: | ||
141 | new PairwiseNeighbourhoodBasedStateCoderFactory | 145 | new PairwiseNeighbourhoodBasedStateCoderFactory |
142 | } else { | 146 | default: |
143 | new IdentifierBasedStateCoderFactory | 147 | new IdentifierBasedStateCoderFactory |
144 | } | 148 | } |
145 | dse.stateCoderFactory = statecoder | 149 | dse.stateCoderFactory = statecoder |
146 | 150 | ||
147 | dse.maxNumberOfThreads = 1 | 151 | dse.maxNumberOfThreads = 1 |
@@ -184,8 +188,12 @@ class ViatraReasoner extends LogicReasoner { | |||
184 | it.value = (method.statistics.transformationExecutionTime / 1000000) as int | 188 | it.value = (method.statistics.transformationExecutionTime / 1000000) as int |
185 | ] | 189 | ] |
186 | it.entries += createIntStatisticEntry => [ | 190 | it.entries += createIntStatisticEntry => [ |
191 | it.name = "ScopePropagationTime" | ||
192 | it.value = (method.statistics.scopePropagationTime / 1000000) as int | ||
193 | ] | ||
194 | it.entries += createIntStatisticEntry => [ | ||
187 | it.name = "TypeAnalysisTime" | 195 | it.name = "TypeAnalysisTime" |
188 | it.value = (method.statistics.PreliminaryTypeAnalisisTime / 1000000) as int | 196 | it.value = (method.statistics.preliminaryTypeAnalisisTime / 1000000) as int |
189 | ] | 197 | ] |
190 | it.entries += createIntStatisticEntry => [ | 198 | it.entries += createIntStatisticEntry => [ |
191 | it.name = "StateCoderTime" | 199 | it.name = "StateCoderTime" |
@@ -199,6 +207,18 @@ class ViatraReasoner extends LogicReasoner { | |||
199 | it.name = "SolutionCopyTime" | 207 | it.name = "SolutionCopyTime" |
200 | it.value = (solutionCopier.getTotalCopierRuntime / 1000000) as int | 208 | it.value = (solutionCopier.getTotalCopierRuntime / 1000000) as int |
201 | ] | 209 | ] |
210 | it.entries += createIntStatisticEntry => [ | ||
211 | it.name = "States" | ||
212 | it.value = dse.numberOfStates as int | ||
213 | ] | ||
214 | it.entries += createIntStatisticEntry => [ | ||
215 | it.name = "Decisions" | ||
216 | it.value = method.statistics.decisionsTried | ||
217 | ] | ||
218 | it.entries += createIntStatisticEntry => [ | ||
219 | it.name = "ScopePropagations" | ||
220 | it.value = method.statistics.scopePropagatorInvocations | ||
221 | ] | ||
202 | if (diversityChecker.isActive) { | 222 | if (diversityChecker.isActive) { |
203 | it.entries += createIntStatisticEntry => [ | 223 | it.entries += createIntStatisticEntry => [ |
204 | it.name = "SolutionDiversityCheckTime" | 224 | it.name = "SolutionDiversityCheckTime" |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend index 7a3a2d67..a2f9cebe 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasonerConfiguration.xtend | |||
@@ -14,9 +14,12 @@ import java.util.LinkedList | |||
14 | import java.util.List | 14 | import java.util.List |
15 | import java.util.Set | 15 | import java.util.Set |
16 | import org.eclipse.xtext.xbase.lib.Functions.Function1 | 16 | import org.eclipse.xtext.xbase.lib.Functions.Function1 |
17 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedralScopePropagatorConstraints | ||
18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.PolyhedralScopePropagatorSolver | ||
17 | 19 | ||
18 | enum StateCoderStrategy { | 20 | enum StateCoderStrategy { |
19 | Neighbourhood, | 21 | Neighbourhood, |
22 | PairwiseNeighbourhood, | ||
20 | NeighbourhoodWithEquivalence, | 23 | NeighbourhoodWithEquivalence, |
21 | IDBased, | 24 | IDBased, |
22 | DefinedByDiversity | 25 | DefinedByDiversity |
@@ -25,7 +28,7 @@ enum StateCoderStrategy { | |||
25 | class ViatraReasonerConfiguration extends LogicSolverConfiguration { | 28 | class ViatraReasonerConfiguration extends LogicSolverConfiguration { |
26 | // public var Iterable<PQuery> existingQueries | 29 | // public var Iterable<PQuery> existingQueries |
27 | public var nameNewElements = false | 30 | public var nameNewElements = false |
28 | public var StateCoderStrategy stateCoderStrategy = StateCoderStrategy.Neighbourhood | 31 | public var StateCoderStrategy stateCoderStrategy = StateCoderStrategy.PairwiseNeighbourhood |
29 | public var TypeInferenceMethod typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis | 32 | public var TypeInferenceMethod typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis |
30 | /** | 33 | /** |
31 | * Once per 1/randomBacktrackChance the search selects a random state. | 34 | * Once per 1/randomBacktrackChance the search selects a random state. |
@@ -50,9 +53,8 @@ class ViatraReasonerConfiguration extends LogicSolverConfiguration { | |||
50 | * Configuration for cutting search space. | 53 | * Configuration for cutting search space. |
51 | */ | 54 | */ |
52 | public var SearchSpaceConstraint searchSpaceConstraints = new SearchSpaceConstraint | 55 | public var SearchSpaceConstraint searchSpaceConstraints = new SearchSpaceConstraint |
53 | |||
54 | public var ScopePropagatorStrategy scopePropagatorStrategy = ScopePropagatorStrategy.PolyhedralTypeHierarchy | ||
55 | 56 | ||
57 | public var ScopePropagatorStrategy scopePropagatorStrategy = ScopePropagatorStrategy.BasicTypeHierarchy | ||
56 | public var List<CostObjectiveConfiguration> costObjectives = newArrayList | 58 | public var List<CostObjectiveConfiguration> costObjectives = newArrayList |
57 | } | 59 | } |
58 | 60 | ||
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java index 144e7484..5af7fc69 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/BestFirstStrategyForModelGeneration.java | |||
@@ -189,6 +189,7 @@ public class BestFirstStrategyForModelGeneration implements IStrategy { | |||
189 | // } | 189 | // } |
190 | logger.debug("Executing new activation: " + nextActivation); | 190 | logger.debug("Executing new activation: " + nextActivation); |
191 | context.executeAcitvationId(nextActivation); | 191 | context.executeAcitvationId(nextActivation); |
192 | method.getStatistics().incrementDecisionCount(); | ||
192 | 193 | ||
193 | visualiseCurrentState(); | 194 | visualiseCurrentState(); |
194 | // for(ViatraQueryMatcher<? extends IPatternMatch> matcher : matchers) { | 195 | // for(ViatraQueryMatcher<? extends IPatternMatch> matcher : matchers) { |