Commit 8de7383e by Alan Mishchenko

Restructing sat_solver_solve() method for pushing/popping assumptions.

parent b4bb88ae
...@@ -48,6 +48,10 @@ extern int sat_solver_addclause(sat_solver* s, lit* begin, lit* end); ...@@ -48,6 +48,10 @@ extern int sat_solver_addclause(sat_solver* s, lit* begin, lit* end);
extern int sat_solver_clause_new(sat_solver* s, lit* begin, lit* end, int learnt); extern int sat_solver_clause_new(sat_solver* s, lit* begin, lit* end, int learnt);
extern int sat_solver_simplify(sat_solver* s); extern int sat_solver_simplify(sat_solver* s);
extern int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal); extern int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal);
extern int sat_solver_solve_internal(sat_solver* s);
extern int sat_solver_push(sat_solver* s, int p);
extern void sat_solver_pop(sat_solver* s);
extern void sat_solver_set_resource_limits(sat_solver* s, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal);
extern void sat_solver_restart( sat_solver* s ); extern void sat_solver_restart( sat_solver* s );
extern void sat_solver_rollback( sat_solver* s ); extern void sat_solver_rollback( sat_solver* s );
...@@ -223,12 +227,27 @@ static void sat_solver_compress(sat_solver* s) ...@@ -223,12 +227,27 @@ static void sat_solver_compress(sat_solver* s)
(void) RetValue; (void) RetValue;
} }
} }
static void sat_solver_clean_polarity(sat_solver* s, int * pVars, int nVars ) static void sat_solver_clean_polarity(sat_solver* s, int * pVars, int nVars )
{ {
int i; int i;
for ( i = 0; i < nVars; i++ ) for ( i = 0; i < nVars; i++ )
s->polarity[pVars[i]] = 0; s->polarity[pVars[i]] = 0;
} }
static void sat_solver_set_polarity(sat_solver* s, int * pVars, int nVars )
{
int i;
for ( i = 0; i < s->size; i++ )
s->polarity[i] = 0;
for ( i = 0; i < nVars; i++ )
s->polarity[pVars[i]] = 1;
}
static void sat_solver_set_literal_polarity(sat_solver* s, int * pLits, int nLits )
{
int i;
for ( i = 0; i < nLits; i++ )
s->polarity[Abc_Lit2Var(pLits[i])] = !Abc_LitIsCompl(pLits[i]);
}
static int sat_solver_final(sat_solver* s, int ** ppArray) static int sat_solver_final(sat_solver* s, int ** ppArray)
{ {
...@@ -279,14 +298,6 @@ static inline int sat_solver_count_usedvars(sat_solver* s) ...@@ -279,14 +298,6 @@ static inline int sat_solver_count_usedvars(sat_solver* s)
} }
return nVars; return nVars;
} }
static void sat_solver_set_polarity(sat_solver* s, int * pVars, int nVars )
{
int i;
for ( i = 0; i < s->size; i++ )
s->polarity[i] = 0;
for ( i = 0; i < nVars; i++ )
s->polarity[pVars[i]] = 1;
}
static inline int sat_solver_add_const( sat_solver * pSat, int iVar, int fCompl ) static inline int sat_solver_add_const( sat_solver * pSat, int iVar, int fCompl )
{ {
......
...@@ -192,7 +192,6 @@ static inline double Sat_Wrd2Dbl( word w ) { return (double)(unsigned)(w&0x3FFF ...@@ -192,7 +192,6 @@ static inline double Sat_Wrd2Dbl( word w ) { return (double)(unsigned)(w&0x3FFF
void Sat_SolverPrintStats( FILE * pFile, sat_solver * p ) void Sat_SolverPrintStats( FILE * pFile, sat_solver * p )
{ {
// printf( "calls : %10d (%d)\n", (int)p->nCalls, (int)p->nCalls2 );
printf( "starts : %16.0f\n", Sat_Wrd2Dbl(p->stats.starts) ); printf( "starts : %16.0f\n", Sat_Wrd2Dbl(p->stats.starts) );
printf( "conflicts : %16.0f\n", Sat_Wrd2Dbl(p->stats.conflicts) ); printf( "conflicts : %16.0f\n", Sat_Wrd2Dbl(p->stats.conflicts) );
printf( "decisions : %16.0f\n", Sat_Wrd2Dbl(p->stats.decisions) ); printf( "decisions : %16.0f\n", Sat_Wrd2Dbl(p->stats.decisions) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment