aboutsummaryrefslogtreecommitdiffstats
path: root/Solvers/VIATRA-Solver
diff options
context:
space:
mode:
authorLibravatar OszkarSemerath <oszka@SEMERATH-LAPTOP>2017-08-15 02:34:18 +0200
committerLibravatar OszkarSemerath <oszka@SEMERATH-LAPTOP>2017-08-15 02:34:18 +0200
commite50e771261d96fa30ff61748ad8a3c129a064499 (patch)
tree7325d9325dea9e5890951b116e011024ee49d3d8 /Solvers/VIATRA-Solver
parentPrimitive elements in the partial interpretation (diff)
downloadVIATRA-Generator-e50e771261d96fa30ff61748ad8a3c129a064499.tar.gz
VIATRA-Generator-e50e771261d96fa30ff61748ad8a3c129a064499.tar.zst
VIATRA-Generator-e50e771261d96fa30ff61748ad8a3c129a064499.zip
Partial interpretation initialiser with primitive types
Diffstat (limited to 'Solvers/VIATRA-Solver')
-rw-r--r--Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend26
1 files changed, 21 insertions, 5 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend
index eeccbf76..598c8f9e 100644
--- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend
+++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend
@@ -23,6 +23,7 @@ import org.eclipse.viatra.query.runtime.emf.EMFScope
23import org.eclipse.xtend.lib.annotations.Data 23import org.eclipse.xtend.lib.annotations.Data
24 24
25import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* 25import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.*
26import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes
26 27
27@Data class Problem2PartialInterpretationTrace { 28@Data class Problem2PartialInterpretationTrace {
28 Map<TypeDeclaration, PartialTypeInterpratation> type2Interpretation = new HashMap 29 Map<TypeDeclaration, PartialTypeInterpratation> type2Interpretation = new HashMap
@@ -37,17 +38,32 @@ class PartialInterpretationInitialiser {
37 * Initialises an empty partial interpretation from a logic problem 38 * Initialises an empty partial interpretation from a logic problem
38 */ 39 */
39 def TracedOutput<PartialInterpretation,Problem2PartialInterpretationTrace> initialisePartialInterpretation( 40 def TracedOutput<PartialInterpretation,Problem2PartialInterpretationTrace> initialisePartialInterpretation(
40 LogicProblem problem, 41 LogicProblem problem, TypeScopes typeScopes)
41 int minNewElement, int maxNewElement)
42 { 42 {
43 val engine = ViatraQueryEngine.on(new EMFScope(problem)) 43 val engine = ViatraQueryEngine.on(new EMFScope(problem))
44 val trace = new Problem2PartialInterpretationTrace 44 val trace = new Problem2PartialInterpretationTrace
45 45
46 val res = createPartialInterpretation => [ 46 val res = createPartialInterpretation => [
47 it.problem = problem 47 it.problem = problem
48 it.openWorldElementPrototype = createDefinedElement => [it.name = "Symbolic New Element"] 48
49 it.minNewElements = minNewElement 49 it.minNewElements = typeScopes.maxNewElements
50 it.maxNewElements = maxNewElement 50 it.maxNewElements = typeScopes.minNewElements
51 if(maxNewElements>0) {
52 it.openWorldElementPrototypes += createDefinedElement => [it.name = "Symbolic New Element"]
53 }
54
55 it.maxNewIntegers = typeScopes.numberOfUseableIntegers
56 if(maxNewIntegers>0) {
57 it.openWorldElementPrototypes += createIntegerElement => [it.name = "Symbolic New Integer" it.valueSet = false]
58 }
59 it.maxNewReals = typeScopes.numberOfUseableReals
60 if(maxNewReals>0) {
61 it.openWorldElementPrototypes += createRealElement => [it.name = "Symbolic New Real" it.valueSet = false]
62 }
63 it.maxNewStrings = typeScopes.numberOfUseableStrings
64 if(maxNewStrings>0) {
65 it.openWorldElementPrototypes += createStringElement => [it.name = "Symbolic New String" it.valueSet = false]
66 }
51 67
52 for(typeDeclaration : problem.types.filter(TypeDeclaration)) { 68 for(typeDeclaration : problem.types.filter(TypeDeclaration)) {
53 it.partialtypeinterpratation += typeDeclaration.initialisePartialTypeInterpretation(engine,trace) 69 it.partialtypeinterpratation += typeDeclaration.initialisePartialTypeInterpretation(engine,trace)