本文整理汇总了Java中net.automatalib.util.automata.Automata类的典型用法代码示例。如果您正苦于以下问题:Java Automata类的具体用法?Java Automata怎么用?Java Automata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Automata类属于net.automatalib.util.automata包,在下文中一共展示了Automata类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateTraces
import net.automatalib.util.automata.Automata; //导入依赖的package包/类
@Override
public List<List<Symbol>> generateTraces(int nrTraces, MealyMachine<Object, Symbol, ?, String> hypothesis,
List<MutantProducer> mutants) {
stateCover = new ArrayList<>(hypothesis.size());
Automata.cover(hypothesis, inputAlphabet, stateCover, null);
// Then repeatedly from this for a random word
arrayAlphabet = new ArrayList<>(inputAlphabet);
// Finally we test the state with a suffix, sometimes a global one, sometimes local
globalSuffixes = new ArrayList<>();
Automata.characterizingSet(hypothesis, inputAlphabet, globalSuffixes);
localSuffixSets = hypothesis.createStaticStateMapping();
for (Object state : hypothesis.getStates()) {
ArrayList<Word<Symbol>> suffixSet = new ArrayList<>();
Automata.stateCharacterizingSet(hypothesis, inputAlphabet, state, suffixSet);
localSuffixSets.put(state, suffixSet);
}
return TraceGenerator.super.generateTraces(nrTraces, hypothesis, mutants);
}
示例2: learnFromHypothesis
import net.automatalib.util.automata.Automata; //导入依赖的package包/类
/**
* Use the hypothesis of a previous step as a SUL and learn until no more counterexamples can be found. The learner
* is then internally where it stopped the last time.
*/
private void learnFromHypothesis(int step) {
final CompactMealy<String, String> hypothesis = result.getSteps().get(step - 1).getHypothesis()
.createMealyMachine(abstractAlphabet);
final MembershipOracle<String, Word<String>> oracle = mqOracle.getDelegate();
mqOracle.setDelegate(new SimulatorOracle<>(hypothesis));
learner.startLearning();
while (true) {
final Word<String> input = Automata.findSeparatingWord(learner.getHypothesisModel(), hypothesis,
abstractAlphabet);
if (input == null) {
break;
}
final DefaultQuery<String, Word<String>> counterexample = new DefaultQuery<>(input);
counterexample.answer(hypothesis.computeOutput(input));
learner.refineHypothesis(counterexample);
}
mqOracle.setDelegate(oracle);
}
示例3: findCounterExample
import net.automatalib.util.automata.Automata; //导入依赖的package包/类
@Override
public DefaultQuery<I, D> findCounterExample(A hypothesis, Collection<? extends I> inputs) {
List<Word<I>> transCover = Automata.transitionCover(hypothesis, inputs);
List<Word<I>> charSuffixes = Automata.characterizingSet(hypothesis, inputs);
// Special case: List of characterizing suffixes may be empty,
// but in this case we still need to test!
if (charSuffixes.isEmpty()) charSuffixes = Collections.singletonList(Word.<I>epsilon());
WordBuilder<I> wb = new WordBuilder<>();
List<DefaultQuery<I, D>> queryBatch = new ArrayList<>();
for (List<? extends I> middle : CollectionsUtil.allTuples(inputs, 1, maxDepth)) {
for (Word<I> trans : transCover) {
for (Word<I> suffix : charSuffixes) {
wb.append(trans).append(middle).append(suffix);
Word<I> queryWord = wb.toWord();
wb.clear();
DefaultQuery<I, D> query = new DefaultQuery<>(queryWord);
queryBatch.add(query);
if (queryBatch.size() >= batchSize) {
DefaultQuery<I, D> ce = processBatch(hypothesis, queryBatch);
if (ce != null) return ce;
queryBatch.clear();
}
}
}
}
// take care of remaining queries in the batch
if (queryBatch.size() > 0) {
return processBatch(hypothesis, queryBatch);
}
return null;
}