diff options
author | 2020-05-09 20:33:19 +0200 | |
---|---|---|
committer | 2020-05-09 20:33:19 +0200 | |
commit | 3776a7c6bc1d6fc3ebbdc9e8afb5ea99207798e0 (patch) | |
tree | 204cbd6fd1e7f439bc44e6210e684dbed8917e54 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit | |
parent | Merge branch 'master' of https://github.com/viatra/VIATRA-Generator (diff) | |
download | VIATRA-Generator-3776a7c6bc1d6fc3ebbdc9e8afb5ea99207798e0.tar.gz VIATRA-Generator-3776a7c6bc1d6fc3ebbdc9e8afb5ea99207798e0.tar.zst VIATRA-Generator-3776a7c6bc1d6fc3ebbdc9e8afb5ea99207798e0.zip |
Numeric Solver integration to exploration
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit')
3 files changed, 9 insertions, 5 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend index e7342ff7..975ace2f 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/ModelGenerationMethodProvider.xtend | |||
@@ -17,6 +17,8 @@ import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher | |||
17 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery | 17 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery |
18 | import org.eclipse.viatra.transformation.runtime.emf.rules.batch.BatchTransformationRule | 18 | import org.eclipse.viatra.transformation.runtime.emf.rules.batch.BatchTransformationRule |
19 | import org.eclipse.xtend.lib.annotations.Data | 19 | import org.eclipse.xtend.lib.annotations.Data |
20 | import org.eclipse.viatra.query.runtime.matchers.psystem.PConstraint | ||
21 | import java.util.Map | ||
20 | 22 | ||
21 | class ModelGenerationStatistics { | 23 | class ModelGenerationStatistics { |
22 | public var long transformationExecutionTime = 0 | 24 | public var long transformationExecutionTime = 0 |
@@ -36,6 +38,8 @@ class ModelGenerationStatistics { | |||
36 | 38 | ||
37 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> invalidWF | 39 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> invalidWF |
38 | 40 | ||
41 | Map<PConstraint, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> unitPropagationPreconditions | ||
42 | |||
39 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> allPatterns | 43 | Collection<? extends IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> allPatterns |
40 | } | 44 | } |
41 | enum TypeInferenceMethod { | 45 | enum TypeInferenceMethod { |
@@ -77,6 +81,8 @@ class ModelGenerationMethodProvider { | |||
77 | 81 | ||
78 | val invalidWF = queries.getInvalidWFQueries.values | 82 | val invalidWF = queries.getInvalidWFQueries.values |
79 | 83 | ||
84 | val unitPropagationPreconditions = queries.getUnitPropagationPreconditionPatterns | ||
85 | |||
80 | return new ModelGenerationMethod( | 86 | return new ModelGenerationMethod( |
81 | statistics, | 87 | statistics, |
82 | objectRefinementRules.values, | 88 | objectRefinementRules.values, |
@@ -84,6 +90,7 @@ class ModelGenerationMethodProvider { | |||
84 | unfinishedMultiplicities, | 90 | unfinishedMultiplicities, |
85 | unfinishedWF, | 91 | unfinishedWF, |
86 | invalidWF, | 92 | invalidWF, |
93 | unitPropagationPreconditions, | ||
87 | queries.allQueries | 94 | queries.allQueries |
88 | ) | 95 | ) |
89 | } | 96 | } |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend index f576d1a1..18e3018a 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/PatternProvider.xtend | |||
@@ -93,7 +93,6 @@ class PatternProvider { | |||
93 | refineRelationQueries = patternGenerator.relationRefinementGenerator.getRefineRelationQueries(problem).mapValues[it.lookup(queries)] | 93 | refineRelationQueries = patternGenerator.relationRefinementGenerator.getRefineRelationQueries(problem).mapValues[it.lookup(queries)] |
94 | val Map<PConstraint, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> | 94 | val Map<PConstraint, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> |
95 | unitPropagationPreconditionPatterns = unitPropagationTrace.mapValues[it.lookup(queries)] | 95 | unitPropagationPreconditionPatterns = unitPropagationTrace.mapValues[it.lookup(queries)] |
96 | unitPropagationPreconditionPatterns.entrySet.forEach[println(it.key + "->" +it.value)] | ||
97 | return new GeneratedPatterns( | 96 | return new GeneratedPatterns( |
98 | invalidWFQueries, | 97 | invalidWFQueries, |
99 | unfinishedWFQueries, | 98 | unfinishedWFQueries, |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnitPropagationPreconditionGenerator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnitPropagationPreconditionGenerator.xtend index 6c68ec94..d487db64 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnitPropagationPreconditionGenerator.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnitPropagationPreconditionGenerator.xtend | |||
@@ -100,11 +100,9 @@ class UnitPropagationPreconditionGenerator { | |||
100 | val preconditions = new LinkedList | 100 | val preconditions = new LinkedList |
101 | val constraint2Precondition = new HashMap | 101 | val constraint2Precondition = new HashMap |
102 | for(entry : mainPropagationNames.entrySet) { | 102 | for(entry : mainPropagationNames.entrySet) { |
103 | val name = '''UPMUSTPropagate«res.getOrGenerateConstraintName(entry.key)»'''; | 103 | val name = '''UPMUSTPropagate_«res.getOrGenerateConstraintName(entry.key)»'''; |
104 | val def = ''' | 104 | val def = ''' |
105 | pattern «name»( | 105 | pattern «name»(«FOR index : 1..entry.key.arity SEPARATOR ", "»«canonizeName(index,PropagationModality::UP)»«ENDFOR») |
106 | problem:LogicProblem, interpretation:PartialInterpretation, | ||
107 | «FOR index : 1..entry.key.arity SEPARATOR ", "»«canonizeName(index,PropagationModality::UP)»«ENDFOR») | ||
108 | «FOR propagation : entry.value SEPARATOR " or "» | 106 | «FOR propagation : entry.value SEPARATOR " or "» |
109 | { find «propagation.key»(problem,interpretation,«FOR index : 0..<propagation.value SEPARATOR ','»_«ENDFOR»,«FOR index : 1..entry.key.arity SEPARATOR ", "»«canonizeName(index,PropagationModality::UP)»«ENDFOR»); } | 107 | { find «propagation.key»(problem,interpretation,«FOR index : 0..<propagation.value SEPARATOR ','»_«ENDFOR»,«FOR index : 1..entry.key.arity SEPARATOR ", "»«canonizeName(index,PropagationModality::UP)»«ENDFOR»); } |
110 | «ENDFOR»''' | 108 | «ENDFOR»''' |