Commit 5df166fc by Alan Mishchenko

Changing dynamic CNF loading code to perform loading before propagate() as…

Changing dynamic CNF loading code to perform loading before propagate() as opposed to when the literal first implied in enqueue().
parent 105648bf
...@@ -478,6 +478,7 @@ static inline int sat_solver_enqueue(sat_solver* s, lit l, int from) ...@@ -478,6 +478,7 @@ static inline int sat_solver_enqueue(sat_solver* s, lit l, int from)
if (var_value(s, v) != varX) if (var_value(s, v) != varX)
return var_value(s, v) == lit_sign(l); return var_value(s, v) == lit_sign(l);
else{ else{
/*
if ( s->pCnfFunc ) if ( s->pCnfFunc )
{ {
if ( lit_sign(l) ) if ( lit_sign(l) )
...@@ -497,6 +498,7 @@ static inline int sat_solver_enqueue(sat_solver* s, lit l, int from) ...@@ -497,6 +498,7 @@ static inline int sat_solver_enqueue(sat_solver* s, lit l, int from)
} }
} }
} }
*/
// New fact -- store it. // New fact -- store it.
#ifdef VERBOSEDEBUG #ifdef VERBOSEDEBUG
printf(L_IND"bind("L_LIT")\n", L_ind, L_lit(l)); printf(L_IND"bind("L_LIT")\n", L_ind, L_lit(l));
...@@ -876,6 +878,7 @@ static void sat_solver_analyze(sat_solver* s, int h, veci* learnt) ...@@ -876,6 +878,7 @@ static void sat_solver_analyze(sat_solver* s, int h, veci* learnt)
#endif #endif
} }
//#define TEST_CNF_LOAD
int sat_solver_propagate(sat_solver* s) int sat_solver_propagate(sat_solver* s)
{ {
...@@ -886,6 +889,31 @@ int sat_solver_propagate(sat_solver* s) ...@@ -886,6 +889,31 @@ int sat_solver_propagate(sat_solver* s)
//printf("sat_solver_propagate\n"); //printf("sat_solver_propagate\n");
while (hConfl == 0 && s->qtail - s->qhead > 0){ while (hConfl == 0 && s->qtail - s->qhead > 0){
lit p = s->trail[s->qhead++]; lit p = s->trail[s->qhead++];
int v = lit_var(p);
#ifdef TEST_CNF_LOAD
if ( s->pCnfFunc )
{
if ( lit_sign(p) )
{
if ( (s->loads[v] & 1) == 0 )
{
s->loads[v] ^= 1;
s->pCnfFunc( s->pCnfMan, p );
}
}
else
{
if ( (s->loads[v] & 2) == 0 )
{
s->loads[v] ^= 2;
s->pCnfFunc( s->pCnfMan, p );
}
}
}
{
#endif
veci* ws = sat_solver_read_wlist(s,p); veci* ws = sat_solver_read_wlist(s,p);
int* begin = veci_begin(ws); int* begin = veci_begin(ws);
int* end = begin + veci_size(ws); int* end = begin + veci_size(ws);
...@@ -959,6 +987,9 @@ int sat_solver_propagate(sat_solver* s) ...@@ -959,6 +987,9 @@ int sat_solver_propagate(sat_solver* s)
s->stats.inspects += j - veci_begin(ws); s->stats.inspects += j - veci_begin(ws);
veci_resize(ws,j - veci_begin(ws)); veci_resize(ws,j - veci_begin(ws));
#ifdef TEST_CNF_LOAD
}
#endif
} }
return hConfl; return hConfl;
......
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