16 HeuleVerwerCNFMethod::HeuleVerwerCNFMethod(
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) :
17 SATCNFMethod(SpSet, SmSet, SSet, prefixesSet, alphabetSet, n)
33 auto pair = std::make_pair(u, q);
43 auto trip = std::make_tuple(p, a, q);
66 clause[0] = mkLit(
m_dVars.find(std::make_tuple(p, a, q))->second,
true);
67 clause[1] = mkLit(
m_dVars.find(std::make_tuple(p, a, r))->second,
true);
79 clause.growTo(m_numberStates);
82 clause[q] = mkLit(
m_xVars.find(std::make_pair(u, q))->second,
false);
92 for (
const auto &ua : m_prefixes) {
94 const std::string &u = ua.substr(0, ua.size() - 1);
95 const char &a = ua.at(ua.size() - 1);
99 clause[0] = mkLit(
m_xVars.find(std::make_pair(u, p))->second,
true);
100 clause[1] = mkLit(
m_dVars.find(std::make_tuple(p, a, q))->second,
true);
101 clause[2] = mkLit(
m_xVars.find(std::make_pair(ua, q))->second,
false);
116 for (
const auto &u :
m_Sp) {
117 clause[0] = mkLit(
m_xVars.find(std::make_pair(u, q))->second,
true);
118 clause[1] = mkLit(
m_fVars.find(q)->second,
false);
122 for (
const auto &u :
m_Sm) {
123 clause[0] = mkLit(
m_xVars.find(std::make_pair(u, q))->second,
true);
124 clause[1] = mkLit(
m_fVars.find(q)->second,
true);
133 clause.growTo(m_numberStates);
137 clause[q] = mkLit(
m_dVars.find(std::make_tuple(p, a, q))->second,
false);
149 for (
const auto &u : m_prefixes) {
153 clause[0] = mkLit(
m_xVars.find(std::make_pair(u, p))->second,
true);
154 clause[1] = mkLit(
m_xVars.find(std::make_pair(u, q))->second,
true);
166 for (
const auto &ua : m_prefixes) {
168 const std::string &u = ua.substr(0, ua.size() - 1);
169 const char &a = ua.at(ua.size() - 1);
173 clause[0] = mkLit(
m_xVars.find(std::make_pair(u, p))->second,
true);
174 clause[1] = mkLit(
m_xVars.find(std::make_pair(ua, q))->second,
true);
175 clause[2] = mkLit(
m_dVars.find(std::make_tuple(p, a, q))->second,
false);
185 unsigned int initial = 0;
187 Var v =
m_xVars.find(std::make_pair(
"", i))->second;
188 if (model[v] == l_True) {
195 std::unique_ptr<DFA<char>> dfa = std::make_unique<DFA<char>>(initial, model[
m_fVars.find(initial)->second] == l_True);
200 dfa->addState(q, model[
m_fVars.find(q)->second] == l_True);
208 if (model[
m_dVars.find(std::make_tuple(p, a, q))->second] == l_True) {
209 dfa->addTransition(p, a, q);
const std::set< char > m_alphabet
std::map< unsigned int, Minisat::Var > m_fVars
The namespace of the library.
void createVariables() override
Creates all needed variables for the method.
void addClause(const Minisat::vec< Minisat::Lit > &clause)
Adds a new clause to the SAT solver.
const std::set< std::string > m_Sm
The set of words to reject .
std::map< std::tuple< unsigned int, char, unsigned int >, Minisat::Var > m_dVars
const std::set< std::string > m_prefixes
This file declares the Heule and Verwer method that relies on CNF SAT solver.
static std::string getFactoryName()
static bool s_registered
Useful to make sure the template is correctly used by the compiler.
std::unique_ptr< DFA< char > > toDFA(const Minisat::vec< Minisat::lbool > &model) const override
Effectively creates the DFA from the values of the variables in the given model.
std::map< std::pair< std::string, unsigned int >, Minisat::Var > m_xVars
const unsigned int m_numberStates
The number of states in the DFA to construct.
Base class for every method that relies on a SAT solver.
const std::set< std::string > m_Sp
The set of words to accept .
void createClauses() override
Creates all needed clauses for the method.
Minisat::Var newVariable()
Creates a new variable in the SAT solver.