libgsjj  1
Deterministic finite automata learning library
Method.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <set>
4 #include <string>
5 #include <memory>
6 #include <chrono>
7 #include <atomic>
8 
9 #include "gsjj/DFA.h"
10 
11 namespace gsjj {
22  namespace passive {
26  const std::array<const std::string, 8> allMethods = {
27  "biermann",
28  "unary",
29  "binary",
30  "heule",
31  "neider",
32  "unaryNonCNF",
33  "binaryNonCNF",
34  "heuleNonCNF"
35  };
36 
40  class Method {
41  public:
42 
43  public:
44  Method() = delete;
45  virtual ~Method();
46 
53  virtual bool solve() = 0;
54 
60  bool hasSolution() const {
61  return m_hasSolution;
62  }
63 
69  unsigned int numberOfStates() const;
70 
78  virtual std::unique_ptr<DFA<char>> constructDFA() = 0;
79 
85  double timeToSolve() const;
86 
95  virtual void setStopTrigger(const std::chrono::seconds &timeLimit, std::atomic_bool &stopTrigger, const bool *stopPointer) = 0;
96 
97  protected:
101  const std::set<std::string> m_Sp;
105  const std::set<std::string> m_Sm;
109  const unsigned int m_numberStates;
113  const std::set<std::string> m_S;
117  const std::set<std::string> m_prefixes;
121  const std::set<char> m_alphabet;
122 
125 
127  double m_cpuTimeEnd;
128 
129  protected:
140  Method(const std::set<std::string> &SpSet, const std::set<std::string> &SmSet, const std::set<std::string> &SSet, const std::set<std::string> &prefixesSet, const std::set<char> &alphabetSet, unsigned int n);
141  };
142  }
143 }
virtual std::unique_ptr< DFA< char > > constructDFA()=0
Constructs the DFA induced by the variables according to the method.
const std::set< char > m_alphabet
Definition: Method.h:121
The namespace of the library.
Definition: binary.h:11
const std::array< const std::string, 8 > allMethods
An array with every possible method choice.
Definition: Method.h:26
This file declares and implements the templated class DFA.
double timeToSolve() const
Gives the CPU time taken to solve the problem.
Definition: Method.cpp:47
double m_cpuTimeStart
Definition: Method.h:126
virtual ~Method()
Definition: Method.cpp:40
const std::set< std::string > m_Sm
The set of words to reject .
Definition: Method.h:105
const std::set< std::string > m_prefixes
Definition: Method.h:117
unsigned int numberOfStates() const
Gives the number of states of the prospected DFA (the n)
Definition: Method.cpp:43
virtual void setStopTrigger(const std::chrono::seconds &timeLimit, std::atomic_bool &stopTrigger, const bool *stopPointer)=0
Sets the stop trigger for this method.
bool hasSolution() const
If solve() has been called and if there exists a solution, return True.
Definition: Method.h:60
const unsigned int m_numberStates
The number of states in the DFA to construct.
Definition: Method.h:109
The base class of all passive methods.
Definition: Method.h:40
const std::set< std::string > m_S
In the code, .
Definition: Method.h:113
const std::set< std::string > m_Sp
The set of words to accept .
Definition: Method.h:101
virtual bool solve()=0
Solves the SAT/SMT problem induced by the method.