diff options
author | 2019-08-14 18:26:33 +0200 | |
---|---|---|
committer | 2019-08-14 18:26:33 +0200 | |
commit | fc84d3fe670331bc89fb1e4c44104bc1fc811438 (patch) | |
tree | 466da8333151c51d2e17075600f9452ed35835da /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend | |
parent | Be more lenient with rounding IP solver results (diff) | |
download | VIATRA-Generator-fc84d3fe670331bc89fb1e4c44104bc1fc811438.tar.gz VIATRA-Generator-fc84d3fe670331bc89fb1e4c44104bc1fc811438.tar.zst VIATRA-Generator-fc84d3fe670331bc89fb1e4c44104bc1fc811438.zip |
Measurements WIP
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 | 25 |
1 files changed, 22 insertions, 3 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 1abde0a8..aa02cd30 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 | |||
@@ -12,12 +12,15 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicproblemPackage | |||
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicresultFactory | 12 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicresultFactory |
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult | 13 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult |
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethodProvider | 14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.ModelGenerationMethodProvider |
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.ScopePropagatorStrategy | ||
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.PartialInterpretationInitialiser | 16 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.PartialInterpretationInitialiser |
16 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | 17 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation |
17 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage | 18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage |
18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.AbstractNeighbourhoodBasedStateCoderFactory | 19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.AbstractNeighbourhoodBasedStateCoderFactory |
19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.IdentifierBasedStateCoderFactory | 20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.IdentifierBasedStateCoderFactory |
21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.NeighbourhoodBasedHashStateCoderFactory | ||
20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.PairwiseNeighbourhoodBasedStateCoderFactory | 22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.PairwiseNeighbourhoodBasedStateCoderFactory |
23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.BasicScopeGlobalConstraint | ||
21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.BestFirstStrategyForModelGeneration | 24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.BestFirstStrategyForModelGeneration |
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.DiversityChecker | 25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.DiversityChecker |
23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.InconsistentScopeGlobalConstraint | 26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.dse.InconsistentScopeGlobalConstraint |
@@ -39,7 +42,6 @@ import org.eclipse.viatra.dse.api.DesignSpaceExplorer | |||
39 | import org.eclipse.viatra.dse.api.DesignSpaceExplorer.DseLoggingLevel | 42 | import org.eclipse.viatra.dse.api.DesignSpaceExplorer.DseLoggingLevel |
40 | import org.eclipse.viatra.dse.solutionstore.SolutionStore | 43 | import org.eclipse.viatra.dse.solutionstore.SolutionStore |
41 | import org.eclipse.viatra.dse.statecode.IStateCoderFactory | 44 | import org.eclipse.viatra.dse.statecode.IStateCoderFactory |
42 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder.NeighbourhoodBasedStateCoderFactory | ||
43 | 45 | ||
44 | class ViatraReasoner extends LogicReasoner { | 46 | class ViatraReasoner extends LogicReasoner { |
45 | val PartialInterpretationInitialiser initialiser = new PartialInterpretationInitialiser() | 47 | val PartialInterpretationInitialiser initialiser = new PartialInterpretationInitialiser() |
@@ -71,6 +73,11 @@ class ViatraReasoner extends LogicReasoner { | |||
71 | workspace.writeModel(emptySolution, "init.partialmodel") | 73 | workspace.writeModel(emptySolution, "init.partialmodel") |
72 | } | 74 | } |
73 | emptySolution.problemConainer = problem | 75 | emptySolution.problemConainer = problem |
76 | var BasicScopeGlobalConstraint basicScopeGlobalConstraint = null | ||
77 | if (viatraConfig.scopePropagatorStrategy == ScopePropagatorStrategy.None) { | ||
78 | basicScopeGlobalConstraint = new BasicScopeGlobalConstraint(emptySolution) | ||
79 | emptySolution.scopes.clear | ||
80 | } | ||
74 | 81 | ||
75 | val method = modelGenerationMethodProvider.createModelGenerationMethod( | 82 | val method = modelGenerationMethodProvider.createModelGenerationMethod( |
76 | problem, | 83 | problem, |
@@ -79,11 +86,12 @@ class ViatraReasoner extends LogicReasoner { | |||
79 | viatraConfig.nameNewElements, | 86 | viatraConfig.nameNewElements, |
80 | viatraConfig.typeInferenceMethod, | 87 | viatraConfig.typeInferenceMethod, |
81 | viatraConfig.scopePropagatorStrategy, | 88 | viatraConfig.scopePropagatorStrategy, |
89 | viatraConfig.hints, | ||
82 | viatraConfig.documentationLevel | 90 | viatraConfig.documentationLevel |
83 | ) | 91 | ) |
84 | 92 | ||
85 | dse.addObjective(new ModelGenerationCompositeObjective( | 93 | dse.addObjective(new ModelGenerationCompositeObjective( |
86 | new ScopeObjective, | 94 | basicScopeGlobalConstraint ?: new ScopeObjective, |
87 | method.unfinishedMultiplicities.map[new UnfinishedMultiplicityObjective(it)], | 95 | method.unfinishedMultiplicities.map[new UnfinishedMultiplicityObjective(it)], |
88 | wf2ObjectiveConverter.createCompletenessObjective(method.unfinishedWF) | 96 | wf2ObjectiveConverter.createCompletenessObjective(method.unfinishedWF) |
89 | )) | 97 | )) |
@@ -132,6 +140,9 @@ class ViatraReasoner extends LogicReasoner { | |||
132 | dse.addGlobalConstraint(wf2ObjectiveConverter.createInvalidationGlobalConstraint(method.invalidWF)) | 140 | dse.addGlobalConstraint(wf2ObjectiveConverter.createInvalidationGlobalConstraint(method.invalidWF)) |
133 | dse.addGlobalConstraint(new SurelyViolatedObjectiveGlobalConstraint(solutionSaver)) | 141 | dse.addGlobalConstraint(new SurelyViolatedObjectiveGlobalConstraint(solutionSaver)) |
134 | dse.addGlobalConstraint(new InconsistentScopeGlobalConstraint) | 142 | dse.addGlobalConstraint(new InconsistentScopeGlobalConstraint) |
143 | if (basicScopeGlobalConstraint !== null) { | ||
144 | dse.addGlobalConstraint(basicScopeGlobalConstraint) | ||
145 | } | ||
135 | for (additionalConstraint : viatraConfig.searchSpaceConstraints.additionalGlobalConstraints) { | 146 | for (additionalConstraint : viatraConfig.searchSpaceConstraints.additionalGlobalConstraints) { |
136 | dse.addGlobalConstraint(additionalConstraint.apply(method)) | 147 | dse.addGlobalConstraint(additionalConstraint.apply(method)) |
137 | } | 148 | } |
@@ -140,7 +151,7 @@ class ViatraReasoner extends LogicReasoner { | |||
140 | 151 | ||
141 | val IStateCoderFactory statecoder = switch (viatraConfig.stateCoderStrategy) { | 152 | val IStateCoderFactory statecoder = switch (viatraConfig.stateCoderStrategy) { |
142 | case Neighbourhood: | 153 | case Neighbourhood: |
143 | new NeighbourhoodBasedStateCoderFactory | 154 | new NeighbourhoodBasedHashStateCoderFactory |
144 | case PairwiseNeighbourhood: | 155 | case PairwiseNeighbourhood: |
145 | new PairwiseNeighbourhoodBasedStateCoderFactory | 156 | new PairwiseNeighbourhoodBasedStateCoderFactory |
146 | default: | 157 | default: |
@@ -216,9 +227,17 @@ class ViatraReasoner extends LogicReasoner { | |||
216 | it.value = method.statistics.decisionsTried | 227 | it.value = method.statistics.decisionsTried |
217 | ] | 228 | ] |
218 | it.entries += createIntStatisticEntry => [ | 229 | it.entries += createIntStatisticEntry => [ |
230 | it.name = "Transformations" | ||
231 | it.value = method.statistics.transformationInvocations | ||
232 | ] | ||
233 | it.entries += createIntStatisticEntry => [ | ||
219 | it.name = "ScopePropagations" | 234 | it.name = "ScopePropagations" |
220 | it.value = method.statistics.scopePropagatorInvocations | 235 | it.value = method.statistics.scopePropagatorInvocations |
221 | ] | 236 | ] |
237 | it.entries += createIntStatisticEntry => [ | ||
238 | it.name = "ScopePropagationsSolverCalls" | ||
239 | it.value = method.statistics.scopePropagatorSolverInvocations | ||
240 | ] | ||
222 | if (diversityChecker.isActive) { | 241 | if (diversityChecker.isActive) { |
223 | it.entries += createIntStatisticEntry => [ | 242 | it.entries += createIntStatisticEntry => [ |
224 | it.name = "SolutionDiversityCheckTime" | 243 | it.name = "SolutionDiversityCheckTime" |