diff options
author | 2019-05-13 12:56:12 -0400 | |
---|---|---|
committer | 2019-05-13 12:56:12 -0400 | |
commit | 29ab244acc25d2c34f636cf40a48df8347aafbd1 (patch) | |
tree | a8658c575e6c74aca9330bf7bb2886c7230212f2 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage | |
parent | fixed manifest (diff) | |
download | VIATRA-Generator-29ab244acc25d2c34f636cf40a48df8347aafbd1.tar.gz VIATRA-Generator-29ab244acc25d2c34f636cf40a48df8347aafbd1.tar.zst VIATRA-Generator-29ab244acc25d2c34f636cf40a48df8347aafbd1.zip |
Fix for symmetric activation codes on symmetric models
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage')
1 files changed, 10 insertions, 1 deletions
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 65a8207e..b6d2043d 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 | |||
@@ -128,14 +128,23 @@ class NeighbourhoodBasedPartialInterpretationStateCoder implements IStateCoder{ | |||
128 | val size = match.specification.parameters.size | 128 | val size = match.specification.parameters.size |
129 | val res = new ArrayList(size) | 129 | val res = new ArrayList(size) |
130 | var int index = 0 | 130 | var int index = 0 |
131 | var int equivalenceHash = 0 | ||
132 | val prime = 31 | ||
133 | |||
131 | while(index < size) { | 134 | while(index < size) { |
132 | res.add(getCode(match.get(index))) | 135 | res.add(getCode(match.get(index))) |
133 | index++ | 136 | index++ |
137 | for(var i = 0; i<index; i++) { | ||
138 | val number = if(match.get(index) === match.get(i)){1}else{0} | ||
139 | equivalenceHash = prime * equivalenceHash + number | ||
140 | } | ||
134 | } | 141 | } |
142 | |||
135 | statecoderRuntime += (System.nanoTime - startTime) | 143 | statecoderRuntime += (System.nanoTime - startTime) |
136 | return match.specification.fullyQualifiedName->res.hashCode | 144 | return match.specification.fullyQualifiedName->(res->equivalenceHash).hashCode |
137 | } | 145 | } |
138 | 146 | ||
147 | |||
139 | def private getCode(Object o) { | 148 | def private getCode(Object o) { |
140 | if(o instanceof DefinedElement) { | 149 | if(o instanceof DefinedElement) { |
141 | this.nodeRepresentations.get(o) | 150 | this.nodeRepresentations.get(o) |