static lbool core_chunking(sat::solver& s, sat::bool_var_vector& vars, sat::literal_vector const& asms, vector<sat::literal_vector>& conseq, unsigned K) { lbool r = s.check(asms.size(), asms.c_ptr()); if (r != l_true) { return r; } sat::model const & m = s.get_model(); sat::literal_vector lambda, backbones; for (unsigned i = 0; i < vars.size(); i++) { lambda.push_back(sat::literal(vars[i], m[vars[i]] == l_false)); } while (!lambda.empty()) { IF_VERBOSE(1, verbose_stream() << "(sat-backbone-core " << lambda.size() << " " << backbones.size() << ")\n";); unsigned k = std::min(K, lambda.size()); sat::literal_vector gamma, omegaN; for (unsigned i = 0; i < k; ++i) { sat::literal l = lambda[lambda.size() - i - 1]; gamma.push_back(l); omegaN.push_back(~l); } while (true) { sat::literal_vector asms1(asms); asms1.append(omegaN); r = s.check(asms1.size(), asms1.c_ptr()); if (r == l_true) { IF_VERBOSE(1, verbose_stream() << "(sat) " << omegaN << "\n";); prune_unfixed(lambda, s.get_model()); break; }
static void display_model(sat::solver const & s) { sat::model const & m = s.get_model(); for (unsigned i = 1; i < m.size(); i++) { switch (m[i]) { case l_false: std::cout << "-" << i << " "; break; case l_undef: break; case l_true: std::cout << i << " "; break; } } std::cout << "\n"; }