diff options
author | 2019-07-30 18:57:01 +0200 | |
---|---|---|
committer | 2019-07-30 18:57:01 +0200 | |
commit | 4cb0aa5a0b9adac2bb8d4a995be015651bdd5628 (patch) | |
tree | 5c917ffa6f334e6b4c268b94fb0bd8910cf892b2 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend | |
parent | Allow infiite upper scope bound in PolyhedronScopePropagator (diff) | |
download | VIATRA-Generator-4cb0aa5a0b9adac2bb8d4a995be015651bdd5628.tar.gz VIATRA-Generator-4cb0aa5a0b9adac2bb8d4a995be015651bdd5628.tar.zst VIATRA-Generator-4cb0aa5a0b9adac2bb8d4a995be015651bdd5628.zip |
Polyhedron scope propagator for non-containment references
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend')
-rw-r--r-- | Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend index 286756a8..15b5a047 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/patterns/UnfinishedIndexer.xtend | |||
@@ -74,7 +74,7 @@ class UnfinishedIndexer { | |||
74 | «ENDIF» | 74 | «ENDIF» |
75 | 75 | ||
76 | «IF indexUpperMultiplicities» | 76 | «IF indexUpperMultiplicities» |
77 | «IF constraint.constrainsUnrepairable» | 77 | «IF constraint.constrainsUnrepairable || constraint.constrainsRemainingInverse» |
78 | private pattern «repairMatchName(constraint)»(problem:LogicProblem, interpretation:PartialInterpretation, source:DefinedElement, target:DefinedElement) { | 78 | private pattern «repairMatchName(constraint)»(problem:LogicProblem, interpretation:PartialInterpretation, source:DefinedElement, target:DefinedElement) { |
79 | find interpretation(problem,interpretation); | 79 | find interpretation(problem,interpretation); |
80 | find mustExist(problem,interpretation,source); | 80 | find mustExist(problem,interpretation,source); |
@@ -84,15 +84,17 @@ class UnfinishedIndexer { | |||
84 | neg «base.referRelation(constraint.relation,"source","target",Modality.MUST,fqn2PQuery)» | 84 | neg «base.referRelation(constraint.relation,"source","target",Modality.MUST,fqn2PQuery)» |
85 | «base.referRelation(constraint.relation,"source","target",Modality.MAY,fqn2PQuery)» | 85 | «base.referRelation(constraint.relation,"source","target",Modality.MAY,fqn2PQuery)» |
86 | } | 86 | } |
87 | 87 | «ENDIF» | |
88 | |||
89 | «IF constraint.constrainsUnrepairable» | ||
88 | private pattern «unrepairableMultiplicityName(constraint)»_helper(problem:LogicProblem, interpretation:PartialInterpretation, object:DefinedElement, unrepairableMultiplicity:java Integer) { | 90 | private pattern «unrepairableMultiplicityName(constraint)»_helper(problem:LogicProblem, interpretation:PartialInterpretation, object:DefinedElement, unrepairableMultiplicity:java Integer) { |
89 | find interpretation(problem,interpretation); | 91 | find interpretation(problem,interpretation); |
90 | find mustExist(problem,interpretation,object); | 92 | find mustExist(problem,interpretation,object); |
91 | «base.typeIndexer.referInstanceOf(constraint.sourceType,Modality::MUST,"object")» | 93 | «base.typeIndexer.referInstanceOf(constraint.sourceType,Modality::MUST,"object")» |
92 | find «unfinishedMultiplicityName(constraint)»_helper(problem, interpretation, object, missingMultiplicity); | 94 | find «unfinishedMultiplicityName(constraint)»_helper(problem, interpretation, object, missingMultiplicity); |
93 | numerOfRepairMatches == count find «repairMatchName(constraint)»(problem, interpretation, object, _); | 95 | numberOfRepairMatches == count find «repairMatchName(constraint)»(problem, interpretation, object, _); |
94 | check(numerOfRepairMatches < missingMultiplicity); | 96 | check(numberOfRepairMatches < missingMultiplicity); |
95 | unrepairableMultiplicity == eval(missingMultiplicity-numerOfRepairMatches); | 97 | unrepairableMultiplicity == eval(missingMultiplicity-numberOfRepairMatches); |
96 | } | 98 | } |
97 | 99 | ||
98 | private pattern «unrepairableMultiplicityName(constraint)»(problem:LogicProblem, interpretation:PartialInterpretation, unrepairableMultiplicity:java Integer) { | 100 | private pattern «unrepairableMultiplicityName(constraint)»(problem:LogicProblem, interpretation:PartialInterpretation, unrepairableMultiplicity:java Integer) { |
@@ -112,7 +114,8 @@ class UnfinishedIndexer { | |||
112 | «base.typeIndexer.referInstanceOf(constraint.targetType,Modality::MUST,"object")» | 114 | «base.typeIndexer.referInstanceOf(constraint.targetType,Modality::MUST,"object")» |
113 | numberOfExistingReferences == count «base.referRelation(constraint.relation,"_","object",Modality.MUST,fqn2PQuery)» | 115 | numberOfExistingReferences == count «base.referRelation(constraint.relation,"_","object",Modality.MUST,fqn2PQuery)» |
114 | check(numberOfExistingReferences < «constraint.inverseUpperBound»); | 116 | check(numberOfExistingReferences < «constraint.inverseUpperBound»); |
115 | remainingMultiplicity == eval(«constraint.inverseUpperBound»-numberOfExistingReferences); | 117 | numberOfRepairMatches == count find «repairMatchName(constraint)»(problem, interpretation, _, object); |
118 | remainingMultiplicity == eval(Math.min(«constraint.inverseUpperBound»-numberOfExistingReferences, numberOfRepairMatches)); | ||
116 | } | 119 | } |
117 | 120 | ||
118 | pattern «remainingMultiplicityName(constraint)»(problem:LogicProblem, interpretation:PartialInterpretation, remainingMultiplicity:java Integer) { | 121 | pattern «remainingMultiplicityName(constraint)»(problem:LogicProblem, interpretation:PartialInterpretation, remainingMultiplicity:java Integer) { |