diff options
author | 2020-06-27 17:56:46 +0200 | |
---|---|---|
committer | 2020-06-27 17:56:46 +0200 | |
commit | 957082776dbb7efed53a783c5e5be6b443a9bb86 (patch) | |
tree | 6b88701d4b1b3928b7d3e7de49d177ca8c93ffad /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend | |
parent | Merge branch 'kris' (diff) | |
download | VIATRA-Generator-957082776dbb7efed53a783c5e5be6b443a9bb86.tar.gz VIATRA-Generator-957082776dbb7efed53a783c5e5be6b443a9bb86.tar.zst VIATRA-Generator-957082776dbb7efed53a783c5e5be6b443a9bb86.zip |
Fix scope + numerical propagation WIP
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend')
1 files changed, 11 insertions, 18 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 d37acb6d..20ff58f2 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 | |||
@@ -2,19 +2,24 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage | |||
2 | 2 | ||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput | 3 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput |
4 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes | 4 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes |
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.And | ||
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolLiteral | ||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement | 7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement |
8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral | ||
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguageFactory | 9 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguageFactory |
10 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral | ||
7 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration | 11 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration |
12 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDefinition | ||
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringLiteral | ||
14 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.SymbolicValue | ||
8 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type | 15 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type |
9 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDeclaration | 16 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDeclaration |
10 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDefinition | 17 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDefinition |
11 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem | 18 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem |
12 | import hu.bme.mit.inf.dslreasoner.logic.model.patterns.SupertypeStar | 19 | import hu.bme.mit.inf.dslreasoner.logic.model.patterns.SupertypeStar |
13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion | 20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partial2logicannotations.PartialModelRelation2Assertion |
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.BinaryElementRelationLink | ||
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.BooleanElement | 21 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.BooleanElement |
16 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.IntegerElement | 22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.IntegerElement |
17 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.NaryRelationLink | ||
18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialBooleanInterpretation | 23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialBooleanInterpretation |
19 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialComplexTypeInterpretation | 24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialComplexTypeInterpretation |
20 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialIntegerInterpretation | 25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialIntegerInterpretation |
@@ -22,10 +27,10 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.par | |||
22 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRealInterpretation | 27 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRealInterpretation |
23 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation | 28 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation |
24 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialStringInterpretation | 29 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialStringInterpretation |
30 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialTypeInterpratation | ||
25 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory | 31 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory |
26 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement | 32 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement |
27 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.StringElement | 33 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.StringElement |
28 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.UnaryElementRelationLink | ||
29 | import java.math.BigDecimal | 34 | import java.math.BigDecimal |
30 | import java.util.HashMap | 35 | import java.util.HashMap |
31 | import java.util.Map | 36 | import java.util.Map |
@@ -35,14 +40,6 @@ import org.eclipse.viatra.query.runtime.emf.EMFScope | |||
35 | import org.eclipse.xtend.lib.annotations.Data | 40 | import org.eclipse.xtend.lib.annotations.Data |
36 | 41 | ||
37 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 42 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
38 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.SymbolicValue | ||
39 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.And | ||
40 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolLiteral | ||
41 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral | ||
42 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral | ||
43 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringLiteral | ||
44 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialTypeInterpratation | ||
45 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDefinition | ||
46 | 43 | ||
47 | @Data class Problem2PartialInterpretationTrace { | 44 | @Data class Problem2PartialInterpretationTrace { |
48 | Map<TypeDeclaration, PartialComplexTypeInterpretation> type2Interpretation | 45 | Map<TypeDeclaration, PartialComplexTypeInterpretation> type2Interpretation |
@@ -194,7 +191,7 @@ class PartialInterpretationInitialiser { | |||
194 | interpretation.minNewElements = minNewElements | 191 | interpretation.minNewElements = minNewElements |
195 | interpretation.maxNewElements = maxNewElements | 192 | interpretation.maxNewElements = maxNewElements |
196 | // elements from problem are included | 193 | // elements from problem are included |
197 | if(maxNewElements>0) { | 194 | if(maxNewElements != 0) { |
198 | val newElements = createDefinedElement => [it.name = "New Objects"] | 195 | val newElements = createDefinedElement => [it.name = "New Objects"] |
199 | interpretation.openWorldElements += newElements | 196 | interpretation.openWorldElements += newElements |
200 | } | 197 | } |
@@ -213,12 +210,8 @@ class PartialInterpretationInitialiser { | |||
213 | def private initialiseTypeScope(PartialTypeInterpratation interpretation, Integer min, Integer max) { | 210 | def private initialiseTypeScope(PartialTypeInterpratation interpretation, Integer min, Integer max) { |
214 | val res = createScope | 211 | val res = createScope |
215 | res.targetTypeInterpretation = interpretation | 212 | res.targetTypeInterpretation = interpretation |
216 | if(min !== null) { | 213 | res.minNewElements = min ?: 0 |
217 | res.minNewElements = min | 214 | res.maxNewElements = max ?: -1 |
218 | } | ||
219 | if(max !== null) { | ||
220 | res.maxNewElements = max | ||
221 | } | ||
222 | return res | 215 | return res |
223 | } | 216 | } |
224 | 217 | ||