diff options
author | OszkarSemerath <oszka@SEMERATH-LAPTOP> | 2017-07-12 15:35:45 +0200 |
---|---|---|
committer | OszkarSemerath <oszka@SEMERATH-LAPTOP> | 2017-07-12 15:35:45 +0200 |
commit | ae596d22260beead480e9936a2ec391fe3cb7727 (patch) | |
tree | 3f677496f977e6308fc5d72f6e7eb490fdd3e20b /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend | |
parent | Adding visualisation support for partial interpretations. (diff) | |
download | VIATRA-Generator-ae596d22260beead480e9936a2ec391fe3cb7727.tar.gz VIATRA-Generator-ae596d22260beead480e9936a2ec391fe3cb7727.tar.zst VIATRA-Generator-ae596d22260beead480e9936a2ec391fe3cb7727.zip |
Rearranged the solver configuration into different subsections
DiversityDescriptor
* Describes the required diversity between the solutions.
* Null means that the solutions have to have different state codes
only.
InternalConsistencyCheckerConfiguration
* A logic solver that able to check the consistency of an intermediate
solution.
* Null means that no solver is called.
DebugConfiguration
* Configuration for debugging support.
SearchSpaceConstraint
* Configuration for cutting search space.
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 | 39 |
1 files changed, 10 insertions, 29 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 fd70688b..e00c864a 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 | |||
@@ -44,28 +44,17 @@ class ViatraReasoner extends LogicReasoner{ | |||
44 | val extension LogicresultFactory factory = LogicresultFactory.eINSTANCE | 44 | val extension LogicresultFactory factory = LogicresultFactory.eINSTANCE |
45 | val WF2ObjectiveConverter wf2ObjectiveConverter = new WF2ObjectiveConverter | 45 | val WF2ObjectiveConverter wf2ObjectiveConverter = new WF2ObjectiveConverter |
46 | 46 | ||
47 | val LogicReasoner inconsistencyDetector | ||
48 | |||
49 | public new() { | ||
50 | this.inconsistencyDetector=null | ||
51 | } | ||
52 | |||
53 | public new(LogicReasoner inconsistencyDetector) { | ||
54 | this.inconsistencyDetector = inconsistencyDetector | ||
55 | } | ||
56 | |||
57 | public static var Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> allPatterns = null | ||
58 | //public static var List<SortedMap<String, Integer>> additionalMatches = null | ||
59 | 47 | ||
60 | override solve(LogicProblem problem, LogicSolverConfiguration configuration, ReasonerWorkspace workspace) throws LogicReasonerException { | 48 | override solve(LogicProblem problem, LogicSolverConfiguration configuration, ReasonerWorkspace workspace) throws LogicReasonerException { |
61 | val viatraConfig = configuration.asConfig | 49 | val viatraConfig = configuration.asConfig |
62 | val DesignSpaceExplorer dse = new DesignSpaceExplorer(); | ||
63 | 50 | ||
64 | /* | 51 | if(viatraConfig.debugCongiguration.logging) { |
65 | DesignSpaceExplorer.turnOnLogging(DseLoggingLevel.VERBOSE_FULL) | 52 | DesignSpaceExplorer.turnOnLogging(DseLoggingLevel.VERBOSE_FULL) |
66 | /*/ | 53 | } else { |
67 | DesignSpaceExplorer.turnOnLogging(DseLoggingLevel.WARN) | 54 | DesignSpaceExplorer.turnOnLogging(DseLoggingLevel.WARN) |
68 | //*/ | 55 | } |
56 | |||
57 | val DesignSpaceExplorer dse = new DesignSpaceExplorer(); | ||
69 | 58 | ||
70 | dse.addMetaModelPackage(LogiclanguagePackage.eINSTANCE) | 59 | dse.addMetaModelPackage(LogiclanguagePackage.eINSTANCE) |
71 | dse.addMetaModelPackage(LogicproblemPackage.eINSTANCE) | 60 | dse.addMetaModelPackage(LogicproblemPackage.eINSTANCE) |
@@ -86,7 +75,6 @@ class ViatraReasoner extends LogicReasoner{ | |||
86 | viatraConfig.nameNewElements, | 75 | viatraConfig.nameNewElements, |
87 | viatraConfig.typeInferenceMethod | 76 | viatraConfig.typeInferenceMethod |
88 | ) | 77 | ) |
89 | allPatterns = method.allPatterns | ||
90 | 78 | ||
91 | dse.addObjective(new ModelGenerationCompositeObjective( | 79 | dse.addObjective(new ModelGenerationCompositeObjective( |
92 | new ScopeObjective, | 80 | new ScopeObjective, |
@@ -95,7 +83,7 @@ class ViatraReasoner extends LogicReasoner{ | |||
95 | )) | 83 | )) |
96 | 84 | ||
97 | dse.addGlobalConstraint(wf2ObjectiveConverter.createInvalidationObjective(method.invalidWF)) | 85 | dse.addGlobalConstraint(wf2ObjectiveConverter.createInvalidationObjective(method.invalidWF)) |
98 | for(additionalConstraint : configuration.asConfig.additionalGlobalConstraints) { | 86 | for(additionalConstraint : viatraConfig.searchSpaceConstraints.additionalGlobalConstraints) { |
99 | dse.addGlobalConstraint(additionalConstraint.apply(method)) | 87 | dse.addGlobalConstraint(additionalConstraint.apply(method)) |
100 | } | 88 | } |
101 | 89 | ||
@@ -121,10 +109,7 @@ class ViatraReasoner extends LogicReasoner{ | |||
121 | } | 109 | } |
122 | 110 | ||
123 | val strategy = new BestFirstStrategyForModelGeneration( | 111 | val strategy = new BestFirstStrategyForModelGeneration( |
124 | workspace,inconsistencyDetector, | 112 | workspace,viatraConfig) |
125 | viatraConfig.inconsistencDetectorConfiguration, | ||
126 | viatraConfig.diversityRequirement/*, | ||
127 | method.allPatterns*/) | ||
128 | 113 | ||
129 | val transformationTime = System.nanoTime - transformationStartTime | 114 | val transformationTime = System.nanoTime - transformationStartTime |
130 | val solverStartTime = System.nanoTime | 115 | val solverStartTime = System.nanoTime |
@@ -162,7 +147,7 @@ class ViatraReasoner extends LogicReasoner{ | |||
162 | it.name = "StateCoderTime" it.value = (statecoderFinal.runtime/1000000) as int | 147 | it.name = "StateCoderTime" it.value = (statecoderFinal.runtime/1000000) as int |
163 | ] | 148 | ] |
164 | it.entries += createIntStatisticEntry => [ | 149 | it.entries += createIntStatisticEntry => [ |
165 | it.name = "StateCoderFailCount" it.value = strategy.numberOfStatecoderFaiL | 150 | it.name = "StateCoderFailCount" it.value = strategy.numberOfStatecoderFail |
166 | ] | 151 | ] |
167 | it.entries += createIntStatisticEntry => [ | 152 | it.entries += createIntStatisticEntry => [ |
168 | it.name = "SolutionCopyTime" it.value = (strategy.solutionStoreWithCopy.sumRuntime/1000000) as int | 153 | it.name = "SolutionCopyTime" it.value = (strategy.solutionStoreWithCopy.sumRuntime/1000000) as int |
@@ -204,10 +189,6 @@ class ViatraReasoner extends LogicReasoner{ | |||
204 | } | 189 | } |
205 | } | 190 | } |
206 | } | 191 | } |
207 | |||
208 | /*private def simpleWeithts(List<IObjective> objectives) { | ||
209 | objectives.map[1.0].toList | ||
210 | }*/ | ||
211 | 192 | ||
212 | private def dispatch long runtime(NeighbourhoodBasedStateCoderFactory sc) { | 193 | private def dispatch long runtime(NeighbourhoodBasedStateCoderFactory sc) { |
213 | sc.sumStatecoderRuntime | 194 | sc.sumStatecoderRuntime |