libgsjj  1
Deterministic finite automata learning library
SATNonCNFMethod.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <ostream>
4 #include <atomic>
5 
6 #include "gsjj/passive/Method.h"
7 
8 // Since limboole is written in C, we must force the compiler
9 extern "C" {
10  #include "limboole/limboole.h"
11 }
12 
13 namespace gsjj {
14  namespace passive {
20  namespace NonCNF {
26  class SATNonCNFMethod : public Method {
27  public:
28  SATNonCNFMethod() = delete;
29  virtual ~SATNonCNFMethod();
30 
31  virtual bool solve() override;
32 
33  virtual std::unique_ptr<DFA<char>> constructDFA() override;
34 
35  virtual void setStopTrigger(const std::chrono::seconds &timeLimit, std::atomic_bool &stopTrigger, const bool *stopPointer) override;
36 
37  protected:
42  virtual std::string getFileName() const = 0;
43 
48  bool isSatisfiable() const;
49 
55  virtual bool createFormula(std::ostream &stream) = 0;
56 
62  virtual std::unique_ptr<DFA<char>> toDFA(std::istream &stream) const = 0;
63 
64  SATNonCNFMethod(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);
65 
66  protected:
67  const bool *mustStop;
68 
69  private:
73  std::string getInputFile() const;
77  std::string getOutputFile() const;
78  };
79  }
80  }
81 }
The namespace of the library.
Definition: binary.h:11
virtual void setStopTrigger(const std::chrono::seconds &timeLimit, std::atomic_bool &stopTrigger, const bool *stopPointer) override
Sets the stop trigger for this method.
virtual std::unique_ptr< DFA< char > > toDFA(std::istream &stream) const =0
Effectively creates the DFA.
virtual bool solve() override
Solves the SAT/SMT problem induced by the method.
virtual std::string getFileName() const =0
Gives the name of the file in which the boolean formula must be written.
The base class of all passive methods.
Definition: Method.h:40
Base class for every method that relies on a non-CNF SAT solver.
virtual std::unique_ptr< DFA< char > > constructDFA() override
Constructs the DFA induced by the variables according to the method.
virtual bool createFormula(std::ostream &stream)=0
Creates the boolean formula (must not be in CNF) and writes it in the stream.
bool isSatisfiable() const
Reads the output of the SAT solver and checks if the formula was satisfiable or not.