Skip to content

Commit

Permalink
oml: cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
mtf90 committed Oct 2, 2024
1 parent a5661e4 commit 4169fe2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.automaton.concept.FiniteRepresentation;
import net.automatalib.automaton.concept.InputAlphabetHolder;
import net.automatalib.automaton.concept.SuffixOutput;
import net.automatalib.word.Word;

abstract class AbstractOptimalLStar<M extends SuffixOutput<I, D>, I, D> implements LearningAlgorithm<M, I, D>,
InputAlphabetHolder<I>,
SupportsGrowingAlphabet<I>,
Resumable<OptimalLStarState<I, D>>,
FiniteRepresentation {

private final Alphabet<I> alphabet;
final Alphabet<I> alphabet;
final MembershipOracle<I, D> mqs;
final MembershipOracle<I, D> ceqs;

Expand Down Expand Up @@ -109,11 +107,6 @@ public boolean refineHypothesis(DefaultQuery<I, D> counterexample) {
return refined;
}

@Override
public Alphabet<I> getInputAlphabet() {
return alphabet;
}

private void initTable() {
Word<I> epsilon = Word.epsilon();
List<D> rowData = initRow(epsilon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ boolean symbolInconsistency(Word<I> u1, Word<I> u2, I a) {

@Override
void automatonFromTable() {
Alphabet<I> alphabet = getInputAlphabet();

this.hypothesis = new CompactDFA<>(alphabet);
this.hypothesis = new CompactDFA<>(super.alphabet);
Map<List<Boolean>, Integer> stateMap = new HashMap<>();
List<Boolean> rowData = getRow(Word.epsilon());
Integer q = this.hypothesis.addInitialState(rowData.get(0));
Expand All @@ -78,7 +76,7 @@ void automatonFromTable() {

hypStateMap.put(state, sig);
Word<I> u = getShortPrefixes(sig).get(0);
for (I a : alphabet) {
for (I a : super.alphabet) {
List<Boolean> dstData = getRow(u.append(a));
assert dstData != null;
Integer dst = stateMap.get(dstData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ boolean symbolInconsistency(Word<I> u1, Word<I> u2, I a) {

@Override
void automatonFromTable() {
Alphabet<I> alphabet = getInputAlphabet();

this.hypothesis = new CompactMealy<>(alphabet);
this.hypothesis = new CompactMealy<>(super.alphabet);
Map<List<Word<O>>, Integer> stateMap = new HashMap<>();
List<Word<O>> rowData = getRow(Word.epsilon());
Integer q = this.hypothesis.addInitialState();
Expand All @@ -104,7 +102,7 @@ void automatonFromTable() {

hypStateMap.put(state, sig);
Word<I> u = getShortPrefixes(sig).get(0);
for (I a : alphabet) {
for (I a : super.alphabet) {
Word<I> ua = u.append(a);
List<Word<O>> destData = getRow(ua);
assert destData != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@
import de.learnlib.util.MQUtil;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.SupportsGrowingAlphabet;
import net.automatalib.automaton.concept.InputAlphabetHolder;
import net.automatalib.automaton.concept.SuffixOutput;
import net.automatalib.word.Word;

public abstract class AbstractOptimalTTT<M extends SuffixOutput<I, D>, I, D>
implements LearningAlgorithm<M, I, D>, SupportsGrowingAlphabet<I>, InputAlphabetHolder<I> {
implements LearningAlgorithm<M, I, D>, SupportsGrowingAlphabet<I> {

private final MembershipOracle<I, D> ceqs;
private final Alphabet<I> alphabet;
Expand Down Expand Up @@ -115,11 +114,6 @@ public void addAlphabetSymbol(I symbol) {
}
}

@Override
public Alphabet<I> getInputAlphabet() {
return this.alphabet;
}

private void makeConsistent() {
while (dtree().makeConsistent()) {
// do nothing ...
Expand Down

0 comments on commit 4169fe2

Please sign in to comment.