aboutsummaryrefslogtreecommitdiffstats
path: root/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner
diff options
context:
space:
mode:
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner')
-rw-r--r--Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend8
-rw-r--r--Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/NeighbourhoodOptions.xtend4
-rw-r--r--Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2Hash.xtend2
-rw-r--r--Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend4
-rw-r--r--Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/statecoder/NeighbourhoodBasedStateCoderFactory.xtend29
5 files changed, 34 insertions, 13 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend
index c7c1ad77..e4bdb086 100644
--- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend
+++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend
@@ -60,6 +60,10 @@ import org.eclipse.xtend2.lib.StringConcatenationClient
60 return this.dataHash.hashCode 60 return this.dataHash.hashCode
61 } 61 }
62 62
63 override equals(Object other) {
64 other.class == LocalNodeDescriptor && (other as AbstractNodeDescriptor).hashCode == hashCode
65 }
66
63 override protected prettyPrint() { 67 override protected prettyPrint() {
64 '''(«dataHash»)[«IF id !== null»id = "«id»"«IF types === null || !types.empty», «ENDIF»«ENDIF»«IF types === null»TYPES = null«ELSE»«FOR type : types SEPARATOR ", "»«type»«ENDFOR»«ENDIF»]''' 68 '''(«dataHash»)[«IF id !== null»id = "«id»"«IF types === null || !types.empty», «ENDIF»«ENDIF»«IF types === null»TYPES = null«ELSE»«FOR type : types SEPARATOR ", "»«type»«ENDFOR»«ENDIF»]'''
65 } 69 }
@@ -143,6 +147,10 @@ import org.eclipse.xtend2.lib.StringConcatenationClient
143 return this.dataHash.hashCode 147 return this.dataHash.hashCode
144 } 148 }
145 149
150 override equals(Object other) {
151 other.class == FurtherNodeDescriptor && (other as AbstractNodeDescriptor).hashCode == hashCode
152 }
153
146 override prettyPrint() { 154 override prettyPrint() {
147 ''' 155 '''
148 («dataHash»)[ 156 («dataHash»)[
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/NeighbourhoodOptions.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/NeighbourhoodOptions.xtend
index efc89803..c6e03f75 100644
--- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/NeighbourhoodOptions.xtend
+++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/NeighbourhoodOptions.xtend
@@ -7,12 +7,12 @@ import org.eclipse.xtend.lib.annotations.Data
7 7
8@Data 8@Data
9class NeighbourhoodOptions { 9class NeighbourhoodOptions {
10 public static val FixPointRage = -1 10 public static val FixPointRange = -1
11 public static val GraphWidthRange = -2 11 public static val GraphWidthRange = -2
12 public static val FullParallels = Integer.MAX_VALUE 12 public static val FullParallels = Integer.MAX_VALUE
13 public static val MaxNumbers = Integer.MAX_VALUE 13 public static val MaxNumbers = Integer.MAX_VALUE
14 14
15 public static val DEFAULT = new NeighbourhoodOptions(GraphWidthRange, FullParallels, MaxNumbers, null, null) 15 public static val DEFAULT = new NeighbourhoodOptions(FixPointRange, FullParallels, MaxNumbers, null, null)
16 16
17 val int range 17 val int range
18 val int parallels 18 val int parallels
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2Hash.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2Hash.xtend
index d474877d..ddf7d712 100644
--- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2Hash.xtend
+++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2Hash.xtend
@@ -5,7 +5,7 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement
5 5
6class PartialInterpretation2Hash extends PartialInterpretation2NeighbourhoodRepresentation<Integer, Integer>{ 6class PartialInterpretation2Hash extends PartialInterpretation2NeighbourhoodRepresentation<Integer, Integer>{
7 7
8 protected new() { 8 new() {
9 super(false, true) 9 super(false, true)
10 } 10 }
11 11
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend
index a0382e8e..3048167e 100644
--- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend
+++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/PartialInterpretation2NeighbourhoodRepresentation.xtend
@@ -25,7 +25,7 @@ abstract class PartialInterpretation2NeighbourhoodRepresentation<ModelRepresenta
25 this.mergeSimilarNeighbourhood = mergeSimilarNeighbourhood 25 this.mergeSimilarNeighbourhood = mergeSimilarNeighbourhood
26 } 26 }
27 27
28 public static val FixPointRage = NeighbourhoodOptions.FixPointRage 28 public static val FixPointRange = NeighbourhoodOptions.FixPointRange
29 public static val GraphWidthRange = NeighbourhoodOptions.GraphWidthRange 29 public static val GraphWidthRange = NeighbourhoodOptions.GraphWidthRange
30 public static val FullParallels = NeighbourhoodOptions.FullParallels 30 public static val FullParallels = NeighbourhoodOptions.FullParallels
31 public static val MaxNumbers = NeighbourhoodOptions.MaxNumbers 31 public static val MaxNumbers = NeighbourhoodOptions.MaxNumbers
@@ -174,7 +174,7 @@ abstract class PartialInterpretation2NeighbourhoodRepresentation<ModelRepresenta
174 throw new IllegalArgumentException('''Need previous representations''') 174 throw new IllegalArgumentException('''Need previous representations''')
175 } else 175 } else
176 return res 176 return res
177 } else if (range == FixPointRage) { 177 } else if (range == FixPointRange) {
178 return refineUntilFixpoint(model, types, IncomingRelations, OutgoingRelations, parallels, maxNumber, 178 return refineUntilFixpoint(model, types, IncomingRelations, OutgoingRelations, parallels, maxNumber,
179 focusedElement) 179 focusedElement)
180 } else if (range == GraphWidthRange) { 180 } else if (range == GraphWidthRange) {
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/statecoder/NeighbourhoodBasedStateCoderFactory.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/statecoder/NeighbourhoodBasedStateCoderFactory.xtend
index 4ff39999..5e442ca7 100644
--- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/statecoder/NeighbourhoodBasedStateCoderFactory.xtend
+++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/statecoder/NeighbourhoodBasedStateCoderFactory.xtend
@@ -1,9 +1,10 @@
1package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder 1package hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.statecoder
2 2
3import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement 3import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement
4import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.AbstractNodeDescriptor
5import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.NeighbourhoodOptions 4import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.NeighbourhoodOptions
5import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.PartialInterpretation2Hash
6import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.PartialInterpretation2ImmutableTypeLattice 6import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.PartialInterpretation2ImmutableTypeLattice
7import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.neighbourhood.PartialInterpretation2NeighbourhoodRepresentation
7import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation 8import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation
8import java.util.ArrayList 9import java.util.ArrayList
9import java.util.Map 10import java.util.Map
@@ -18,21 +19,33 @@ class NeighbourhoodBasedStateCoderFactory extends AbstractNeighbourhoodBasedStat
18 } 19 }
19 20
20 override protected doCreateStateCoder(NeighbourhoodOptions options) { 21 override protected doCreateStateCoder(NeighbourhoodOptions options) {
21 new NeighbourhoodBasedPartialInterpretationStateCoder(options) 22 new NeighbourhoodBasedPartialInterpretationStateCoder(new PartialInterpretation2ImmutableTypeLattice, options)
22 } 23 }
23
24} 24}
25 25
26class NeighbourhoodBasedPartialInterpretationStateCoder extends AbstractNeighbourhoodBasedPartialInterpretationStateCoder { 26class NeighbourhoodBasedHashStateCoderFactory extends AbstractNeighbourhoodBasedStateCoderFactory {
27 val calculator = new PartialInterpretation2ImmutableTypeLattice 27 new() {
28 28 }
29 var Map<DefinedElement, ? extends AbstractNodeDescriptor> nodeRepresentations = null
30 var Map<? extends AbstractNodeDescriptor, Integer> modelRepresentation = null
31 29
32 new(NeighbourhoodOptions options) { 30 new(NeighbourhoodOptions options) {
33 super(options) 31 super(options)
34 } 32 }
35 33
34 override protected doCreateStateCoder(NeighbourhoodOptions options) {
35 new NeighbourhoodBasedPartialInterpretationStateCoder(new PartialInterpretation2Hash, options)
36 }
37}
38
39class NeighbourhoodBasedPartialInterpretationStateCoder<ModelRep, NodeRep> extends AbstractNeighbourhoodBasedPartialInterpretationStateCoder {
40 val PartialInterpretation2NeighbourhoodRepresentation<ModelRep, NodeRep> calculator
41 var Map<DefinedElement, ? extends NodeRep> nodeRepresentations = null
42 var ModelRep modelRepresentation = null
43
44 new(PartialInterpretation2NeighbourhoodRepresentation<ModelRep, NodeRep> calculator, NeighbourhoodOptions options) {
45 super(options)
46 this.calculator = calculator
47 }
48
36 override protected isRefreshNeeded() { 49 override protected isRefreshNeeded() {
37 nodeRepresentations === null || modelRepresentation === null 50 nodeRepresentations === null || modelRepresentation === null
38 } 51 }