mirror of
https://github.com/Jaxan/hybrid-ads.git
synced 2025-04-27 15:07:45 +02:00
Adds expected length (in randomised phase) as option to main
This commit is contained in:
parent
1856602e3c
commit
da41dfec26
4 changed files with 14 additions and 22 deletions
|
@ -23,7 +23,7 @@ import java.util.*;
|
|||
public class YannakakisEQOracle<O> implements EquivalenceOracle.MealyEquivalenceOracle<String, O> {
|
||||
private final MembershipOracle<String, Word<O>> sulOracle;
|
||||
private final List<Alphabet<String>> alphabets;
|
||||
private final ProcessBuilder pb = new ProcessBuilder("/Users/joshua/Documents/PhD/Yannakakis/build/main", "--", "1", "stream");
|
||||
private final ProcessBuilder pb = new ProcessBuilder("/Users/joshua/Documents/PhD/Yannakakis/build/main", "--", "0", "3", "random");
|
||||
|
||||
private int currentAlphabet = 0;
|
||||
private long bound = 100;
|
||||
|
|
|
@ -33,14 +33,15 @@ void test(const mealy & specification, const transfer_sequences & prefixes,
|
|||
}
|
||||
|
||||
void randomized_test(const mealy & specification, const transfer_sequences & prefixes,
|
||||
const separating_family & separating_family, size_t min_k,
|
||||
const separating_family & separating_family, size_t min_k, size_t rnd_length,
|
||||
const writer & output) {
|
||||
clog << "*** K >= " << min_k << endl;
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 generator(rd());
|
||||
|
||||
uniform_int_distribution<> unfair_coin(0, 2);
|
||||
// https://en.wikipedia.org/wiki/Geometric_distribution we have the random variable Y here
|
||||
uniform_int_distribution<> unfair_coin(0, rnd_length);
|
||||
uniform_int_distribution<size_t> prefix_selection(0, prefixes.size() - 1);
|
||||
uniform_int_distribution<size_t> suffix_selection;
|
||||
uniform_int_distribution<input> input_selection(0, specification.input_size - 1);
|
||||
|
|
|
@ -19,7 +19,7 @@ void test(mealy const & specification, transfer_sequences const & prefixes,
|
|||
/// \brief Performs random non-exhaustive tests for more states (harmonized, e.g. HSI / DS)
|
||||
[[noreturn]] void randomized_test(mealy const & specification, transfer_sequences const & prefixes,
|
||||
separating_family const & separating_family, size_t min_k,
|
||||
writer const & output);
|
||||
size_t rnd_length, writer const & output);
|
||||
|
||||
/// \brief returns a writer which simply writes everything to cout (via inputs)
|
||||
writer default_writer(const std::vector<std::string> & inputs);
|
||||
|
|
27
src/main.cpp
27
src/main.cpp
|
@ -18,19 +18,19 @@ using namespace std;
|
|||
using time_logger = silent_timer;
|
||||
|
||||
int main(int argc, char *argv[]) try {
|
||||
if(argc != 4) {
|
||||
cerr << "usage: main <filename> <max k> <stream|stop>" << endl;
|
||||
if(argc != 5) {
|
||||
cerr << "usage: main <filename> <max k> <rnd length> <all|fixed|random>" << endl;
|
||||
return 1;
|
||||
}
|
||||
const string filename = argv[1];
|
||||
const bool use_stdio = filename == "--";
|
||||
|
||||
// 0 => only states checks. 1 => transition checks. 2 or more => deep checks
|
||||
const auto k_max = stoul(argv[2]);
|
||||
const auto rnd_length = stoul(argv[3]);
|
||||
|
||||
const string mode = argv[3];
|
||||
const bool streaming = mode == "stream" || mode == "stop";
|
||||
const bool random_part = streaming && mode != "stop";
|
||||
const string mode = argv[4];
|
||||
const bool streaming = mode == "all" || mode == "fixed";
|
||||
const bool random_part = mode == "all" || mode == "random";
|
||||
|
||||
const bool use_distinguishing_sequence = true;
|
||||
const bool randomize_prefixes = true;
|
||||
|
@ -63,7 +63,6 @@ int main(int argc, char *argv[]) try {
|
|||
return create_splitting_tree(machine, randomize_hopcroft ? randomized_hopcroft_style : hopcroft_style);
|
||||
}();
|
||||
|
||||
|
||||
return splitting_tree_hopcroft.root;
|
||||
}();
|
||||
|
||||
|
@ -93,22 +92,13 @@ int main(int argc, char *argv[]) try {
|
|||
}
|
||||
}();
|
||||
|
||||
auto inputs = [&]{
|
||||
return create_reverse_map(translation.input_indices);
|
||||
}();
|
||||
|
||||
|
||||
// const auto all_pair_seperating_sequences = all_pair_seperating_sequences_fut.get();
|
||||
// const auto sequence = sequence_fut.get();
|
||||
auto inputs = create_reverse_map(translation.input_indices);
|
||||
|
||||
const auto separating_family = [&]{
|
||||
time_logger t("making seperating family");
|
||||
return create_separating_family(sequence, all_pair_separating_sequences);
|
||||
}();
|
||||
|
||||
// const auto transfer_sequences = transfer_sequences_fut.get();
|
||||
// const auto inputs = inputs_fut.get();
|
||||
|
||||
if(streaming){
|
||||
time_logger t("outputting all preset tests");
|
||||
test(machine, transfer_sequences, separating_family, k_max, default_writer(inputs));
|
||||
|
@ -116,7 +106,8 @@ int main(int argc, char *argv[]) try {
|
|||
|
||||
if(random_part){
|
||||
time_logger t("outputting all random tests");
|
||||
randomized_test(machine, transfer_sequences, separating_family, k_max+1, default_writer(inputs));
|
||||
const auto k_max_ = streaming ? k_max + 1 : 0;
|
||||
randomized_test(machine, transfer_sequences, separating_family, k_max_, rnd_length, default_writer(inputs));
|
||||
}
|
||||
|
||||
} catch (exception const & e) {
|
||||
|
|
Loading…
Add table
Reference in a new issue