Skip to content

Commit 6b14e18

Browse files
committed
adjust to AutomataLib refactorings
1 parent e87d8ff commit 6b14e18

3 files changed

Lines changed: 23 additions & 12 deletions

File tree

‎algorithms/active/adt/src/main/java/de/learnlib/algorithm/adt/model/ObservationTree.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import net.automatalib.alphabet.SupportsGrowingAlphabet;
3131
import net.automatalib.automaton.transducer.MealyMachine;
3232
import net.automatalib.common.util.Pair;
33-
import net.automatalib.util.automaton.equivalence.NearLinearEquivalenceTest;
33+
import net.automatalib.util.automaton.equivalence.DeterministicEquivalenceTest;
3434
import net.automatalib.word.Word;
3535
import org.checkerframework.checker.nullness.qual.Nullable;
3636

@@ -190,7 +190,7 @@ public void addState(S newState, Word<I> accessSequence, O output) {
190190
final Integer s2Succ = cache.getSuccessor(n2, prefix);
191191

192192
if (s1Succ != null && s2Succ != null) {
193-
return NearLinearEquivalenceTest.findSeparatingWord(cache, s1Succ, s2Succ, alphabet, true);
193+
return DeterministicEquivalenceTest.findSeparatingWord(cache, s1Succ, s2Succ, alphabet, true);
194194
}
195195

196196
return null;
@@ -211,7 +211,7 @@ public void addState(S newState, Word<I> accessSequence, O output) {
211211
final Integer n1 = this.nodeToObservationMap.get(s1);
212212
final Integer n2 = this.nodeToObservationMap.get(s2);
213213

214-
return NearLinearEquivalenceTest.findSeparatingWord(this.cache.getCache(), n1, n2, this.alphabet, true);
214+
return DeterministicEquivalenceTest.findSeparatingWord(this.cache.getCache(), n1, n2, this.alphabet, true);
215215
}
216216

217217
/**

‎filters/cache/src/main/java/de/learnlib/filter/cache/mealy/AdaptiveQueryCache.java‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@
3636
import net.automatalib.automaton.impl.CompactTransition;
3737
import net.automatalib.automaton.transducer.MealyMachine;
3838
import net.automatalib.automaton.transducer.impl.CompactMealy;
39-
import net.automatalib.util.automaton.equivalence.NearLinearEquivalenceTest;
39+
import net.automatalib.incremental.util.DFSepWordFinder;
40+
import net.automatalib.incremental.util.DFSepWordFinder.Visitor;
4041
import net.automatalib.word.Word;
4142
import net.automatalib.word.WordBuilder;
4243
import org.checkerframework.checker.nullness.qual.NonNull;
44+
import org.checkerframework.checker.nullness.qual.Nullable;
4345

4446
/**
4547
* A cache for an {@link AdaptiveMembershipOracle}. Upon construction, it is provided with a delegate oracle. Queries
@@ -135,16 +137,25 @@ public void processQueries(Collection<? extends AdaptiveQuery<I, O>> queries) {
135137

136138
@Override
137139
public EquivalenceOracle<MealyMachine<?, I, ?, O>, I, Word<O>> createCacheConsistencyTest() {
138-
return (hypothesis, alphabet) -> {
139-
//TODO: If the hypothesis has undefined transitions, but the cache doesn't, it is a clear counterexample!
140-
final Word<I> sepWord = NearLinearEquivalenceTest.findSeparatingWord(cache, hypothesis, alphabet, true);
140+
return this::findCounterexample;
141+
}
142+
143+
private <S, T> @Nullable DefaultQuery<I, Word<O>> findCounterexample(MealyMachine<S, I, T, O> hypothesis,
144+
Collection<? extends I> inputs) {
145+
final Word<I> sepWord = DFSepWordFinder.findSeparatingWord(cache, hypothesis, inputs, false, new Visitor<>() {
141146

142-
if (sepWord != null) {
143-
return new DefaultQuery<>(sepWord, cache.computeOutput(sepWord));
147+
@Override
148+
public boolean succConflict(CompactTransition<O> incTrans, @Nullable T targetTrans) {
149+
return targetTrans == null ||
150+
!Objects.equals(incTrans.getProperty(), hypothesis.getTransitionOutput(targetTrans));
144151
}
152+
});
153+
154+
if (sepWord != null) {
155+
return new DefaultQuery<>(sepWord, cache.computeOutput(sepWord));
156+
}
145157

146-
return null;
147-
};
158+
return null;
148159
}
149160

150161
@Override

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ limitations under the License.
271271
<tidy-pom.version>1.4.0</tidy-pom.version>
272272

273273
<!-- dependency versions -->
274-
<automatalib.version>13.0.0</automatalib.version>
274+
<automatalib.version>14.0.0-SNAPSHOT</automatalib.version>
275275
<build-tools.version>0.1.1</build-tools.version>
276276
<cacio.version>1.18</cacio.version>
277277
<checkerframework.version>4.2.1</checkerframework.version>

0 commit comments

Comments
 (0)