diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver')
3 files changed, 10 insertions, 7 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend index 144e5e6f..d386241d 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/ViatraReasoner.xtend | |||
@@ -110,7 +110,7 @@ class ViatraReasoner extends LogicReasoner { | |||
110 | new SolutionStore(numberOfRequiredSolutions) | 110 | new SolutionStore(numberOfRequiredSolutions) |
111 | } | 111 | } |
112 | solutionStore.registerSolutionFoundHandler(new LoggerSolutionFoundHandler(viatraConfig)) | 112 | solutionStore.registerSolutionFoundHandler(new LoggerSolutionFoundHandler(viatraConfig)) |
113 | val numericSolver = new NumericSolver(method, viatraConfig, false) | 113 | val numericSolver = new NumericSolver(method, viatraConfig, true)//was formerly hard-coded to false for caching |
114 | val solutionSaver = method.solutionSaver | 114 | val solutionSaver = method.solutionSaver |
115 | solutionSaver.numericSolver = numericSolver | 115 | solutionSaver.numericSolver = numericSolver |
116 | val solutionCopier = solutionSaver.solutionCopier | 116 | val solutionCopier = solutionSaver.solutionCopier |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/NumericSolver.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/NumericSolver.xtend index 4b0ea544..ab3e6601 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/NumericSolver.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/NumericSolver.xtend | |||
@@ -98,11 +98,12 @@ class NumericSolver { | |||
98 | finalResult=true | 98 | finalResult=true |
99 | } else { | 99 | } else { |
100 | val propagatedConstraints = new HashMap | 100 | val propagatedConstraints = new HashMap |
101 | println("------ Any matches?") | ||
101 | for(entry : matches.entrySet) { | 102 | for(entry : matches.entrySet) { |
102 | val constraint = entry.key | 103 | val constraint = entry.key |
103 | //println(constraint) | 104 | println("------ " + constraint) |
104 | val allMatches = entry.value.allMatches.map[it.toArray] | 105 | val allMatches = entry.value.allMatches.map[it.toArray] |
105 | //println(allMatches.toList) | 106 | println("------ " + allMatches.toList) |
106 | propagatedConstraints.put(constraint,allMatches) | 107 | propagatedConstraints.put(constraint,allMatches) |
107 | } | 108 | } |
108 | if(propagatedConstraints.values.forall[empty]) { | 109 | if(propagatedConstraints.values.forall[empty]) { |
@@ -198,6 +199,6 @@ class NumericSolver { | |||
198 | 199 | ||
199 | def protected dispatch fillWithValue(BooleanElement e, Object value) {e.valueSet=true e.value=value as Boolean} | 200 | def protected dispatch fillWithValue(BooleanElement e, Object value) {e.valueSet=true e.value=value as Boolean} |
200 | def protected dispatch fillWithValue(IntegerElement e, Object value) {e.valueSet=true e.value=value as Integer} | 201 | def protected dispatch fillWithValue(IntegerElement e, Object value) {e.valueSet=true e.value=value as Integer} |
201 | def protected dispatch fillWithValue(RealElement e, Object value) {e.valueSet=true e.value=BigDecimal.valueOf(value as Double) } | 202 | def protected dispatch fillWithValue(RealElement e, Object value) {e.valueSet=true e.value=value as Double } |
202 | def protected dispatch fillWithValue(StringElement e, Object value) {e.valueSet=true e.value=value as String} | 203 | def protected dispatch fillWithValue(StringElement e, Object value) {e.valueSet=true e.value=value as String} |
203 | } \ No newline at end of file | 204 | } \ No newline at end of file |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/PartialModelAsLogicInterpretation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/PartialModelAsLogicInterpretation.xtend index b48d0831..4484052d 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/PartialModelAsLogicInterpretation.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner/src/hu/bme/mit/inf/dslreasoner/viatrasolver/reasoner/dse/PartialModelAsLogicInterpretation.xtend | |||
@@ -36,7 +36,7 @@ class PartialModelAsLogicInterpretation implements LogicModelInterpretation{ | |||
36 | val Map<DefinedElement,DefinedElement> elementBackwardTrace | 36 | val Map<DefinedElement,DefinedElement> elementBackwardTrace |
37 | val Map<Boolean, BooleanElement> booleanForwardTrace | 37 | val Map<Boolean, BooleanElement> booleanForwardTrace |
38 | val Map<Integer, IntegerElement> integerForwardTrace | 38 | val Map<Integer, IntegerElement> integerForwardTrace |
39 | val Map<BigDecimal, RealElement> realForwardTrace | 39 | val Map<Double, RealElement> realForwardTrace |
40 | val Map<String, StringElement> stringForwardTrace | 40 | val Map<String, StringElement> stringForwardTrace |
41 | 41 | ||
42 | new(PartialInterpretation partialInterpretation, Map<EObject, EObject> forwardMap) { | 42 | new(PartialInterpretation partialInterpretation, Map<EObject, EObject> forwardMap) { |
@@ -51,7 +51,9 @@ class PartialModelAsLogicInterpretation implements LogicModelInterpretation{ | |||
51 | integerForwardTrace = initialisePrimitiveElementTrace( | 51 | integerForwardTrace = initialisePrimitiveElementTrace( |
52 | 0,[it+1],[it],partialInterpretation.newElements.filter(IntegerElement),[it.value]) | 52 | 0,[it+1],[it],partialInterpretation.newElements.filter(IntegerElement),[it.value]) |
53 | realForwardTrace = initialisePrimitiveElementTrace( | 53 | realForwardTrace = initialisePrimitiveElementTrace( |
54 | BigDecimal::ZERO,[it.add(BigDecimal.ONE)],[it],partialInterpretation.newElements.filter(RealElement),[it.value]) | 54 | 0.0,[it+1.0],[it],partialInterpretation.newElements.filter(RealElement),[it.value]) |
55 | // realForwardTrace = initialisePrimitiveElementTrace( | ||
56 | // BigDecimal::ZERO,[it.add(BigDecimal.ONE)],[it],partialInterpretation.newElements.filter(RealElement),[it.value]) | ||
55 | stringForwardTrace = initialisePrimitiveElementTrace( | 57 | stringForwardTrace = initialisePrimitiveElementTrace( |
56 | 0,[it+1],['''String«it»'''],partialInterpretation.newElements.filter(StringElement),[it.value]) | 58 | 0,[it+1],['''String«it»'''],partialInterpretation.newElements.filter(StringElement),[it.value]) |
57 | } | 59 | } |
@@ -116,7 +118,7 @@ class PartialModelAsLogicInterpretation implements LogicModelInterpretation{ | |||
116 | def dispatch elementLookupForward(Integer e) { | 118 | def dispatch elementLookupForward(Integer e) { |
117 | this.integerForwardTrace.get(e) | 119 | this.integerForwardTrace.get(e) |
118 | } | 120 | } |
119 | def dispatch elementLookupForward(BigDecimal e) { | 121 | def dispatch elementLookupForward(Double e) { |
120 | this.realForwardTrace.get(e) | 122 | this.realForwardTrace.get(e) |
121 | } | 123 | } |
122 | def dispatch elementLookupForward(String e) { | 124 | def dispatch elementLookupForward(String e) { |