diff options
author | Kristóf Marussy <marussy@mit.bme.hu> | 2020-07-07 15:00:13 +0200 |
---|---|---|
committer | Kristóf Marussy <marussy@mit.bme.hu> | 2020-07-07 15:00:13 +0200 |
commit | a7b9a3eef14fc165909d00c65bb6fc1744a8ebd8 (patch) | |
tree | dd816939088926b3009432afa22be0e2a116436f /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/cardinality/ScopePropagator.xtend | |
parent | Add modified VIATRA-DSE version (diff) | |
download | VIATRA-Generator-a7b9a3eef14fc165909d00c65bb6fc1744a8ebd8.tar.gz VIATRA-Generator-a7b9a3eef14fc165909d00c65bb6fc1744a8ebd8.tar.zst VIATRA-Generator-a7b9a3eef14fc165909d00c65bb6fc1744a8ebd8.zip |
Trying to fix performance regressions
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.xtend | 14 |
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 132ca8e8..3e95b2cc 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 | |||
@@ -60,15 +60,23 @@ class ScopePropagator { | |||
60 | } | 60 | } |
61 | } | 61 | } |
62 | } while (changed) | 62 | } while (changed) |
63 | 63 | ||
64 | copyScopeBoundsToHeuristic() | 64 | copyScopeBoundsToHeuristic() |
65 | } | 65 | } |
66 | 66 | ||
67 | def propagateAllScopeConstraints() { | 67 | def propagateAllScopeConstraints() { |
68 | if (!valid) { | ||
69 | return | ||
70 | } | ||
68 | statistics.incrementScopePropagationCount() | 71 | statistics.incrementScopePropagationCount() |
69 | doPropagateAllScopeConstraints() | 72 | doPropagateAllScopeConstraints() |
70 | } | 73 | } |
71 | 74 | ||
75 | def isValid() { | ||
76 | partialInterpretation.maxNewElements == -1 || | ||
77 | partialInterpretation.minNewElements <= partialInterpretation.maxNewElements | ||
78 | } | ||
79 | |||
72 | protected def copyScopeBoundsToHeuristic() { | 80 | protected def copyScopeBoundsToHeuristic() { |
73 | partialInterpretation.minNewElementsHeuristic = partialInterpretation.minNewElements | 81 | partialInterpretation.minNewElementsHeuristic = partialInterpretation.minNewElements |
74 | for (scope : partialInterpretation.scopes) { | 82 | for (scope : partialInterpretation.scopes) { |
@@ -109,7 +117,7 @@ class ScopePropagator { | |||
109 | // this.partialInterpretation.scopes.forEach[println(''' «(it.targetTypeInterpretation as PartialComplexTypeInterpretation).interpretationOf.name»: «it.minNewElements»-«it.maxNewElements»''')] | 117 | // this.partialInterpretation.scopes.forEach[println(''' «(it.targetTypeInterpretation as PartialComplexTypeInterpretation).interpretationOf.name»: «it.minNewElements»-«it.maxNewElements»''')] |
110 | // println('''All constraints are propagated upon increasing «(t as PartialComplexTypeInterpretation).interpretationOf.name»''') | 118 | // println('''All constraints are propagated upon increasing «(t as PartialComplexTypeInterpretation).interpretationOf.name»''') |
111 | } | 119 | } |
112 | 120 | ||
113 | protected def setScopesInvalid() { | 121 | protected def setScopesInvalid() { |
114 | partialInterpretation.minNewElements = Integer.MAX_VALUE | 122 | partialInterpretation.minNewElements = Integer.MAX_VALUE |
115 | partialInterpretation.maxNewElements = 0 | 123 | partialInterpretation.maxNewElements = 0 |