12 #include "timed_automaton.hh"
13 #include "timed_word.hh"
14 #include "equivalence_oracle.hh"
15 #include "timed_automaton_runner.hh"
22 const std::vector<Alphabet> alphabet;
26 const double maxDuration;
29 const int maxTests,
const int maxLength,
const int maxDuration) :
30 alphabet(std::move(alphabet)),
31 automaton(std::move(automaton)),
34 maxDuration(maxDuration) {}
41 static std::random_device rng;
42 std::mt19937 engine(rng());
46 auto durationDist = std::uniform_real_distribution<double>(0, maxDuration);
47 auto actionDist = std::uniform_int_distribution(0,
int(alphabet.size() - 1));
49 for (
int i = 0; i < maxTests; ++i) {
51 hypothesisRunner.
pre();
53 std::vector<double> durations;
54 for (
int j = 0; j < maxLength; ++j) {
55 const double duration = durationDist(engine);
56 durations.push_back(duration);
57 if (runner.
step(duration) != hypothesisRunner.
step(duration)) {
60 const auto wordIndex = actionDist(engine);
61 word.push_back(alphabet.at(wordIndex));
62 if (runner.
step(alphabet.at(wordIndex)) != hypothesisRunner.
step(alphabet.at(wordIndex))) {
63 durations.push_back(0);
67 const double duration = durationDist(engine);
68 durations.push_back(duration);
69 if (runner.
step(duration) != hypothesisRunner.
step(duration)) {
74 hypothesisRunner.
post();
The equivalence oracle by random test.
Definition: equivalence_oracle_by_random_test.hh:21
std::optional< TimedWord > findCounterExample(const TimedAutomaton &hypothesis) override
Make an equivalence query.
Definition: equivalence_oracle_by_random_test.hh:39
Interface of the equivalence oracle.
Definition: equivalence_oracle.hh:17
Class to execute a timed automaton.
Definition: timed_automaton_runner.hh:22
bool step(char action) override
Feed a discrete action.
Definition: timed_automaton_runner.hh:80
void post() override
The function should be called after feeding each timed word.
Definition: timed_automaton_runner.hh:51
void pre() override
Reset the configuration.
Definition: timed_automaton_runner.hh:41
A timed word.
Definition: timed_word.hh:25
Definition: experiment_runner.hh:23
A timed automaton.
Definition: timed_automaton.hh:213