diff options
author | Aren Babikian <aren.babikian@mail.mcgill.ca> | 2021-01-14 13:11:21 -0500 |
---|---|---|
committer | Aren Babikian <aren.babikian@mail.mcgill.ca> | 2021-01-14 13:11:21 -0500 |
commit | be2fd000db012b3738211ebee8db36001235c918 (patch) | |
tree | b642948cc40fa1576bbf4eeedcd00bf086e0e8b8 | |
parent | forgot to commit some changes to Application (diff) | |
download | VIATRA-Generator-be2fd000db012b3738211ebee8db36001235c918.tar.gz VIATRA-Generator-be2fd000db012b3738211ebee8db36001235c918.tar.zst VIATRA-Generator-be2fd000db012b3738211ebee8db36001235c918.zip |
complete change of real representation BigDecimal->Double
20 files changed, 70 insertions, 76 deletions
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/RealLiteral.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/RealLiteral.java index 0ba0a6ca..fd289abb 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/RealLiteral.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/RealLiteral.java | |||
@@ -2,8 +2,6 @@ | |||
2 | */ | 2 | */ |
3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage; | 3 | package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage; |
4 | 4 | ||
5 | import java.math.BigDecimal; | ||
6 | |||
7 | /** | 5 | /** |
8 | * <!-- begin-user-doc --> | 6 | * <!-- begin-user-doc --> |
9 | * A representation of the model object '<em><b>Real Literal</b></em>'. | 7 | * A representation of the model object '<em><b>Real Literal</b></em>'. |
@@ -30,12 +28,12 @@ public interface RealLiteral extends AtomicTerm { | |||
30 | * </p> | 28 | * </p> |
31 | * <!-- end-user-doc --> | 29 | * <!-- end-user-doc --> |
32 | * @return the value of the '<em>Value</em>' attribute. | 30 | * @return the value of the '<em>Value</em>' attribute. |
33 | * @see #setValue(BigDecimal) | 31 | * @see #setValue(double) |
34 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage#getRealLiteral_Value() | 32 | * @see hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage#getRealLiteral_Value() |
35 | * @model required="true" | 33 | * @model required="true" |
36 | * @generated | 34 | * @generated |
37 | */ | 35 | */ |
38 | BigDecimal getValue(); | 36 | double getValue(); |
39 | 37 | ||
40 | /** | 38 | /** |
41 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral#getValue <em>Value</em>}' attribute. | 39 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral#getValue <em>Value</em>}' attribute. |
@@ -45,6 +43,6 @@ public interface RealLiteral extends AtomicTerm { | |||
45 | * @see #getValue() | 43 | * @see #getValue() |
46 | * @generated | 44 | * @generated |
47 | */ | 45 | */ |
48 | void setValue(BigDecimal value); | 46 | void setValue(double value); |
49 | 47 | ||
50 | } // RealLiteral | 48 | } // RealLiteral |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguagePackageImpl.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguagePackageImpl.java index 03a679e4..48cb3efb 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguagePackageImpl.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/LogiclanguagePackageImpl.java | |||
@@ -2351,7 +2351,7 @@ public class LogiclanguagePackageImpl extends EPackageImpl implements Logiclangu | |||
2351 | initEAttribute(getBoolLiteral_Value(), ecorePackage.getEBoolean(), "value", null, 1, 1, BoolLiteral.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | 2351 | initEAttribute(getBoolLiteral_Value(), ecorePackage.getEBoolean(), "value", null, 1, 1, BoolLiteral.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
2352 | 2352 | ||
2353 | initEClass(realLiteralEClass, RealLiteral.class, "RealLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | 2353 | initEClass(realLiteralEClass, RealLiteral.class, "RealLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
2354 | initEAttribute(getRealLiteral_Value(), ecorePackage.getEBigDecimal(), "value", null, 1, 1, RealLiteral.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | 2354 | initEAttribute(getRealLiteral_Value(), ecorePackage.getEDouble(), "value", null, 1, 1, RealLiteral.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
2355 | 2355 | ||
2356 | initEClass(variableEClass, Variable.class, "Variable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | 2356 | initEClass(variableEClass, Variable.class, "Variable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
2357 | initEReference(getVariable_Range(), this.getTypeReference(), null, "range", null, 1, 1, Variable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | 2357 | initEReference(getVariable_Range(), this.getTypeReference(), null, "range", null, 1, 1, Variable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/RealLiteralImpl.java b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/RealLiteralImpl.java index ffb2b97f..08791e2a 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/RealLiteralImpl.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/ecore-gen/hu/bme/mit/inf/dslreasoner/logic/model/logiclanguage/impl/RealLiteralImpl.java | |||
@@ -4,9 +4,6 @@ package hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.impl; | |||
4 | 4 | ||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage; | 5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.LogiclanguagePackage; |
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral; | 6 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral; |
7 | |||
8 | import java.math.BigDecimal; | ||
9 | |||
10 | import org.eclipse.emf.common.notify.Notification; | 7 | import org.eclipse.emf.common.notify.Notification; |
11 | 8 | ||
12 | import org.eclipse.emf.ecore.EClass; | 9 | import org.eclipse.emf.ecore.EClass; |
@@ -35,7 +32,7 @@ public class RealLiteralImpl extends AtomicTermImpl implements RealLiteral { | |||
35 | * @generated | 32 | * @generated |
36 | * @ordered | 33 | * @ordered |
37 | */ | 34 | */ |
38 | protected static final BigDecimal VALUE_EDEFAULT = null; | 35 | protected static final double VALUE_EDEFAULT = 0.0; |
39 | 36 | ||
40 | /** | 37 | /** |
41 | * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. | 38 | * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. |
@@ -45,7 +42,7 @@ public class RealLiteralImpl extends AtomicTermImpl implements RealLiteral { | |||
45 | * @generated | 42 | * @generated |
46 | * @ordered | 43 | * @ordered |
47 | */ | 44 | */ |
48 | protected BigDecimal value = VALUE_EDEFAULT; | 45 | protected double value = VALUE_EDEFAULT; |
49 | 46 | ||
50 | /** | 47 | /** |
51 | * <!-- begin-user-doc --> | 48 | * <!-- begin-user-doc --> |
@@ -72,7 +69,7 @@ public class RealLiteralImpl extends AtomicTermImpl implements RealLiteral { | |||
72 | * @generated | 69 | * @generated |
73 | */ | 70 | */ |
74 | @Override | 71 | @Override |
75 | public BigDecimal getValue() { | 72 | public double getValue() { |
76 | return value; | 73 | return value; |
77 | } | 74 | } |
78 | 75 | ||
@@ -82,8 +79,8 @@ public class RealLiteralImpl extends AtomicTermImpl implements RealLiteral { | |||
82 | * @generated | 79 | * @generated |
83 | */ | 80 | */ |
84 | @Override | 81 | @Override |
85 | public void setValue(BigDecimal newValue) { | 82 | public void setValue(double newValue) { |
86 | BigDecimal oldValue = value; | 83 | double oldValue = value; |
87 | value = newValue; | 84 | value = newValue; |
88 | if (eNotificationRequired()) | 85 | if (eNotificationRequired()) |
89 | eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.REAL_LITERAL__VALUE, oldValue, value)); | 86 | eNotify(new ENotificationImpl(this, Notification.SET, LogiclanguagePackage.REAL_LITERAL__VALUE, oldValue, value)); |
@@ -112,7 +109,7 @@ public class RealLiteralImpl extends AtomicTermImpl implements RealLiteral { | |||
112 | public void eSet(int featureID, Object newValue) { | 109 | public void eSet(int featureID, Object newValue) { |
113 | switch (featureID) { | 110 | switch (featureID) { |
114 | case LogiclanguagePackage.REAL_LITERAL__VALUE: | 111 | case LogiclanguagePackage.REAL_LITERAL__VALUE: |
115 | setValue((BigDecimal)newValue); | 112 | setValue((Double)newValue); |
116 | return; | 113 | return; |
117 | } | 114 | } |
118 | super.eSet(featureID, newValue); | 115 | super.eSet(featureID, newValue); |
@@ -142,7 +139,7 @@ public class RealLiteralImpl extends AtomicTermImpl implements RealLiteral { | |||
142 | public boolean eIsSet(int featureID) { | 139 | public boolean eIsSet(int featureID) { |
143 | switch (featureID) { | 140 | switch (featureID) { |
144 | case LogiclanguagePackage.REAL_LITERAL__VALUE: | 141 | case LogiclanguagePackage.REAL_LITERAL__VALUE: |
145 | return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); | 142 | return value != VALUE_EDEFAULT; |
146 | } | 143 | } |
147 | return super.eIsSet(featureID); | 144 | return super.eIsSet(featureID); |
148 | } | 145 | } |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore index a91d4407..4db42c27 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/model/logiclanguage.ecore | |||
@@ -55,7 +55,7 @@ | |||
55 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> | 55 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> |
56 | </eClassifiers> | 56 | </eClassifiers> |
57 | <eClassifiers xsi:type="ecore:EClass" name="RealLiteral" eSuperTypes="#//AtomicTerm"> | 57 | <eClassifiers xsi:type="ecore:EClass" name="RealLiteral" eSuperTypes="#//AtomicTerm"> |
58 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBigDecimal"/> | 58 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/> |
59 | </eClassifiers> | 59 | </eClassifiers> |
60 | <eClassifiers xsi:type="ecore:EClass" name="Variable" eSuperTypes="#//SymbolicDeclaration"> | 60 | <eClassifiers xsi:type="ecore:EClass" name="Variable" eSuperTypes="#//SymbolicDeclaration"> |
61 | <eStructuralFeatures xsi:type="ecore:EReference" name="range" lowerBound="1" eType="#//TypeReference" | 61 | <eStructuralFeatures xsi:type="ecore:EReference" name="range" lowerBound="1" eType="#//TypeReference" |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicModelInterpretation.xtend b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicModelInterpretation.xtend index cdcbb48a..b49eb6aa 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicModelInterpretation.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicModelInterpretation.xtend | |||
@@ -85,9 +85,9 @@ interface LogicModelInterpretation { | |||
85 | /** | 85 | /** |
86 | * Returns all real numbers relevant to the logic structure. Not all integer is necessarily used. | 86 | * Returns all real numbers relevant to the logic structure. Not all integer is necessarily used. |
87 | */ | 87 | */ |
88 | def SortedSet<BigDecimal> getAllRealsInStructure() | 88 | def SortedSet<Double> getAllRealsInStructure() |
89 | 89 | ||
90 | def Map<TermDescription, BigDecimal> getAllRealsWithInterpretation() { | 90 | def Map<TermDescription, Double> getAllRealsWithInterpretation() { |
91 | allRealsInStructure.toMap [ real | | 91 | allRealsInStructure.toMap [ real | |
92 | (LogiclanguageFactory.eINSTANCE.createRealLiteral => [value = real]) as TermDescription | 92 | (LogiclanguageFactory.eINSTANCE.createRealLiteral => [value = real]) as TermDescription |
93 | ] | 93 | ] |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicProblemBuilder.xtend b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicProblemBuilder.xtend index fa97cbef..c8ff0b28 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicProblemBuilder.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicProblemBuilder.xtend | |||
@@ -481,9 +481,9 @@ class LogicProblemBuilder{ | |||
481 | def Pow(TermDescription left, TermDescription right) {createPow => [leftOperand = left.toTerm rightOperand = right.toTerm]} | 481 | def Pow(TermDescription left, TermDescription right) {createPow => [leftOperand = left.toTerm rightOperand = right.toTerm]} |
482 | def asTerm(boolean value) { createBoolLiteral => [x|x.value = value] } | 482 | def asTerm(boolean value) { createBoolLiteral => [x|x.value = value] } |
483 | def asTerm(int value) { createIntLiteral => [x|x.value = value] } | 483 | def asTerm(int value) { createIntLiteral => [x|x.value = value] } |
484 | def asTerm(double value) { BigDecimal.valueOf(value).asTerm } | 484 | def asTerm(double value) { createRealLiteral => [x|x.value = value] } |
485 | def asTerm(float value) { BigDecimal.valueOf(value).asTerm } | 485 | def asTerm(float value) { createRealLiteral => [x|x.value = value] } |
486 | def asTerm(BigDecimal value) { createRealLiteral => [x|x.value = value] } | 486 | // def asTerm(BigDecimal value) { createRealLiteral => [x|x.value = value] } |
487 | def asTerm(String value) { createStringLiteral => [x|x.value = value]} | 487 | def asTerm(String value) { createStringLiteral => [x|x.value = value]} |
488 | def InstanceOf(TermDescription term, TypeDescriptor type) { | 488 | def InstanceOf(TermDescription term, TypeDescriptor type) { |
489 | createInstanceOf => [ | 489 | createInstanceOf => [ |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicSolver.xtend b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicSolver.xtend index e62a3cb7..51d315b4 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicSolver.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicSolver.xtend | |||
@@ -96,7 +96,7 @@ public class TypeScopes { | |||
96 | public var minNewIntegers = 0 | 96 | public var minNewIntegers = 0 |
97 | public var maxNewIntegers = Unlimited | 97 | public var maxNewIntegers = Unlimited |
98 | 98 | ||
99 | public var SortedSet<BigDecimal> knownReals = new TreeSet | 99 | public var SortedSet<Double> knownReals = new TreeSet |
100 | /** | 100 | /** |
101 | * Sets the number of Reals that has to be used to solve the problem. | 101 | * Sets the number of Reals that has to be used to solve the problem. |
102 | */ | 102 | */ |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicStructureBuilder.xtend b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicStructureBuilder.xtend index 7ca67d83..507e4bfd 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicStructureBuilder.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic.model/src/hu/bme/mit/inf/dslreasoner/logic/model/builder/LogicStructureBuilder.xtend | |||
@@ -146,7 +146,7 @@ class LogicStructureBuilder{ | |||
146 | } | 146 | } |
147 | 147 | ||
148 | def protected dispatch Term toTerm(Integer o) { createIntLiteral=>[value = o] } | 148 | def protected dispatch Term toTerm(Integer o) { createIntLiteral=>[value = o] } |
149 | def protected dispatch Term toTerm(BigDecimal o) { createRealLiteral=>[value = o]} | 149 | def protected dispatch Term toTerm(Double o) { createRealLiteral=>[value = o]} |
150 | def protected dispatch Term toTerm(Boolean o) { createBoolLiteral=>[value = o]} | 150 | def protected dispatch Term toTerm(Boolean o) { createBoolLiteral=>[value = o]} |
151 | def protected dispatch Term toTerm(SymbolicDeclaration o) { createSymbolicValue=>[symbolicReference = o]} | 151 | def protected dispatch Term toTerm(SymbolicDeclaration o) { createSymbolicValue=>[symbolicReference = o]} |
152 | def public Term termDescriptiontoTerm(TermDescription term) { | 152 | def public Term termDescriptiontoTerm(TermDescription term) { |
@@ -171,7 +171,7 @@ class LogicStructureBuilder{ | |||
171 | // Atomic resoulutions | 171 | // Atomic resoulutions |
172 | def protected dispatch Object resolve(IntLiteral literal, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { return literal.value as Integer } | 172 | def protected dispatch Object resolve(IntLiteral literal, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { return literal.value as Integer } |
173 | def protected dispatch Object resolve(BoolLiteral literal, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { return literal.value } | 173 | def protected dispatch Object resolve(BoolLiteral literal, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { return literal.value } |
174 | def protected dispatch Object resolve(RealLiteral literal, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { return literal.value as BigDecimal } | 174 | def protected dispatch Object resolve(RealLiteral literal, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { return literal.value as Double } |
175 | def protected dispatch Object resolve(StringLiteral literal, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { return literal.value } | 175 | def protected dispatch Object resolve(StringLiteral literal, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { return literal.value } |
176 | 176 | ||
177 | def protected dispatch Object resolve(Not not, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { | 177 | def protected dispatch Object resolve(Not not, LogicModelInterpretation interpretation, Map<Variable,Object> variableBinding) { |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.logic2ecore/src/hu/bme/mit/inf/dslreasoner/logic2ecore/Logic2Ecore.xtend b/Framework/hu.bme.mit.inf.dslreasoner.logic2ecore/src/hu/bme/mit/inf/dslreasoner/logic2ecore/Logic2Ecore.xtend index 8d6b565a..3a74963f 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.logic2ecore/src/hu/bme/mit/inf/dslreasoner/logic2ecore/Logic2Ecore.xtend +++ b/Framework/hu.bme.mit.inf.dslreasoner.logic2ecore/src/hu/bme/mit/inf/dslreasoner/logic2ecore/Logic2Ecore.xtend | |||
@@ -109,13 +109,14 @@ class Logic2Ecore { | |||
109 | } | 109 | } |
110 | 110 | ||
111 | def translateType(EDataType type, Object value) { | 111 | def translateType(EDataType type, Object value) { |
112 | if(type == EcorePackage.eINSTANCE.EFloat) { | 112 | // if(type == EcorePackage.eINSTANCE.EFloat) { |
113 | val bd = value as BigDecimal | 113 | // val bd = value as BigDecimal |
114 | return bd.floatValue | 114 | // return bd.floatValue |
115 | } else if( type == EcorePackage.eINSTANCE.EDouble ) { | 115 | // } else if( type == EcorePackage.eINSTANCE.EDouble ) { |
116 | val bd = value as BigDecimal | 116 | // val bd = value as BigDecimal |
117 | return bd.doubleValue | 117 | // return bd.doubleValue |
118 | } else return value | 118 | // } else |
119 | return value | ||
119 | } | 120 | } |
120 | 121 | ||
121 | protected dispatch def Map<? extends TermDescription, ? extends Object> getAllElementsOfDatatype(EEnum type, Ecore2Logic_Trace forwardTrace, LogicModelInterpretation interpretation) { | 122 | protected dispatch def Map<? extends TermDescription, ? extends Object> getAllElementsOfDatatype(EEnum type, Ecore2Logic_Trace forwardTrace, LogicModelInterpretation interpretation) { |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java index 55d52031..f410cc6d 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericDrealProblemSolver.java | |||
@@ -171,7 +171,8 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
171 | if (isInt) { | 171 | if (isInt) { |
172 | expr = Integer.toString(((IntegerElement) matchedObj).getValue()); | 172 | expr = Integer.toString(((IntegerElement) matchedObj).getValue()); |
173 | } else { | 173 | } else { |
174 | expr = Double.toString(((RealElement) matchedObj).getValue().doubleValue()); | 174 | expr = Double.toString(((RealElement) matchedObj).getValue()); |
175 | // expr = Double.toString(((RealElement) matchedObj).getValue().doubleValue()); | ||
175 | } | 176 | } |
176 | varMap.put(matchedObj, expr); | 177 | varMap.put(matchedObj, expr); |
177 | } | 178 | } |
@@ -301,7 +302,7 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
301 | 302 | ||
302 | private Map<String, String> parseDrealOutput(List<String> output) { | 303 | private Map<String, String> parseDrealOutput(List<String> output) { |
303 | Map<String, String> res = new HashMap<String, String>(); | 304 | Map<String, String> res = new HashMap<String, String>(); |
304 | String re = "(\\w+) : \\[([0-9\\-.e]+), ([0-9\\-.e]+)\\]"; | 305 | String re = "(\\w+) : \\[([0-9\\-+.e]+), ([0-9\\-+.e]+)\\]"; |
305 | Pattern p = Pattern.compile(re); | 306 | Pattern p = Pattern.compile(re); |
306 | for (String varVal : output) { | 307 | for (String varVal : output) { |
307 | Matcher m = p.matcher(varVal); | 308 | Matcher m = p.matcher(varVal); |
@@ -350,7 +351,7 @@ public class NumericDrealProblemSolver extends NumericProblemSolver{ | |||
350 | } else { | 351 | } else { |
351 | String varName = varMap.get(obj); | 352 | String varName = varMap.get(obj); |
352 | String value = solMap.get(varName); | 353 | String value = solMap.get(varName); |
353 | sol.put(obj, Integer.parseInt(value)); | 354 | sol.put(obj, Double.parseDouble(value)); |
354 | } | 355 | } |
355 | 356 | ||
356 | } else { | 357 | } else { |
diff --git a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericZ3ProblemSolver.java b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericZ3ProblemSolver.java index ab7f6ddc..db33804e 100644 --- a/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericZ3ProblemSolver.java +++ b/Framework/hu.bme.mit.inf.dslreasoner.viatra2logic/src/hu/bme/mit/inf/dslreasoner/viatra2logic/NumericZ3ProblemSolver.java | |||
@@ -174,7 +174,7 @@ public class NumericZ3ProblemSolver extends NumericProblemSolver{ | |||
174 | int value = ((IntegerElement) matchedObj).getValue(); | 174 | int value = ((IntegerElement) matchedObj).getValue(); |
175 | expr = (ArithExpr) ctx.mkInt(value); | 175 | expr = (ArithExpr) ctx.mkInt(value); |
176 | } else { | 176 | } else { |
177 | double value = ((RealElement) matchedObj).getValue().doubleValue(); | 177 | double value = ((RealElement) matchedObj).getValue(); |
178 | expr = (ArithExpr) ctx.mkReal(String.valueOf(value)); | 178 | expr = (ArithExpr) ctx.mkReal(String.valueOf(value)); |
179 | } | 179 | } |
180 | varMap.put(matchedObj, expr); | 180 | varMap.put(matchedObj, expr); |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/RealElement.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/RealElement.java index 65b40808..c30314d5 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/RealElement.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/RealElement.java | |||
@@ -2,8 +2,6 @@ | |||
2 | */ | 2 | */ |
3 | package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation; | 3 | package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation; |
4 | 4 | ||
5 | import java.math.BigDecimal; | ||
6 | |||
7 | /** | 5 | /** |
8 | * <!-- begin-user-doc --> | 6 | * <!-- begin-user-doc --> |
9 | * A representation of the model object '<em><b>Real Element</b></em>'. | 7 | * A representation of the model object '<em><b>Real Element</b></em>'. |
@@ -30,12 +28,12 @@ public interface RealElement extends PrimitiveElement { | |||
30 | * </p> | 28 | * </p> |
31 | * <!-- end-user-doc --> | 29 | * <!-- end-user-doc --> |
32 | * @return the value of the '<em>Value</em>' attribute. | 30 | * @return the value of the '<em>Value</em>' attribute. |
33 | * @see #setValue(BigDecimal) | 31 | * @see #setValue(double) |
34 | * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage#getRealElement_Value() | 32 | * @see hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage#getRealElement_Value() |
35 | * @model required="true" | 33 | * @model required="true" |
36 | * @generated | 34 | * @generated |
37 | */ | 35 | */ |
38 | BigDecimal getValue(); | 36 | double getValue(); |
39 | 37 | ||
40 | /** | 38 | /** |
41 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement#getValue <em>Value</em>}' attribute. | 39 | * Sets the value of the '{@link hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement#getValue <em>Value</em>}' attribute. |
@@ -45,6 +43,6 @@ public interface RealElement extends PrimitiveElement { | |||
45 | * @see #getValue() | 43 | * @see #getValue() |
46 | * @generated | 44 | * @generated |
47 | */ | 45 | */ |
48 | void setValue(BigDecimal value); | 46 | void setValue(double value); |
49 | 47 | ||
50 | } // RealElement | 48 | } // RealElement |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java index 1ea3a11d..cb97c5ad 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/PartialinterpretationPackageImpl.java | |||
@@ -1069,7 +1069,7 @@ public class PartialinterpretationPackageImpl extends EPackageImpl implements Pa | |||
1069 | initEAttribute(getIntegerElement_Value(), ecorePackage.getEInt(), "value", null, 1, 1, IntegerElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | 1069 | initEAttribute(getIntegerElement_Value(), ecorePackage.getEInt(), "value", null, 1, 1, IntegerElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
1070 | 1070 | ||
1071 | initEClass(realElementEClass, RealElement.class, "RealElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | 1071 | initEClass(realElementEClass, RealElement.class, "RealElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
1072 | initEAttribute(getRealElement_Value(), ecorePackage.getEBigDecimal(), "value", null, 1, 1, RealElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | 1072 | initEAttribute(getRealElement_Value(), ecorePackage.getEDouble(), "value", null, 1, 1, RealElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
1073 | 1073 | ||
1074 | initEClass(stringElementEClass, StringElement.class, "StringElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); | 1074 | initEClass(stringElementEClass, StringElement.class, "StringElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
1075 | initEAttribute(getStringElement_Value(), ecorePackage.getEString(), "value", null, 1, 1, StringElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); | 1075 | initEAttribute(getStringElement_Value(), ecorePackage.getEString(), "value", null, 1, 1, StringElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java index 67cff5a2..d1ff754f 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/ecore-gen/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/partialinterpretation/impl/RealElementImpl.java | |||
@@ -4,9 +4,6 @@ package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.pa | |||
4 | 4 | ||
5 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage; | 5 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationPackage; |
6 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement; | 6 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RealElement; |
7 | |||
8 | import java.math.BigDecimal; | ||
9 | |||
10 | import org.eclipse.emf.common.notify.Notification; | 7 | import org.eclipse.emf.common.notify.Notification; |
11 | 8 | ||
12 | import org.eclipse.emf.ecore.EClass; | 9 | import org.eclipse.emf.ecore.EClass; |
@@ -35,7 +32,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement | |||
35 | * @generated | 32 | * @generated |
36 | * @ordered | 33 | * @ordered |
37 | */ | 34 | */ |
38 | protected static final BigDecimal VALUE_EDEFAULT = null; | 35 | protected static final double VALUE_EDEFAULT = 0.0; |
39 | 36 | ||
40 | /** | 37 | /** |
41 | * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. | 38 | * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. |
@@ -45,7 +42,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement | |||
45 | * @generated | 42 | * @generated |
46 | * @ordered | 43 | * @ordered |
47 | */ | 44 | */ |
48 | protected BigDecimal value = VALUE_EDEFAULT; | 45 | protected double value = VALUE_EDEFAULT; |
49 | 46 | ||
50 | /** | 47 | /** |
51 | * <!-- begin-user-doc --> | 48 | * <!-- begin-user-doc --> |
@@ -72,7 +69,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement | |||
72 | * @generated | 69 | * @generated |
73 | */ | 70 | */ |
74 | @Override | 71 | @Override |
75 | public BigDecimal getValue() { | 72 | public double getValue() { |
76 | return value; | 73 | return value; |
77 | } | 74 | } |
78 | 75 | ||
@@ -82,8 +79,8 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement | |||
82 | * @generated | 79 | * @generated |
83 | */ | 80 | */ |
84 | @Override | 81 | @Override |
85 | public void setValue(BigDecimal newValue) { | 82 | public void setValue(double newValue) { |
86 | BigDecimal oldValue = value; | 83 | double oldValue = value; |
87 | value = newValue; | 84 | value = newValue; |
88 | if (eNotificationRequired()) | 85 | if (eNotificationRequired()) |
89 | eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.REAL_ELEMENT__VALUE, oldValue, value)); | 86 | eNotify(new ENotificationImpl(this, Notification.SET, PartialinterpretationPackage.REAL_ELEMENT__VALUE, oldValue, value)); |
@@ -112,7 +109,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement | |||
112 | public void eSet(int featureID, Object newValue) { | 109 | public void eSet(int featureID, Object newValue) { |
113 | switch (featureID) { | 110 | switch (featureID) { |
114 | case PartialinterpretationPackage.REAL_ELEMENT__VALUE: | 111 | case PartialinterpretationPackage.REAL_ELEMENT__VALUE: |
115 | setValue((BigDecimal)newValue); | 112 | setValue((Double)newValue); |
116 | return; | 113 | return; |
117 | } | 114 | } |
118 | super.eSet(featureID, newValue); | 115 | super.eSet(featureID, newValue); |
@@ -142,7 +139,7 @@ public class RealElementImpl extends PrimitiveElementImpl implements RealElement | |||
142 | public boolean eIsSet(int featureID) { | 139 | public boolean eIsSet(int featureID) { |
143 | switch (featureID) { | 140 | switch (featureID) { |
144 | case PartialinterpretationPackage.REAL_ELEMENT__VALUE: | 141 | case PartialinterpretationPackage.REAL_ELEMENT__VALUE: |
145 | return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); | 142 | return value != VALUE_EDEFAULT; |
146 | } | 143 | } |
147 | return super.eIsSet(featureID); | 144 | return super.eIsSet(featureID); |
148 | } | 145 | } |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore index 47d54258..b2398acd 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/model/PartialInterpretation.ecore | |||
@@ -83,7 +83,7 @@ | |||
83 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> | 83 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> |
84 | </eClassifiers> | 84 | </eClassifiers> |
85 | <eClassifiers xsi:type="ecore:EClass" name="RealElement" eSuperTypes="#//PrimitiveElement"> | 85 | <eClassifiers xsi:type="ecore:EClass" name="RealElement" eSuperTypes="#//PrimitiveElement"> |
86 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBigDecimal"/> | 86 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/> |
87 | </eClassifiers> | 87 | </eClassifiers> |
88 | <eClassifiers xsi:type="ecore:EClass" name="StringElement" eSuperTypes="#//PrimitiveElement"> | 88 | <eClassifiers xsi:type="ecore:EClass" name="StringElement" eSuperTypes="#//PrimitiveElement"> |
89 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> | 89 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend index cb5b587f..94959025 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretation2logic/InstanceModel2PartialInterpretation.xtend | |||
@@ -13,7 +13,6 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Par | |||
13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Problem2PartialInterpretationTrace | 13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.Problem2PartialInterpretationTrace |
14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation | 14 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialRelationInterpretation |
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory | 15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialinterpretationFactory |
16 | import java.math.BigDecimal | ||
17 | import java.util.HashMap | 16 | import java.util.HashMap |
18 | import java.util.HashSet | 17 | import java.util.HashSet |
19 | import java.util.List | 18 | import java.util.List |
@@ -148,7 +147,7 @@ class InstanceModel2PartialInterpretation { | |||
148 | 147 | ||
149 | private def createTypeScopesFromKnownAttributeValues(List<EObject> objects, Set<EAttribute> attributesUsed) { | 148 | private def createTypeScopesFromKnownAttributeValues(List<EObject> objects, Set<EAttribute> attributesUsed) { |
150 | val Set<Integer> integers = new HashSet | 149 | val Set<Integer> integers = new HashSet |
151 | val Set<BigDecimal> reals = new HashSet | 150 | val Set<Double> reals = new HashSet |
152 | val Set<String> strings = new HashSet | 151 | val Set<String> strings = new HashSet |
153 | for(object: objects) { | 152 | for(object: objects) { |
154 | for(attribute : object.eClass.EAllAttributes.filter[attributesUsed.contains(it)]) { | 153 | for(attribute : object.eClass.EAllAttributes.filter[attributesUsed.contains(it)]) { |
@@ -170,28 +169,28 @@ class InstanceModel2PartialInterpretation { | |||
170 | it.knownStrings += strings | 169 | it.knownStrings += strings |
171 | ] | 170 | ] |
172 | } | 171 | } |
173 | private def dispatch shortValue(Boolean value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 172 | private def dispatch shortValue(Boolean value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
174 | // Do nothing | 173 | // Do nothing |
175 | } | 174 | } |
176 | private def dispatch shortValue(Integer value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 175 | private def dispatch shortValue(Integer value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
177 | integers += value | 176 | integers += value |
178 | } | 177 | } |
179 | private def dispatch shortValue(Short value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 178 | private def dispatch shortValue(Short value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
180 | integers += Integer.valueOf(value) | 179 | integers += Integer.valueOf(value) |
181 | } | 180 | } |
182 | private def dispatch shortValue(Float value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 181 | private def dispatch shortValue(Float value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
183 | reals += BigDecimal.valueOf(value) | 182 | reals += Double.valueOf(value) |
184 | } | 183 | } |
185 | private def dispatch shortValue(Double value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 184 | private def dispatch shortValue(Double value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
186 | reals += BigDecimal.valueOf(value) | 185 | reals += value |
187 | } | 186 | } |
188 | private def dispatch shortValue(String value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 187 | private def dispatch shortValue(String value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
189 | strings += value | 188 | strings += value |
190 | } | 189 | } |
191 | private def dispatch shortValue(Void value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 190 | private def dispatch shortValue(Void value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
192 | // Do nothing | 191 | // Do nothing |
193 | } | 192 | } |
194 | private def dispatch shortValue(Object value, Set<Integer> integers, Set<BigDecimal> reals, Set<String> strings) { | 193 | private def dispatch shortValue(Object value, Set<Integer> integers, Set<Double> reals, Set<String> strings) { |
195 | // Do nothing | 194 | // Do nothing |
196 | } | 195 | } |
197 | 196 | ||
@@ -220,11 +219,11 @@ class InstanceModel2PartialInterpretation { | |||
220 | } | 219 | } |
221 | 220 | ||
222 | dispatch protected def translateValue(Double value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { | 221 | dispatch protected def translateValue(Double value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { |
223 | BigDecimal.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap) | 222 | value.lookup(partialInterpretationTrace.primitiveValues.realMap) |
224 | } | 223 | } |
225 | 224 | ||
226 | dispatch protected def translateValue(Float value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { | 225 | dispatch protected def translateValue(Float value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { |
227 | BigDecimal.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap) | 226 | Double.valueOf(value).lookup(partialInterpretationTrace.primitiveValues.realMap) |
228 | } | 227 | } |
229 | 228 | ||
230 | dispatch protected def translateValue(String value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { | 229 | dispatch protected def translateValue(String value, Ecore2Logic_Trace ecore2LogicTrace, Problem2PartialInterpretationTrace partialInterpretationTrace) { |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend index 20ff58f2..92db5c18 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend | |||
@@ -52,7 +52,7 @@ import static extension hu.bme.mit.inf.dslreasoner.util.CollectionsUtil.* | |||
52 | PartialIntegerInterpretation integerInterpretation | 52 | PartialIntegerInterpretation integerInterpretation |
53 | Map<Integer,IntegerElement> integerMap | 53 | Map<Integer,IntegerElement> integerMap |
54 | PartialRealInterpretation realInterpretation | 54 | PartialRealInterpretation realInterpretation |
55 | Map<BigDecimal,RealElement> realMap | 55 | Map<Double,RealElement> realMap |
56 | PartialStringInterpretation stringInterpretation | 56 | PartialStringInterpretation stringInterpretation |
57 | Map<String,StringElement> stringMap | 57 | Map<String,StringElement> stringMap |
58 | } | 58 | } |
@@ -146,7 +146,7 @@ class PartialInterpretationInitialiser { | |||
146 | return integerInterpretation | 146 | return integerInterpretation |
147 | } | 147 | } |
148 | 148 | ||
149 | def protected initReals(PartialInterpretation partialInterpretation, SortedSet<BigDecimal> knownReals, int minNewReals, int maxNewReals) { | 149 | def protected initReals(PartialInterpretation partialInterpretation, SortedSet<Double> knownReals, int minNewReals, int maxNewReals) { |
150 | val realInterpretation = createPartialRealInterpretation | 150 | val realInterpretation = createPartialRealInterpretation |
151 | partialInterpretation.partialtypeinterpratation += realInterpretation | 151 | partialInterpretation.partialtypeinterpratation += realInterpretation |
152 | 152 | ||
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) { |