Exemplo n.º 1
0
void MiniSolver::AddClause(std::initializer_list<VarId> list) {
  Minisat::vec<Minisat::Lit> v;
  for (int i = 0; i < contexts_.size(); i++)
    v.push(~contexts_[i]);
  for (auto var : list)
    v.push(Minisat::mkLit(abs(var) - 1, var > 0));
  minisat_.addClause(v);
}
Exemplo n.º 2
0
void MinisatSatSolver::toMinisatClause(SatClause& clause,
                                           Minisat::vec<Minisat::Lit>& minisat_clause) {
  for (unsigned i = 0; i < clause.size(); ++i) {
    minisat_clause.push(toMinisatLit(clause[i]));
  }
  Assert(clause.size() == (unsigned)minisat_clause.size());
}
Exemplo n.º 3
0
void convert(const bvt &bv, Minisat::vec<Minisat::Lit> &dest)
{
  dest.capacity(bv.size());

  forall_literals(it, bv)
    if(!it->is_false())
      dest.push(Minisat::mkLit(it->var_no(), it->sign()));
}
Exemplo n.º 4
0
  bool
  CryptoMinisat::addClause(const vec_literals& ps) // Add a clause to the solver.
  {
    // Cryptominisat uses a slightly different vec class.
    // Cryptominisat uses a slightly different Lit class too.

    // VERY SLOW>
    MINISAT::vec<MINISAT::Lit>  v;
    for (int i =0; i<ps.size();i++)
      v.push(MINISAT::Lit(var(ps[i]), sign(ps[i])));

    return s->addClause(v);
  }