示例#1
0
 int*    s_contr (solver* s)
 {
     delete [] s->contr;
     s->contr = new int[s->conflict.size()+1];
     for (int i = 0; i < s->conflict.size(); i++)
         s->contr[i] = toDimacs(s->conflict[i]);
     s->contr[s->conflict.size()] = 0;
     return s->contr;
 }
示例#2
0
void SimpSMTSolver::toDimacs(const char* file)
{
  assert(decisionLevel() == 0);
  FILE* f = fopen(file, "wr");
  if (f != NULL){

    // Cannot use removeClauses here because it is not safe
    // to deallocate them at this point. Could be improved.
    int cnt = 0;
    for (int i = 0; i < clauses.size(); i++)
      if (!satisfied(*clauses[i]))
	cnt++;

    fprintf(f, "p cnf %d %d\n", nVars(), cnt);

    for (int i = 0; i < clauses.size(); i++)
      toDimacs(f, *clauses[i]);

    fprintf(stderr, "Wrote %d clauses...\n", clauses.size());
  }else
    fprintf(stderr, "could not open file %s\n", file);
}
示例#3
0
 int     s_newlit (solver* s) { return toDimacs(s->mkLit()); }
示例#4
0
 // reading the value of a predicate (location)
 int solver_lit_read     (solver* w) { 
     // creates variables if they don't exists!! (fix?)
     int lit = toDimacs(Lit(w->loc->get(*w, w->args, w->dummy), !w->sig));
     return lit; 
 }
示例#5
0
 void    s_add           (solver* s, int a, int b, int c, int* carry, int* sum){
     Lit _carry, _sum;
     s->mkAdd(fromDimacs(a), fromDimacs(b), fromDimacs(c),_carry,_sum);
     *carry = toDimacs(_carry);
     *sum   = toDimacs(_sum);
 }
示例#6
0
 int     s_ite           (solver* s, int c, int t, int f) { return toDimacs(s->mkIte(fromDimacs(c), fromDimacs(t), fromDimacs(f))); }
示例#7
0
 int     s_xor           (solver* s, int x, int y) { return toDimacs(s->mkXor(fromDimacs(x), fromDimacs(y))); }
示例#8
0
 int     s_equ           (solver* s, int x, int y) { return toDimacs(s->mkEqu(fromDimacs(x), fromDimacs(y))); }
示例#9
0
 int     s_and           (solver* s, int x, int y) { return toDimacs(s->mkAnd(fromDimacs(x), fromDimacs(y))); }