diff options
author | 2018-08-28 14:21:57 +0200 | |
---|---|---|
committer | 2018-08-28 14:21:57 +0200 | |
commit | 7b5bc7ef4c842b1f365b53b526e78083bb85a9c3 (patch) | |
tree | 41647dabc7ebe7e1e42fefcf964b665b312ce787 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend | |
parent | Fix SolutionStoreWithDiversityDescriptor (diff) | |
download | VIATRA-Generator-7b5bc7ef4c842b1f365b53b526e78083bb85a9c3.tar.gz VIATRA-Generator-7b5bc7ef4c842b1f365b53b526e78083bb85a9c3.tar.zst VIATRA-Generator-7b5bc7ef4c842b1f365b53b526e78083bb85a9c3.zip |
Add patterns to shape
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/neighbourhood/Descriptor.xtend')
1 files changed, 12 insertions, 7 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 2e8f61a9..f9cf2986 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 | |||
@@ -5,6 +5,7 @@ import java.util.Map | |||
5 | import java.util.Set | 5 | import java.util.Set |
6 | import org.eclipse.xtend.lib.annotations.Data | 6 | import org.eclipse.xtend.lib.annotations.Data |
7 | import java.util.List | 7 | import java.util.List |
8 | import java.util.HashSet | ||
8 | 9 | ||
9 | @Data abstract class AbstractNodeDescriptor { | 10 | @Data abstract class AbstractNodeDescriptor { |
10 | long dataHash | 11 | long dataHash |
@@ -25,10 +26,11 @@ import java.util.List | |||
25 | // } | 26 | // } |
26 | } | 27 | } |
27 | 28 | ||
28 | //TODO: Modify for patterns | 29 | |
29 | @Data class LocalNodeDescriptor extends AbstractNodeDescriptor{ | 30 | @Data class LocalNodeDescriptor extends AbstractNodeDescriptor{ |
30 | Set<String> types | 31 | Set<String> types |
31 | String id; | 32 | String id; |
33 | |||
32 | new(String id, Set<String> types) { | 34 | new(String id, Set<String> types) { |
33 | super(calcualteDataHash(id,types)) | 35 | super(calcualteDataHash(id,types)) |
34 | this.types = types | 36 | this.types = types |
@@ -89,8 +91,6 @@ import java.util.List | |||
89 | // } | 91 | // } |
90 | } | 92 | } |
91 | 93 | ||
92 | //TODO: PatternRelation | ||
93 | |||
94 | @Data class PatternRelation<NODESHAPE> { | 94 | @Data class PatternRelation<NODESHAPE> { |
95 | String patternName | 95 | String patternName |
96 | int param | 96 | int param |
@@ -107,28 +107,31 @@ import java.util.List | |||
107 | String type | 107 | String type |
108 | } | 108 | } |
109 | 109 | ||
110 | //TODO: Modify for hypergraphs | ||
111 | @Data class FurtherNodeDescriptor<NodeRep> extends AbstractNodeDescriptor{ | 110 | @Data class FurtherNodeDescriptor<NodeRep> extends AbstractNodeDescriptor{ |
112 | 111 | ||
113 | NodeRep previousRepresentation | 112 | NodeRep previousRepresentation |
114 | Map<IncomingRelation<NodeRep>,Integer> incomingEdges | 113 | Map<IncomingRelation<NodeRep>,Integer> incomingEdges |
115 | Map<OutgoingRelation<NodeRep>,Integer> outgoingEdges | 114 | Map<OutgoingRelation<NodeRep>,Integer> outgoingEdges |
115 | Set<PatternRelation<NodeRep>> patterns | ||
116 | 116 | ||
117 | new( | 117 | new( |
118 | NodeRep previousRepresentation, | 118 | NodeRep previousRepresentation, |
119 | Map<IncomingRelation<NodeRep>,Integer> incomingEdges, | 119 | Map<IncomingRelation<NodeRep>,Integer> incomingEdges, |
120 | Map<OutgoingRelation<NodeRep>,Integer> outgoingEdges) | 120 | Map<OutgoingRelation<NodeRep>,Integer> outgoingEdges, |
121 | Set<PatternRelation<NodeRep>> patterns) | ||
121 | { | 122 | { |
122 | super(calculateDataHash(previousRepresentation,incomingEdges,outgoingEdges)) | 123 | super(calculateDataHash(previousRepresentation,incomingEdges,outgoingEdges,patterns)) |
123 | this.previousRepresentation = previousRepresentation | 124 | this.previousRepresentation = previousRepresentation |
124 | this.incomingEdges = new HashMap(incomingEdges) | 125 | this.incomingEdges = new HashMap(incomingEdges) |
125 | this.outgoingEdges = new HashMap(outgoingEdges) | 126 | this.outgoingEdges = new HashMap(outgoingEdges) |
127 | this.patterns=new HashSet(patterns) | ||
126 | } | 128 | } |
127 | 129 | ||
128 | static def private <NodeRep> int calculateDataHash( | 130 | static def private <NodeRep> int calculateDataHash( |
129 | NodeRep previousRepresentation, | 131 | NodeRep previousRepresentation, |
130 | Map<IncomingRelation<NodeRep>,Integer> incomingEdges, | 132 | Map<IncomingRelation<NodeRep>,Integer> incomingEdges, |
131 | Map<OutgoingRelation<NodeRep>,Integer> outgoingEdges) | 133 | Map<OutgoingRelation<NodeRep>,Integer> outgoingEdges, |
134 | Set<PatternRelation<NodeRep>> patterns) | ||
132 | { | 135 | { |
133 | val int prime = 31; | 136 | val int prime = 31; |
134 | var int result = previousRepresentation.hashCode; | 137 | var int result = previousRepresentation.hashCode; |
@@ -136,6 +139,8 @@ import java.util.List | |||
136 | result = prime * result + incomingEdges.hashCode(); | 139 | result = prime * result + incomingEdges.hashCode(); |
137 | if(outgoingEdges !== null) | 140 | if(outgoingEdges !== null) |
138 | result = prime * result + outgoingEdges.hashCode(); | 141 | result = prime * result + outgoingEdges.hashCode(); |
142 | if (patterns !== null) | ||
143 | result = prime * result + patterns.hashCode(); | ||
139 | return result; | 144 | return result; |
140 | } | 145 | } |
141 | 146 | ||