7 #include "MapleCOMSPS_LRB/utils/System.h" 13 SATNonCNFMethod::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) :
14 Method(SpSet, SmSet, SSet, prefixesSet, alphabetSet, n),
23 const std::string& in = getInputFile();
24 const std::string& out = getOutputFile();
25 std::ofstream output(in);
29 const char* argv[] = {
61 if (
m_Sp.size() == 0 ||
m_Sm.size() == 0) {
62 std::unique_ptr<DFA<char>> dfa = std::make_unique<DFA<char>>(0,
m_Sp.size() != 0);
64 dfa->addTransition(0, a, 0);
68 std::ifstream file(getOutputFile());
69 auto dfa =
toDFA(file);
81 std::ifstream file(getOutputFile());
83 std::getline(file, line);
84 if (line.find(
"UNSATISFIABLE") != std::string::npos) {
92 std::string SATNonCNFMethod::getInputFile()
const {
97 std::string SATNonCNFMethod::getOutputFile()
const {
98 return getInputFile() +
"-test";
const std::set< char > m_alphabet
The namespace of the library.
const std::set< std::string > m_Sm
The set of words to reject .
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.
bool hasSolution() const
If solve() has been called and if there exists a solution, return True.
virtual std::string getFileName() const =0
Gives the name of the file in which the boolean formula must be written.
const unsigned int m_numberStates
The number of states in the DFA to construct.
The base class of all passive methods.
virtual std::unique_ptr< DFA< char > > constructDFA() override
Constructs the DFA induced by the variables according to the method.
virtual ~SATNonCNFMethod()
const std::set< std::string > m_Sp
The set of words to accept .
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.