diff options
author | 2020-05-18 21:45:19 +0200 | |
---|---|---|
committer | 2020-05-18 21:45:19 +0200 | |
commit | c0568c4373fa00e2ba2e165cfd681dd7cd61add6 (patch) | |
tree | 2b896db05d2b4be163f0ea639f847fe6426c6eb4 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules | |
parent | Merge branch 'master' of https://github.com/viatra/VIATRA-Generator (diff) | |
download | VIATRA-Generator-c0568c4373fa00e2ba2e165cfd681dd7cd61add6.tar.gz VIATRA-Generator-c0568c4373fa00e2ba2e165cfd681dd7cd61add6.tar.zst VIATRA-Generator-c0568c4373fa00e2ba2e165cfd681dd7cd61add6.zip |
removed every occurence of check expressions
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules')
2 files changed, 23 insertions, 21 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/GoalConstraintProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/GoalConstraintProvider.xtend index 87f7e339..0e8d341a 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/GoalConstraintProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/GoalConstraintProvider.xtend | |||
@@ -19,38 +19,40 @@ import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher | |||
19 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | 19 | import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* |
20 | 20 | ||
21 | class GoalConstraintProvider { | 21 | class GoalConstraintProvider { |
22 | val calculateObjectCost = true | 22 | val calculateObjectCost = false |
23 | 23 | ||
24 | def public getUnfinishedMultiplicityQueries(LogicProblem p, GeneratedPatterns patterns) { | 24 | def public getUnfinishedMultiplicityQueries(LogicProblem p, GeneratedPatterns patterns) { |
25 | val res = new ArrayList() | 25 | val res = new ArrayList() |
26 | 26 | ||
27 | res.addAll(patterns.unfinishedContainmentMulticiplicityQueries,true) | 27 | res.addAll(patterns.unfinishedNonContainmentMulticiplicityQueries,false) |
28 | if(calculateObjectCost) { | 28 | if(calculateObjectCost) { |
29 | val middingObjectCost = calculateMissingObjectCost(p) | 29 | val missingObjectCost = calculateMissingObjectCost(p) |
30 | res.addAll(patterns.unfinishedNonContainmentMulticiplicityQueries,false) | 30 | res.addAll(patterns.unfinishedContainmentMulticiplicityQueries,true,missingObjectCost) |
31 | } else { | 31 | } else { |
32 | res.addAll(patterns.unfinishedNonContainmentMulticiplicityQueries,false) | 32 | res.addAll(patterns.unfinishedContainmentMulticiplicityQueries,true) |
33 | } | 33 | } |
34 | return res | 34 | return res |
35 | } | 35 | } |
36 | 36 | ||
37 | def addAll(ArrayList<MultiplicityGoalConstraintCalculator> res, Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> queries, boolean containment) { | 37 | def addAll(ArrayList<MultiplicityGoalConstraintCalculator> res, Map<Relation, Pair<IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>,Integer>> queries, boolean containment) { |
38 | for(multiplicityQuery : queries.entrySet) { | 38 | for(multiplicityQuery : queries.entrySet) { |
39 | val targetRelationName = multiplicityQuery.key.name | 39 | val targetRelationName = multiplicityQuery.key.name |
40 | val query = multiplicityQuery.value | 40 | val query = multiplicityQuery.value.key |
41 | res += new MultiplicityGoalConstraintCalculator(targetRelationName,query,containment,1); | 41 | val minValue = multiplicityQuery.value.value |
42 | res += new MultiplicityGoalConstraintCalculator(targetRelationName,query,minValue,containment,1); | ||
42 | } | 43 | } |
43 | } | 44 | } |
44 | def addAll( | 45 | def addAll( |
45 | ArrayList<MultiplicityGoalConstraintCalculator> res, | 46 | ArrayList<MultiplicityGoalConstraintCalculator> res, |
46 | Map<Relation, IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> queries, | 47 | Map<Relation, Pair<IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>,Integer>> queries, |
47 | boolean containment, | 48 | boolean containment, |
48 | Map<Relation, Integer> cost | 49 | Map<Relation, Integer> cost |
49 | ) { | 50 | ) { |
50 | for(multiplicityQuery : queries.entrySet) { | 51 | for(multiplicityQuery : queries.entrySet) { |
51 | val targetRelationName = multiplicityQuery.key.name | 52 | val targetRelationName = multiplicityQuery.key.name |
52 | val query = multiplicityQuery.value | 53 | val query = multiplicityQuery.value.key |
53 | res += new MultiplicityGoalConstraintCalculator(targetRelationName,query,containment,multiplicityQuery.key.lookup(cost)) | 54 | val minValue = multiplicityQuery.value.value |
55 | res += new MultiplicityGoalConstraintCalculator(targetRelationName,query,minValue,containment,multiplicityQuery.key.lookup(cost)) | ||
54 | } | 56 | } |
55 | } | 57 | } |
56 | 58 | ||
@@ -80,7 +82,7 @@ class GoalConstraintProvider { | |||
80 | for(containment : containments) { | 82 | for(containment : containments) { |
81 | val key = containment | 83 | val key = containment |
82 | val value = (containment.parameters.get(1) as ComplexTypeReference).referred.count(type2NewCost) | 84 | val value = (containment.parameters.get(1) as ComplexTypeReference).referred.count(type2NewCost) |
83 | //println('''«key.name» --> «value» new''') | 85 | // println('''«key.name» --> «value» new''') |
84 | res.put(key,value) | 86 | res.put(key,value) |
85 | } | 87 | } |
86 | return res | 88 | return res |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend index 16438a5a..23ea118b 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/rules/RefinementRuleProvider.xtend | |||
@@ -413,9 +413,6 @@ class RefinementRuleProvider { | |||
413 | newElement.name = '''new «interpretation.newElements.size»''' | 413 | newElement.name = '''new «interpretation.newElements.size»''' |
414 | } | 414 | } |
415 | 415 | ||
416 | // Existence | ||
417 | interpretation.newElements+=newElement | ||
418 | |||
419 | // Types | 416 | // Types |
420 | typeInterpretation.elements += newElement | 417 | typeInterpretation.elements += newElement |
421 | if(typeInterpretation instanceof PartialComplexTypeInterpretation) { | 418 | if(typeInterpretation instanceof PartialComplexTypeInterpretation) { |
@@ -431,6 +428,9 @@ class RefinementRuleProvider { | |||
431 | // Scope propagation | 428 | // Scope propagation |
432 | scopePropagator.propagateAdditionToType(typeInterpretation) | 429 | scopePropagator.propagateAdditionToType(typeInterpretation) |
433 | 430 | ||
431 | // Existence | ||
432 | interpretation.newElements+=newElement | ||
433 | |||
434 | // Do recursive object creation | 434 | // Do recursive object creation |
435 | for(newConstructor : recursiceObjectCreations) { | 435 | for(newConstructor : recursiceObjectCreations) { |
436 | createObjectAction(nameNewElement,newConstructor,newElement,scopePropagator) | 436 | createObjectAction(nameNewElement,newConstructor,newElement,scopePropagator) |
@@ -454,9 +454,6 @@ class RefinementRuleProvider { | |||
454 | newElement.name = '''new «interpretation.newElements.size»''' | 454 | newElement.name = '''new «interpretation.newElements.size»''' |
455 | } | 455 | } |
456 | 456 | ||
457 | // Existence | ||
458 | interpretation.newElements+=newElement | ||
459 | |||
460 | // Types | 457 | // Types |
461 | typeInterpretation.elements += newElement | 458 | typeInterpretation.elements += newElement |
462 | if(typeInterpretation instanceof PartialComplexTypeInterpretation) { | 459 | if(typeInterpretation instanceof PartialComplexTypeInterpretation) { |
@@ -469,6 +466,9 @@ class RefinementRuleProvider { | |||
469 | // Scope propagation | 466 | // Scope propagation |
470 | scopePropagator.propagateAdditionToType(typeInterpretation) | 467 | scopePropagator.propagateAdditionToType(typeInterpretation) |
471 | 468 | ||
469 | // Existence | ||
470 | interpretation.newElements+=newElement | ||
471 | |||
472 | // Do recursive object creation | 472 | // Do recursive object creation |
473 | for(newConstructor : recursiceObjectCreations) { | 473 | for(newConstructor : recursiceObjectCreations) { |
474 | createObjectAction(nameNewElement,newConstructor,newElement,scopePropagator) | 474 | createObjectAction(nameNewElement,newConstructor,newElement,scopePropagator) |
@@ -490,9 +490,6 @@ class RefinementRuleProvider { | |||
490 | newElement.name = '''new «interpretation.newElements.size»''' | 490 | newElement.name = '''new «interpretation.newElements.size»''' |
491 | } | 491 | } |
492 | 492 | ||
493 | // Existence | ||
494 | interpretation.newElements+=newElement | ||
495 | |||
496 | // Types | 493 | // Types |
497 | typeInterpretation.elements += newElement | 494 | typeInterpretation.elements += newElement |
498 | if(typeInterpretation instanceof PartialComplexTypeInterpretation) { | 495 | if(typeInterpretation instanceof PartialComplexTypeInterpretation) { |
@@ -502,6 +499,9 @@ class RefinementRuleProvider { | |||
502 | // Scope propagation | 499 | // Scope propagation |
503 | scopePropagator.propagateAdditionToType(typeInterpretation) | 500 | scopePropagator.propagateAdditionToType(typeInterpretation) |
504 | 501 | ||
502 | // Existence | ||
503 | interpretation.newElements+=newElement | ||
504 | |||
505 | // Do recursive object creation | 505 | // Do recursive object creation |
506 | for(newConstructor : recursiceObjectCreations) { | 506 | for(newConstructor : recursiceObjectCreations) { |
507 | createObjectAction(nameNewElement,newConstructor,newElement,scopePropagator) | 507 | createObjectAction(nameNewElement,newConstructor,newElement,scopePropagator) |