23 void print_results(
bool satisfiable,
const std::vector<bool> &modelValues)
26 printf(
"not satisfiable.\n\n");
28 printf(
"satisfiable:");
29 for (
auto val : modelValues)
30 printf(
" %d", val ? 1 : 0);
43 int pos_active = sat.
AND(sat.
NOT(
"A"), sat.
OR(sat.
NOT(
"B"), sat.
NOT(
"C")));
44 int neg_active = sat.
OR(
"A", sat.
AND(
"B",
"C"));
45 int impossible = sat.
IFF(pos_active, neg_active);
47 std::vector<int> modelVars;
48 std::vector<bool> modelValues;
51 modelVars.push_back(sat.
VAR(
"A"));
52 modelVars.push_back(sat.
VAR(
"B"));
53 modelVars.push_back(sat.
VAR(
"C"));
57 printf(
"pos_active: %s\n", sat.
to_string(pos_active).c_str());
58 satisfiable = sat.
solve(modelVars, modelValues, pos_active);
61 printf(
"neg_active: %s\n", sat.
to_string(neg_active).c_str());
62 satisfiable = sat.
solve(modelVars, modelValues, neg_active);
65 printf(
"impossible: %s\n", sat.
to_string(impossible).c_str());
66 satisfiable = sat.
solve(modelVars, modelValues, impossible);
void print_results(bool satisfiable, const std::vector< bool > &modelValues)
int AND(_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0)
std::string to_string(int id) const
bool solve(const std::vector< int > &modelExpressions, std::vector< bool > &modelValues, const std::vector< int > &assumptions)
int OR(_V a=0, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0)
int IFF(_V a, _V b=0, _V c=0, _V d=0, _V e=0, _V f=0)