libgsjj  1
Deterministic finite automata learning library
SATCNFMethod.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "MapleCOMSPS_LRB/mtl/Vec.h"
4 #include "MapleCOMSPS_LRB/core/SolverTypes.h"
5 #include "MapleCOMSPS_LRB/simp/SimpSolver.h"
6 
7 #include "gsjj/passive/Method.h"
8 
9 namespace gsjj {
10  namespace passive {
16  namespace CNF {
22  class SATCNFMethod : public Method {
23  public:
24  SATCNFMethod() = delete;
25  virtual ~SATCNFMethod();
26 
27  bool solve() override;
28 
29  std::unique_ptr<DFA<char>> constructDFA() override;
30 
31  virtual void setStopTrigger(const std::chrono::seconds &timeLimit, std::atomic_bool &stopTrigger, const bool *stopPointer) override;
32 
33  protected:
40  Minisat::Var newVariable();
47  void addClause(const Minisat::vec<Minisat::Lit> &clause);
48 
52  virtual void createVariables() = 0;
56  virtual void createClauses() = 0;
57 
63  virtual std::unique_ptr<DFA<char>> toDFA(const Minisat::vec<Minisat::lbool> &model) const = 0;
64 
65  SATCNFMethod(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);
66 
67  private:
73  std::unique_ptr<Minisat::SimpSolver> m_solver;
74 
75  std::atomic_bool *mustStop;
76  };
77  }
78  }
79 }
The namespace of the library.
Definition: binary.h:11
void addClause(const Minisat::vec< Minisat::Lit > &clause)
Adds a new clause to the SAT solver.
std::unique_ptr< DFA< char > > constructDFA() override
Constructs the DFA induced by the variables according to the method.
virtual void createVariables()=0
Creates all needed variables for the method.
bool solve() override
Solves the SAT/SMT problem induced by the method.
The base class of all passive methods.
Definition: Method.h:40
Base class for every method that relies on a SAT solver.
Definition: SATCNFMethod.h:22
virtual std::unique_ptr< DFA< char > > toDFA(const Minisat::vec< Minisat::lbool > &model) const =0
Effectively creates the DFA from the values of the variables in the given model.
virtual void createClauses()=0
Creates all needed clauses for the method.
virtual void setStopTrigger(const std::chrono::seconds &timeLimit, std::atomic_bool &stopTrigger, const bool *stopPointer) override
Sets the stop trigger for this method.
Minisat::Var newVariable()
Creates a new variable in the SAT solver.