-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-integrate the work on procedural systems (#93)
* initial import of SBAs and SPMMs * cleanups / refactorings * refactorings * adjust to Automatalib refactorings * add procedural W-method oracles * make SBA/SPMM learner add non-continuable symbols lazily * make counterexample analysis parameterizable * add adapters for OML and DHC * Only use DHC for testing Since the adapter does not provide any functionality, skip redundant adapter class. * adjust to AutomataLib refactorings * add documentation * add some assertions for convenience * add SBA-based palindrome learning example * cleanup (mostly docs) * cleanups + some more tests
- Loading branch information
Showing
75 changed files
with
4,674 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...thms/active/procedural/src/main/java/de/learnlib/algorithms/procedural/SymbolWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* Copyright (C) 2013-2023 TU Dortmund | ||
* This file is part of LearnLib, http://www.learnlib.de/. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package de.learnlib.algorithms.procedural; | ||
|
||
/** | ||
* A utility class to annotate an input symbol with a (boolean) <i>continuable</i> flag. | ||
* | ||
* @param <I> | ||
* input symbol type | ||
* | ||
* @author frohme | ||
*/ | ||
public class SymbolWrapper<I> { | ||
|
||
private final I delegate; | ||
private final boolean continuable; | ||
|
||
public SymbolWrapper(I delegate, boolean continuable) { | ||
this.delegate = delegate; | ||
this.continuable = continuable; | ||
} | ||
|
||
public I getDelegate() { | ||
return delegate; | ||
} | ||
|
||
public boolean isContinuable() { | ||
return continuable; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return delegate + " (" + continuable + ')'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...ral/src/main/java/de/learnlib/algorithms/procedural/adapter/dfa/OptimalTTTAdapterDFA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* Copyright (C) 2013-2023 TU Dortmund | ||
* This file is part of LearnLib, http://www.learnlib.de/. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package de.learnlib.algorithms.procedural.adapter.dfa; | ||
|
||
import java.util.List; | ||
|
||
import de.learnlib.algorithms.oml.ttt.dfa.OptimalTTTDFA; | ||
import de.learnlib.algorithms.oml.ttt.pt.PTNode; | ||
import de.learnlib.api.AccessSequenceTransformer; | ||
import de.learnlib.api.oracle.MembershipOracle; | ||
import net.automatalib.words.Alphabet; | ||
import net.automatalib.words.Word; | ||
|
||
/** | ||
* Adapter for using {@link OptimalTTTDFA} as a procedural learner. | ||
* | ||
* @param <I> | ||
* input symbol type | ||
* | ||
* @author frohme | ||
*/ | ||
public class OptimalTTTAdapterDFA<I> extends OptimalTTTDFA<I> implements AccessSequenceTransformer<I> { | ||
|
||
public OptimalTTTAdapterDFA(Alphabet<I> alphabet, MembershipOracle<I, Boolean> oracle) { | ||
super(alphabet, oracle); | ||
} | ||
|
||
@Override | ||
public Word<I> transformAccessSequence(Word<I> word) { | ||
final List<PTNode<I, Boolean>> shortPrefixes = super.getState(word).getShortPrefixes(); | ||
|
||
assert shortPrefixes.size() == 1; | ||
|
||
return shortPrefixes.get(0).word(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
.../java/de/learnlib/algorithms/procedural/adapter/mealy/DiscriminationTreeAdapterMealy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* Copyright (C) 2013-2023 TU Dortmund | ||
* This file is part of LearnLib, http://www.learnlib.de/. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package de.learnlib.algorithms.procedural.adapter.mealy; | ||
|
||
import de.learnlib.algorithms.discriminationtree.mealy.DTLearnerMealy; | ||
import de.learnlib.api.AccessSequenceTransformer; | ||
import de.learnlib.api.oracle.MembershipOracle; | ||
import de.learnlib.counterexamples.LocalSuffixFinders; | ||
import net.automatalib.words.Alphabet; | ||
import net.automatalib.words.Word; | ||
|
||
/** | ||
* Adapter for using {@link DTLearnerMealy} as a procedural learner. | ||
* | ||
* @param <I> | ||
* input symbol type | ||
* @param <O> | ||
* output symbol type | ||
* | ||
* @author frohme | ||
*/ | ||
public class DiscriminationTreeAdapterMealy<I, O> extends DTLearnerMealy<I, O> implements AccessSequenceTransformer<I> { | ||
|
||
public DiscriminationTreeAdapterMealy(Alphabet<I> alphabet, MembershipOracle<I, Word<O>> oracle) { | ||
super(alphabet, oracle, LocalSuffixFinders.RIVEST_SCHAPIRE, true); | ||
} | ||
|
||
@Override | ||
public Word<I> transformAccessSequence(Word<I> word) { | ||
return super.getHypothesisDS().transformAccessSequence(word); | ||
} | ||
} |
Oops, something went wrong.