aboutsummaryrefslogtreecommitdiffstats
path: root/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend
diff options
context:
space:
mode:
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend')
-rw-r--r--Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend14
1 files changed, 12 insertions, 2 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend
index 93b83577..cacba3c6 100644
--- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend
+++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend
@@ -19,6 +19,8 @@ class ScopePropagator {
19 val Map<PartialTypeInterpratation, Scope> type2Scope 19 val Map<PartialTypeInterpratation, Scope> type2Scope
20 @Accessors(PROTECTED_GETTER) val Map<Scope, Set<Scope>> superScopes 20 @Accessors(PROTECTED_GETTER) val Map<Scope, Set<Scope>> superScopes
21 @Accessors(PROTECTED_GETTER) val Map<Scope, Set<Scope>> subScopes 21 @Accessors(PROTECTED_GETTER) val Map<Scope, Set<Scope>> subScopes
22
23 @Accessors(PUBLIC_GETTER) var scopePropagationNeeded = false
22 24
23 new(PartialInterpretation p, ModelGenerationStatistics statistics) { 25 new(PartialInterpretation p, ModelGenerationStatistics statistics) {
24 partialInterpretation = p 26 partialInterpretation = p
@@ -64,7 +66,8 @@ class ScopePropagator {
64 copyScopeBoundsToHeuristic() 66 copyScopeBoundsToHeuristic()
65 } 67 }
66 68
67 def propagateAllScopeConstraints() { 69 def void propagateAllScopeConstraints() {
70 scopePropagationNeeded = false
68 if (!valid) { 71 if (!valid) {
69 return 72 return
70 } 73 }
@@ -93,6 +96,7 @@ class ScopePropagator {
93 if (isPrimitive) { 96 if (isPrimitive) {
94 return 97 return
95 } 98 }
99 scopePropagationNeeded = true
96// println('''Adding to «(t as PartialComplexTypeInterpretation).interpretationOf.name»''') 100// println('''Adding to «(t as PartialComplexTypeInterpretation).interpretationOf.name»''')
97 val targetScope = type2Scope.get(t) 101 val targetScope = type2Scope.get(t)
98 if (targetScope !== null) { 102 if (targetScope !== null) {
@@ -117,6 +121,12 @@ class ScopePropagator {
117// this.partialInterpretation.scopes.forEach[println(''' «(it.targetTypeInterpretation as PartialComplexTypeInterpretation).interpretationOf.name»: «it.minNewElements»-«it.maxNewElements»''')] 121// this.partialInterpretation.scopes.forEach[println(''' «(it.targetTypeInterpretation as PartialComplexTypeInterpretation).interpretationOf.name»: «it.minNewElements»-«it.maxNewElements»''')]
118// println('''All constraints are propagated upon increasing «(t as PartialComplexTypeInterpretation).interpretationOf.name»''') 122// println('''All constraints are propagated upon increasing «(t as PartialComplexTypeInterpretation).interpretationOf.name»''')
119 } 123 }
124
125 def addedToRelation(Relation r) {
126 if (isPropagationNeededAfterAdditionToRelation(r)) {
127 scopePropagationNeeded = true
128 }
129 }
120 130
121 protected def setScopesInvalid() { 131 protected def setScopesInvalid() {
122 partialInterpretation.minNewElements = Integer.MAX_VALUE 132 partialInterpretation.minNewElements = Integer.MAX_VALUE
@@ -127,7 +137,7 @@ class ScopePropagator {
127 } 137 }
128 } 138 }
129 139
130 def isPropagationNeededAfterAdditionToRelation(Relation r) { 140 protected def isPropagationNeededAfterAdditionToRelation(Relation r) {
131 false 141 false
132 } 142 }
133 143