|
libgsjj
1
Deterministic finite automata learning library
|
Defines the passive methods for automatically learning deterministic finite automata. More...
Namespaces | |
| CNF | |
| Contains every method that relies on a SAT solver with CNF clauses. | |
| NonCNF | |
| Contains every method that relies on a SAT solver that works on any boolean formula. | |
| SMT | |
| Contains every method that relies on a SMT solver. | |
Classes | |
| class | Method |
| The base class of all passive methods. More... | |
| class | MethodFactory |
| The Factory Builder design pattern adapted to our methods. More... | |
| class | RegisterInFactory |
| Helps to register a method in the factory. More... | |
Functions | |
| std::unique_ptr< Method > | constructMethod (const std::string &name, unsigned int n, const std::set< std::string > &Sp, const std::set< std::string > &Sm) |
| Computes the alphabet and the prefixes set from Sp and Sm and constructs a method for a fixed number of states. More... | |
| std::unique_ptr< Method > | constructMethod (const std::string &name, unsigned int n, const std::set< std::string > &Sp, const std::set< std::string > &Sm, const std::set< std::string > &S, const std::set< std::string > &prefixes, const std::set< char > &alphabet) |
| Constructs a method for a fixed number of states. More... | |
| std::pair< std::unique_ptr< Method >, bool > | constructMethod (const std::string &name, const std::set< std::string > &Sp, const std::set< std::string > &Sm, const std::chrono::seconds &timeLimit=std::chrono::seconds(0), long double *timeTaken=nullptr) |
| Computes the alphabet and the prefixes set from Sp and Sm and constructs a method with the smallest possible number of states. More... | |
| std::pair< std::unique_ptr< Method >, bool > | constructMethod (const std::string &name, const std::set< std::string > &Sp, const std::set< std::string > &Sm, const std::set< std::string > &S, const std::set< std::string > &prefixes, const std::set< char > &alphabet, const std::chrono::seconds &timeLimit=std::chrono::seconds(0), long double *timeTaken=nullptr) |
| Constructs a method with the smallest possible number of states. More... | |
| std::set< std::string > | computeS (const std::set< std::string > &Sp, const std::set< std::string > &Sm) |
Computes . More... | |
| std::set< std::string > | computePrefixes (const std::set< std::string > &S) |
Computes . More... | |
| std::set< char > | computeAlphabet (const std::set< std::string > &S) |
Computes the alphabet from the words in . More... | |
| void | readFromFile (const std::string &inputFile, std::set< std::string > &Sp, std::set< std::string > &Sm) |
Reads the and sets from a file. More... | |
| void | generateRandomly (unsigned int numberWords, unsigned int minLength, unsigned int maxLength, unsigned int alphabetSize, std::set< std::string > &Sp, std::set< std::string > &Sm, double SpProbability=0.5) |
| Generates randomly a sample set. More... | |
| double | getCPUTime () |
| std::unique_ptr< Method > | constructMethodTrigger (const std::string &name, unsigned int n, const std::set< std::string > &Sp, const std::set< std::string > &Sm, const std::set< std::string > &S, const std::set< std::string > &prefixes, const std::set< char > &alphabet, const std::chrono::seconds &timeLimit, std::atomic_bool &stopTrigger, const bool *stopPointer) |
Variables | |
| const std::array< const std::string, 8 > | allMethods |
| An array with every possible method choice. More... | |
Defines the passive methods for automatically learning deterministic finite automata.
These methods receive a sample
where
is the set of words the automaton must accept
is the set of words the automaton must rejectThe words that are not in
nor in
can be either accepted or rejected (depending on the generated DFA).
can not be empty. | std::set< char > gsjj::passive::computeAlphabet | ( | const std::set< std::string > & | S | ) |
| std::set< std::string > gsjj::passive::computePrefixes | ( | const std::set< std::string > & | S | ) |
| std::set< std::string > gsjj::passive::computeS | ( | const std::set< std::string > & | Sp, |
| const std::set< std::string > & | Sm | ||
| ) |
| std::unique_ptr< Method > gsjj::passive::constructMethod | ( | const std::string & | name, |
| unsigned int | n, | ||
| const std::set< std::string > & | Sp, | ||
| const std::set< std::string > & | Sm | ||
| ) |
Computes the alphabet and the prefixes set from Sp and Sm and constructs a method for a fixed number of states.
Sp and Sm must be disjoint.
| name | The name of the method to construct |
| n | The number of states |
| Sp | The set |
| Sm | The set |
Definition at line 50 of file MethodFactory.cpp.
| std::unique_ptr< Method > gsjj::passive::constructMethod | ( | const std::string & | name, |
| unsigned int | n, | ||
| const std::set< std::string > & | Sp, | ||
| const std::set< std::string > & | Sm, | ||
| const std::set< std::string > & | S, | ||
| const std::set< std::string > & | prefixes, | ||
| const std::set< char > & | alphabet | ||
| ) |
Constructs a method for a fixed number of states.
Sp and Sm must be disjoint.
| name | The name of the method to construct |
| n | The number of states |
| Sp | The set |
| Sm | The set |
| S | The set. See passive::computeS |
| prefixes | The set. See passive::computePrefixes |
| alphabet | The alphabet. See computeAlphabet |
Definition at line 58 of file MethodFactory.cpp.
| std::pair< std::unique_ptr< Method >, bool > gsjj::passive::constructMethod | ( | const std::string & | name, |
| const std::set< std::string > & | Sp, | ||
| const std::set< std::string > & | Sm, | ||
| const std::chrono::seconds & | timeLimit = std::chrono::seconds(0), |
||
| long double * | timeTaken = nullptr |
||
| ) |
Computes the alphabet and the prefixes set from Sp and Sm and constructs a method with the smallest possible number of states.
This uses a linear search to find the minimal number of states
Sp and Sm must be disjoint.
| name | The name of the method to construct |
| Sp | The set |
| Sm | The set |
| timeLimit | The time in seconds the program can take to find the best possible method. |
| timeTaken | If not nullptr, the total time used to solve the different formulas is written. It does NOT give the full CPU time to find the best number of states, juste the time used by the SAT/SMT solvers! |
and a boolean. The boolean is true iff the function did not reach the time limit. Definition at line 62 of file MethodFactory.cpp.
| std::pair< std::unique_ptr< Method >, bool > gsjj::passive::constructMethod | ( | const std::string & | name, |
| const std::set< std::string > & | Sp, | ||
| const std::set< std::string > & | Sm, | ||
| const std::set< std::string > & | S, | ||
| const std::set< std::string > & | prefixes, | ||
| const std::set< char > & | alphabet, | ||
| const std::chrono::seconds & | timeLimit = std::chrono::seconds(0), |
||
| long double * | timeTaken = nullptr |
||
| ) |
Constructs a method with the smallest possible number of states.
This uses a linear search to find the minimal number of states
Sp and Sm must be disjoint.
| name | The name of the method to construct |
| Sp | The set |
| Sm | The set |
| S | . See passive::computeS |
| prefixes | The set of prefixes of . See passive::computePrefixes |
| alphabet | The alphabet of . See passive::computeAlphabet |
| timeLimit | The time in milliseconds the program can take to find the best possible method. |
| timeTaken | If not nullptr, the total time used to solve the different formulas is written. It does NOT give the full CPU time to find the best number of states, juste the time used by the SAT/SMT solvers! |
and a boolean. The boolean is true iff the function did not reach the time limit. Definition at line 70 of file MethodFactory.cpp.
| std::unique_ptr<Method> gsjj::passive::constructMethodTrigger | ( | const std::string & | name, |
| unsigned int | n, | ||
| const std::set< std::string > & | Sp, | ||
| const std::set< std::string > & | Sm, | ||
| const std::set< std::string > & | S, | ||
| const std::set< std::string > & | prefixes, | ||
| const std::set< char > & | alphabet, | ||
| const std::chrono::seconds & | timeLimit, | ||
| std::atomic_bool & | stopTrigger, | ||
| const bool * | stopPointer | ||
| ) |
Definition at line 41 of file MethodFactory.cpp.
| void gsjj::passive::generateRandomly | ( | unsigned int | numberWords, |
| unsigned int | minLength, | ||
| unsigned int | maxLength, | ||
| unsigned int | alphabetSize, | ||
| std::set< std::string > & | Sp, | ||
| std::set< std::string > & | Sm, | ||
| double | SpProbability = 0.5 |
||
| ) |
Generates randomly a sample set.
The alphabet's size is at most 10.
The functions ensures that Sp and Sm do not contain a common word. It must be possible to generate enough words. Otherwise, this function will never terminates.
| numberWords | The total number of words to generate |
| minLength | The minimum size of each word |
| maxLength | The maximum size of each word |
| alphabetSize | The size of the alphabet. Since symbols are taken randomly in the alphabet, it may happen that a sampling set uses a smaller alphabet. |
| Sp | The words to accept are put in this set |
| Sm | The words to reject are put in this set |
| SpProbability | The probability that a word is put in Sp (by default, 0.5) |
| void gsjj::passive::readFromFile | ( | const std::string & | inputFile, |
| std::set< std::string > & | Sp, | ||
| std::set< std::string > & | Sm | ||
| ) |
1.8.13