1
Fork 0
mirror of https://github.com/Jaxan/hybrid-ads.git synced 2025-04-27 15:07:45 +02:00
This commit is contained in:
Joshua Moerman 2015-05-04 10:21:44 +02:00
parent aeb60d84cf
commit 7fcafba6e9
9 changed files with 25 additions and 150 deletions

View file

@ -1,4 +1,4 @@
#include "seperating_family.hpp"
#include "characterization_family.hpp"
#include "trie.hpp"
#include <boost/range/algorithm.hpp>
@ -11,7 +11,7 @@
using namespace std;
characterization_family create_seperating_family(const adaptive_distinguishing_sequence & sequence,
const seperating_matrix & sep_matrix) {
const separating_matrix & sep_matrix) {
const auto N = sequence.CI.size();
// all words (global/local) for all states
vector<trie> suffixes(N);

View file

@ -1,7 +1,7 @@
#pragma once
#include "adaptive_distinguishing_sequence.hpp"
#include "seperating_matrix.hpp"
#include "separating_matrix.hpp"
#include "types.hpp"
/// \brief From the LY algorithm we generate characterizations sets (as in the Chow framework)
@ -26,4 +26,4 @@ using characterization_family = std::vector<characterization_set>;
/// \brief Creates the characterization family from the results of the LY algorithm
/// If the sequence is complete, we do not need the separating_matrix
characterization_family create_seperating_family(const adaptive_distinguishing_sequence & sequence,
const seperating_matrix & sep_matrix);
const separating_matrix & sep_matrix);

View file

@ -1,4 +1,4 @@
#include "seperating_matrix.hpp"
#include "separating_matrix.hpp"
#include <cassert>
#include <functional>
@ -6,9 +6,9 @@
using namespace std;
seperating_matrix create_all_pair_seperating_sequences(const splitting_tree & root){
separating_matrix create_all_pair_seperating_sequences(const splitting_tree & root){
const auto N = root.states.size();
seperating_matrix all_pair_seperating_sequences(N, seperating_row(N));
separating_matrix all_pair_seperating_sequences(N, separating_row(N));
queue<reference_wrapper<const splitting_tree>> work;
work.push(root);

13
lib/separating_matrix.hpp Normal file
View file

@ -0,0 +1,13 @@
#pragma once
#include "types.hpp"
#include "splitting_tree.hpp"
/// A separating matrix is a matrix indexed by states, which assigns to each
/// pair of (inequivalent) states a separating sequences. This can be done by
/// the classical Hopcroft or Moore algorithm
using separating_row = std::vector<word>;
using separating_matrix = std::vector<separating_row>;
separating_matrix create_all_pair_seperating_sequences(splitting_tree const & root);

View file

@ -1,15 +0,0 @@
#pragma once
#include "types.hpp"
#include "splitting_tree.hpp"
/*
* A seperating matrix is a matrix indexed by states, which assigns to each
* pair of (inequivalent) states a seperating sequences. This can be done by
* the classical Hopcroft algorithm
*/
using seperating_row = std::vector<word>;
using seperating_matrix = std::vector<seperating_row>;
seperating_matrix create_all_pair_seperating_sequences(splitting_tree const & root);

View file

@ -3,8 +3,8 @@
#include <mealy.hpp>
#include <reachability.hpp>
#include <read_mealy_from_dot.hpp>
#include <seperating_family.hpp>
#include <seperating_matrix.hpp>
#include <characterization_family.hpp>
#include <separating_matrix.hpp>
#include <splitting_tree.hpp>
#include <transfer_sequences.hpp>

View file

@ -1,7 +1,7 @@
#include <adaptive_distinguishing_sequence.hpp>
#include <read_mealy_from_dot.hpp>
#include <seperating_family.hpp>
#include <seperating_matrix.hpp>
#include <characterization_family.hpp>
#include <separating_matrix.hpp>
#include <trie.hpp>
#include <splitting_tree.hpp>
#include <transfer_sequences.hpp>
@ -79,6 +79,5 @@ int main(int argc, char * argv[]) {
}
const auto p = total_size(test_suite);
cout << p.first << endl;
cout << p.second << endl;
cout << p.first << '\t' << p.second << endl;
}

View file

@ -1,30 +0,0 @@
#include <mealy.hpp>
#include <read_mealy_from_dot.hpp>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main(int argc, char *argv[]){
if(argc != 2) return 1;
const string filename = argv[1];
const auto result = read_mealy_from_dot(filename);
const auto & machine = result.first;
const auto & translation = result.second;
// note the wrong iteration ;D
for(state s = 0; s < machine.graph_size; ++s){
size_t scores[3] = {0, 0, 0};
for(input i = 0; i < machine.input_size; ++i){
const auto test1 = apply(machine, s, i).output != translation.output_indices.at("quiescence");
const auto test2 = apply(machine, s, i).to != s;
scores[test1 + test2]++;
}
cout << scores[2] << " " << scores[1] << " " << scores[0] << endl;
}
}

View file

@ -1,92 +0,0 @@
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main() {
stringstream input(
"1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 3 2 4 2 5 2 6 2 7 2 8 2 9 3 4 3 5 3 "
"6 3 7 3 8 3 9 4 5 4 6 4 7 4 8 4 9 5 6 5 7 5 8 5 9 6 7 6 8 6 9 7 8 7 9 "
"8 9 10 11 11 12 11 13 11 14 11 15 11 16 11 17 11 18 11 19 11 20 11 21 "
"11 22 11 23 11 24 11 25 12 13 12 14 12 15 12 16 12 17 12 18 12 19 12 "
"20 12 21 12 22 12 23 12 24 12 25 13 14 13 15 13 16 13 17 13 18 13 19 "
"13 20 13 21 13 22 13 23 13 24 13 25 14 15 14 16 14 17 14 18 14 19 14 "
"20 14 21 14 22 14 23 14 24 14 25 15 16 15 17 15 18 15 19 15 20 15 21 "
"15 22 15 23 15 24 15 25 16 17 16 18 16 19 16 20 16 21 16 22 16 23 16 "
"24 16 25 17 18 17 19 17 20 17 21 17 22 17 23 17 24 17 25 18 19 18 20 "
"18 21 18 22 18 23 18 24 18 25 19 20 19 21 19 22 19 23 19 24 19 25 20 "
"21 20 22 20 23 20 24 20 25 21 22 21 23 21 24 21 25 22 23 22 24 22 25 "
"23 24 23 25 24 25 27 28 27 29 27 30 27 31 27 32 27 33 27 34 27 35 27 "
"36 27 37 27 38 28 29 28 30 28 31 28 32 28 33 28 34 28 35 28 36 28 37 "
"28 38 29 30 29 31 29 32 29 33 29 34 29 35 29 36 29 37 29 38 30 31 30 "
"32 30 33 30 34 30 35 30 36 30 37 30 38 31 32 31 33 31 34 31 35 31 36 "
"31 37 31 38 32 33 32 34 32 35 32 36 32 37 32 38 33 34 33 35 33 36 33 "
"37 33 38 34 35 34 36 34 37 34 38 35 36 35 37 35 38 36 37 36 38 37 38 "
"39 40 39 41 39 42 39 43 39 44 39 45 39 46 39 47 39 48 40 41 40 42 40 "
"43 40 44 40 45 40 46 40 47 40 48 41 42 41 43 41 44 41 45 41 46 41 47 "
"41 48 42 43 45 46 45 47 45 48 46 47 46 48 47 48 49 50 51 52 51 53 51 "
"54 51 55 51 56 51 57 51 58 51 59 51 60 51 61 51 62 51 63 51 64 51 65 "
"51 66 51 67 53 54 53 55 53 56 53 57 53 58 53 59 53 60 53 61 53 62 53 "
"63 53 64 53 65 53 66 53 67 54 55 54 56 54 57 54 58 54 59 54 60 54 61 "
"54 62 54 63 54 64 54 65 54 66 54 67 55 56 55 57 55 58 55 59 55 60 55 "
"61 55 62 55 63 55 64 55 65 55 66 55 67 56 57 56 58 56 59 56 60 56 61 "
"56 62 56 63 56 64 56 65 56 66 56 67 57 58 57 59 57 60 57 61 57 62 57 "
"63 57 64 57 65 57 66 57 67 58 59 58 60 58 61 58 62 58 63 58 64 58 65 "
"58 66 58 67 59 60 59 61 59 62 59 63 59 64 59 65 59 66 59 67 62 63 62 "
"64 62 65 62 66 62 67 63 64 63 65 63 66 64 65 64 66 64 67 65 66 65 67 "
"66 67 68 69 68 70 68 71 68 72 68 73 68 74 68 75 68 76 68 77 68 78 68 "
"79 68 80 68 81 68 82 68 83 68 84 68 85 68 86 68 87 68 88 68 89 68 90 "
"68 91 68 92 68 93 69 70 69 71 69 72 69 73 69 74 69 75 69 76 69 77 69 "
"78 69 79 69 80 69 81 69 82 69 83 69 84 69 85 69 86 69 87 69 88 69 89 "
"69 90 69 91 69 92 69 93 70 71 70 72 70 73 70 74 70 75 70 76 70 77 70 "
"78 70 79 70 80 70 81 70 82 70 83 70 84 70 85 70 86 70 87 70 88 70 89 "
"70 90 70 91 70 92 70 93 71 72 71 73 71 74 71 75 71 76 71 77 71 78 71 "
"79 71 80 71 81 71 82 71 83 71 84 71 85 71 86 71 87 71 88 71 89 71 90 "
"71 91 71 92 71 93 72 73 72 74 72 75 72 76 72 77 72 78 72 79 72 80 72 "
"81 72 82 72 83 72 84 72 85 72 86 72 87 72 88 72 89 72 90 72 91 72 92 "
"72 93 73 74 73 75 73 76 73 77 73 78 73 79 73 80 73 81 73 82 73 83 73 "
"84 73 85 73 86 73 87 73 88 73 89 73 90 73 91 73 92 73 93 74 75 74 76 "
"74 77 74 78 74 79 74 80 74 81 74 82 74 83 74 84 74 85 74 86 74 87 74 "
"88 74 89 74 90 74 91 74 92 74 93 75 76 75 77 75 78 75 79 75 80 75 81 "
"75 82 75 83 75 84 75 85 75 86 75 87 75 88 75 89 75 90 75 91 75 92 75 "
"93 76 77 76 78 76 79 76 80 76 81 76 82 76 83 76 84 76 85 76 86 76 87 "
"76 88 76 89 76 90 76 91 76 92 76 93 77 78 77 79 78 79 80 81 80 82 80 "
"83 80 84 80 85 80 86 80 87 80 88 80 89 80 90 80 91 80 92 80 93 81 82 "
"81 83 81 84 81 85 81 86 81 87 81 88 81 89 81 90 81 91 81 92 81 93 82 "
"83 82 84 82 85 82 86 82 87 82 88 82 89 82 90 82 91 82 92 82 93 84 85 "
"84 86 84 87 84 88 84 89 84 90 84 91 84 92 84 93 87 88 87 89 87 90 87 "
"91 87 92 87 93 88 89 88 90 88 91 88 92 88 93 89 90 89 91 89 92 89 93 "
"90 91 90 92 90 93 91 92 91 93 92 93 94 95 94 96 95 96 97 98 97 99 97 "
"100 97 101 97 102 97 103 97 104 97 105 97 106 97 107 97 108 97 109 97 "
"110 97 111 97 112 97 113 97 114 97 115 100 101 100 102 100 103 101 "
"102 101 103 102 103 104 105 104 106 104 107 104 108 104 109 104 110 "
"104 111 104 112 104 113 104 114 104 115 105 106 105 107 105 108 105 "
"109 105 110 105 111 105 112 105 113 105 114 105 115 106 107 106 108 "
"106 109 106 110 106 111 106 112 106 113 106 114 106 115 107 108 107 "
"109 107 110 107 111 107 112 107 113 107 114 107 115 108 109 108 110 "
"108 111 108 112 108 113 108 114 108 115 109 110 109 111 109 112 109 "
"113 109 114 109 115 110 111 110 112 110 113 110 114 110 115 111 112 "
"111 113 111 114 111 115 112 113 112 114 112 115 113 114 113 115 114 "
"115 116 117 116 118 116 119 116 120 117 118 117 119 117 120 118 119 "
"118 120 119 120 122 123 122 124 126 130 127 128 127 129 128 129 132 "
"133 132 134 132 135");
vector<vector<bool>> table(136, vector<bool>(136, false));
size_t x, y;
while (input >> x >> y) {
table[x][y] = true;
}
for (size_t r = 0; r < 136; ++r) {
for (size_t c = 0; c < 136; ++c) {
if (c == r)
cout << '=';
else if (table[r][c])
cout << 'X';
else
cout << ' ';
}
cout << endl;
}
}