diff options
author | OszkarSemerath <oszka@SEMERATH-LAPTOP> | 2017-08-15 02:46:35 +0200 |
---|---|---|
committer | OszkarSemerath <oszka@SEMERATH-LAPTOP> | 2017-08-15 02:46:35 +0200 |
commit | 1d187478ca5c6ecc8d1444c79646c33a35607190 (patch) | |
tree | 17fd25bccf7eee0cdca18a28031d4f92c43e004a | |
parent | Partial interpretation initialiser with primitive types (diff) | |
download | VIATRA-Generator-1d187478ca5c6ecc8d1444c79646c33a35607190.tar.gz VIATRA-Generator-1d187478ca5c6ecc8d1444c79646c33a35607190.tar.zst VIATRA-Generator-1d187478ca5c6ecc8d1444c79646c33a35607190.zip |
Literals from the problem are added to the initial set of primitive
objects.
1 files changed, 23 insertions, 0 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 598c8f9e..6093f2d0 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 | |||
@@ -24,6 +24,9 @@ import org.eclipse.xtend.lib.annotations.Data | |||
24 | 24 | ||
25 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 25 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
26 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes | 26 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes |
27 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral | ||
28 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral | ||
29 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringLiteral | ||
27 | 30 | ||
28 | @Data class Problem2PartialInterpretationTrace { | 31 | @Data class Problem2PartialInterpretationTrace { |
29 | Map<TypeDeclaration, PartialTypeInterpratation> type2Interpretation = new HashMap | 32 | Map<TypeDeclaration, PartialTypeInterpratation> type2Interpretation = new HashMap |
@@ -46,21 +49,41 @@ class PartialInterpretationInitialiser { | |||
46 | val res = createPartialInterpretation => [ | 49 | val res = createPartialInterpretation => [ |
47 | it.problem = problem | 50 | it.problem = problem |
48 | 51 | ||
52 | // Elements | ||
49 | it.minNewElements = typeScopes.maxNewElements | 53 | it.minNewElements = typeScopes.maxNewElements |
50 | it.maxNewElements = typeScopes.minNewElements | 54 | it.maxNewElements = typeScopes.minNewElements |
55 | // elements from problem are included | ||
51 | if(maxNewElements>0) { | 56 | if(maxNewElements>0) { |
52 | it.openWorldElementPrototypes += createDefinedElement => [it.name = "Symbolic New Element"] | 57 | it.openWorldElementPrototypes += createDefinedElement => [it.name = "Symbolic New Element"] |
53 | } | 58 | } |
54 | 59 | ||
60 | // Booleans | ||
61 | it.booleanelements += createBooleanElement => [it.name = "true" it.value = true it.valueSet = true] | ||
62 | it.booleanelements += createBooleanElement => [it.name = "false" it.value = false it.valueSet = true] | ||
63 | |||
64 | // Integers | ||
55 | it.maxNewIntegers = typeScopes.numberOfUseableIntegers | 65 | it.maxNewIntegers = typeScopes.numberOfUseableIntegers |
66 | for(integersInProblem : problem.eAllContents.toIterable.filter(IntLiteral).map[value].toSet) { | ||
67 | it.integerelements += createIntegerElement => [it.name = '''«integersInProblem»''' it.value = integersInProblem it.valueSet = true] | ||
68 | } | ||
56 | if(maxNewIntegers>0) { | 69 | if(maxNewIntegers>0) { |
57 | it.openWorldElementPrototypes += createIntegerElement => [it.name = "Symbolic New Integer" it.valueSet = false] | 70 | it.openWorldElementPrototypes += createIntegerElement => [it.name = "Symbolic New Integer" it.valueSet = false] |
58 | } | 71 | } |
72 | |||
73 | // Reals | ||
59 | it.maxNewReals = typeScopes.numberOfUseableReals | 74 | it.maxNewReals = typeScopes.numberOfUseableReals |
75 | for(realsInProblem : problem.eAllContents.toIterable.filter(RealLiteral).map[value].toSet) { | ||
76 | it.realelements += createRealElement => [it.name = '''«realsInProblem»''' it.value = realsInProblem it.valueSet = true] | ||
77 | } | ||
60 | if(maxNewReals>0) { | 78 | if(maxNewReals>0) { |
61 | it.openWorldElementPrototypes += createRealElement => [it.name = "Symbolic New Real" it.valueSet = false] | 79 | it.openWorldElementPrototypes += createRealElement => [it.name = "Symbolic New Real" it.valueSet = false] |
62 | } | 80 | } |
81 | |||
82 | // Strings | ||
63 | it.maxNewStrings = typeScopes.numberOfUseableStrings | 83 | it.maxNewStrings = typeScopes.numberOfUseableStrings |
84 | for(stringsInProblem : problem.eAllContents.toIterable.filter(StringLiteral).map[value].toSet) { | ||
85 | it.stringelement += createStringElement => [it.name = '''"«stringsInProblem»"''' it.value=stringsInProblem it.valueSet = true] | ||
86 | } | ||
64 | if(maxNewStrings>0) { | 87 | if(maxNewStrings>0) { |
65 | it.openWorldElementPrototypes += createStringElement => [it.name = "Symbolic New String" it.valueSet = false] | 88 | it.openWorldElementPrototypes += createStringElement => [it.name = "Symbolic New String" it.valueSet = false] |
66 | } | 89 | } |