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, 11 insertions, 3 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 2376fb38..8f3a5bb0 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
@@ -79,7 +79,7 @@ class ScopePropagator {
79 // Nothing to propagate. 79 // Nothing to propagate.
80 } 80 }
81 81
82 def propagateAdditionToType(PartialTypeInterpratation t) { 82 def decrementTypeScope(PartialTypeInterpratation t) {
83// println('''Adding to «(t as PartialComplexTypeInterpretation).interpretationOf.name»''') 83// println('''Adding to «(t as PartialComplexTypeInterpretation).interpretationOf.name»''')
84 val targetScope = type2Scope.get(t) 84 val targetScope = type2Scope.get(t)
85 if (targetScope !== null) { 85 if (targetScope !== null) {
@@ -96,15 +96,23 @@ class ScopePropagator {
96 if (this.partialInterpretation.maxNewElements > 0) { 96 if (this.partialInterpretation.maxNewElements > 0) {
97 this.partialInterpretation.maxNewElements = this.partialInterpretation.maxNewElements - 1 97 this.partialInterpretation.maxNewElements = this.partialInterpretation.maxNewElements - 1
98 } else if (this.partialInterpretation.maxNewElements === 0) { 98 } else if (this.partialInterpretation.maxNewElements === 0) {
99 throw new IllegalArgumentException('''Inconsistent object creation: lower node limit is 0!''') 99 setScopesInvalid()
100 } 100 }
101 propagateAllScopeConstraints
102 101
103// println('''Target Scope: «targetScope.minNewElements» - «targetScope.maxNewElements»''') 102// println('''Target Scope: «targetScope.minNewElements» - «targetScope.maxNewElements»''')
104// println(''' «this.partialInterpretation.minNewElements» - «this.partialInterpretation.maxNewElements»''') 103// println(''' «this.partialInterpretation.minNewElements» - «this.partialInterpretation.maxNewElements»''')
105// this.partialInterpretation.scopes.forEach[println(''' «(it.targetTypeInterpretation as PartialComplexTypeInterpretation).interpretationOf.name»: «it.minNewElements»-«it.maxNewElements»''')] 104// this.partialInterpretation.scopes.forEach[println(''' «(it.targetTypeInterpretation as PartialComplexTypeInterpretation).interpretationOf.name»: «it.minNewElements»-«it.maxNewElements»''')]
106// println('''All constraints are propagated upon increasing «(t as PartialComplexTypeInterpretation).interpretationOf.name»''') 105// println('''All constraints are propagated upon increasing «(t as PartialComplexTypeInterpretation).interpretationOf.name»''')
107 } 106 }
107
108 protected def setScopesInvalid() {
109 partialInterpretation.minNewElements = Integer.MAX_VALUE
110 partialInterpretation.maxNewElements = 0
111 for (scope : partialInterpretation.scopes) {
112 scope.minNewElements = Integer.MAX_VALUE
113 scope.maxNewElements = 0
114 }
115 }
108 116
109 def void propagateAdditionToRelation(Relation r) { 117 def void propagateAdditionToRelation(Relation r) {
110 // Nothing to propagate. 118 // Nothing to propagate.