Commit 8de92c03 authored by Gijs van Cuyck's avatar Gijs van Cuyck

added command line option for changing the output directory.

this was required because running compare results on the entire
benchmark set generates gigabytes of data.
parent 5c0bb941
digraph invalid_as_can_be {
source -> s1 [label="a / 0"];
source -> s2 [label="b / 0"];
source -> s3 [label="c / 0"];
source -> s4 [label="d / 0"];
s1 -> sink [label="a / 1"];
s1 -> sink [label="d / 1"];
s1 -> sink [label="b / 0"];
......
......@@ -277,6 +277,7 @@ namespace complete
//the forced progress might open new options, for which we check first before we force progress again.
force_progress = false;
//the valid set should be either empty or a (possibly improper) subset of the states of this node.
assert(valid_set.empty() || [&valid_set](const splitting_tree &boom)
{
for (const state s : valid_set)
......@@ -354,6 +355,7 @@ namespace complete
}
assert(new_blocks.size() > 1);
//todo: possibly use the intersection of new_valid_set and valid_set instead of just new_valid_set
// a succesful split, save the required information for later.
splits.emplace_back(word(1, symbol), move(new_blocks), move(new_valid_set));
if (updated_separator)
......
......@@ -62,10 +62,13 @@ static const char USAGE[] =
-k <num> Number of extra states to check for (minus 1). currently not supported
-x <seed> 32 bits seeds for deterministic execution (0 is not valid). currently not supported
-f <filename> Input filename ('-' or don't specify for default example). path should be relative to examples directory
-o <filename> Output filename ('-' or don't specify for default output file). path should be relative to outputs directory
-O <directory> Output directory (don't specify for default outputs directory). changing this will not change where the compare results are stored.
This argument should be given before the output filename, otherwise its value is ignored.
-o <filename> Output filename ('-' or don't specify for default output file). path should be relative to output directory
)";
const std::string output_directory = "../outputs/";
std::string output_directory = "../outputs/";
std::string input_directory = "../examples/";
const std::string compare_directory = output_directory + "compare_results/";
......@@ -86,7 +89,7 @@ struct main_options
//"esm-manual-controller.dot";
//"ABP_Sender.flat_0_1.dot";
//"ex5_with_loops_with_hidden_states_minimized.dot";
std::string input_filename = input_directory + "lee_yannakakis_difficult.dot";
std::string input_filename = input_directory + "no_semi-valid_transitions.dot";
std::string output_filename = "";
std::string hybrid_output_filename = "";
std::string compare_filename = compare_directory + "compare_results.txt";
......@@ -107,7 +110,7 @@ main_options parse_options(int argc, char **argv)
try
{
int c;
while ((c = complete::getopt(argc, argv, "hvdcaC:k:x:f:o:")) != -1)
while ((c = complete::getopt(argc, argv, "hvdcaC:k:x:f:O:o:")) != -1)
{
switch (c)
{
......@@ -138,6 +141,9 @@ main_options parse_options(int argc, char **argv)
case 'f': // input filename
opts.input_filename = input_directory + complete::optarg;
break;
case 'O': //output directory
output_directory = complete::optarg;
break;
case 'o': // output filename
opts.output_filename = output_directory + complete::optarg;
opts.hybrid_output_filename = output_directory + "hybrid_" + complete::optarg;
......@@ -251,10 +257,9 @@ int main(int argc, char *argv[])
*/
std::cout << "creating splitting tree\n";
std::cout << "generating complete style splitting tree\n";
complete::splitting_tree complete_splitting_tree = create_splitting_tree(machine);
std::cout << "creating readable splitting tree\n";
complete::readable_splitting_tree translated_tree = translate_splitting_tree(complete_splitting_tree,
input_translation,
state_translation);
......@@ -262,7 +267,7 @@ int main(int argc, char *argv[])
out_file << "the splitting tree:\n\n";
rst_to_stream(translated_tree, out_file) << "\n\n\n";
std::cout << "creating separating family\n";
std::cout << "generating complete style separating family\n";
complete::separating_family family = create_separating_family(complete_splitting_tree, machine);
//making sure the results are actually correct.
......@@ -272,15 +277,13 @@ int main(int argc, char *argv[])
out_file << "the separating family:\n\n";
complete::separating_family_to_stream(out_file, family, input_translation, state_translation);
std::cout << "generating Wp style test suite\n";
complete::test_suite TS = create_test_suite(family, machine, complete::state(0));
out_file << "the test suite:\n\n";
complete::test_suite_to_stream(out_file, TS, input_translation);
out_file.close();
std::cout << "finished!\n";
if (args.do_compare)
{
//create a test suite using the hybrid ads code as well to compare with.
......@@ -326,6 +329,7 @@ int main(int argc, char *argv[])
return seeds;
}();
std::cout << "generating hopcroft style splitting tree\n";
auto all_pair_separating_sequences = [&]
{
......@@ -339,17 +343,20 @@ int main(int argc, char *argv[])
return splitting_tree_hopcroft.root;
}();
auto sequence = [&]
{
const auto tree = [&]
{
std::cout << "generating hybrid style splitting tree\n";
return create_splitting_tree(machine, hybrid::lee_yannakakis_style, random_seeds[1]);
}();
const auto sequence_ = [&]
{
std::cout << "generating adaptive distinguising sequence\n";
return hybrid::create_adaptive_distinguishing_sequence(tree);
}();
......@@ -361,6 +368,7 @@ int main(int argc, char *argv[])
auto const inputs = hybrid::create_reverse_map(translation.input_indices);
std::cout <<"generating hybrid style separating family\n";
const auto separating_family = hybrid::create_separating_family(sequence, all_pair_separating_sequences);
hybrid::trie<hybrid::input> test_suite;
......@@ -373,7 +381,7 @@ int main(int argc, char *argv[])
}
std::cout << std::endl;
};
std::cout << "generating hybrid style test suite\n";
std::vector<hybrid::word> mid_sequences(1);
hybrid::test(machine, transfer_sequences, mid_sequences, separating_family, args.k_max + 1,
{[&buffer](auto const &w)
......@@ -423,7 +431,7 @@ int main(int argc, char *argv[])
result_stats_file << "hybrid test suite:\n";
result_stats_file << "\ttotal length: " << hybrid_ts_lenght << "\n";
result_stats_file << "\tresets: " << hybrid_test_suite.size() << "\n";
result_stats_file << "complete test suite improvements: (negative represent worse results)\n";
result_stats_file << "complete test suite improvements: (negative numbers represent worse results)\n";
result_stats_file << "\tpercentage lenth improvement: "
<< 100.0 * (hybrid_ts_lenght - complete_ts_lenght) / (hybrid_ts_lenght) << "%\n";
result_stats_file << "\tpercentage resets improvement: "
......@@ -433,6 +441,7 @@ int main(int argc, char *argv[])
}
std::cout << "finished!\n";
exit(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment