Commit 309ab1c1 by Alan Mishchenko

Variable timeframe abstraction.

parent d81aa6d6
...@@ -654,7 +654,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f ) ...@@ -654,7 +654,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
int i, Counter; int i, Counter;
// Vta_ManSatVerify( p ); Vta_ManSatVerify( p );
// collect nodes in a topological order // collect nodes in a topological order
vOrder = Vta_ManCollectNodes( p, f ); vOrder = Vta_ManCollectNodes( p, f );
...@@ -664,7 +664,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f ) ...@@ -664,7 +664,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
pThis->Value = sat_solver2_var_value(p->pSat, Vta_ObjId(p, pThis)) ? VTA_VAR1 : VTA_VAR0; pThis->Value = sat_solver2_var_value(p->pSat, Vta_ObjId(p, pThis)) ? VTA_VAR1 : VTA_VAR0;
pThis->fVisit = 0; pThis->fVisit = 0;
} }
/*
// verify // verify
Vta_ManForEachObjObjVec( vOrder, p, pThis, pObj, i ) Vta_ManForEachObjObjVec( vOrder, p, pThis, pObj, i )
{ {
...@@ -691,7 +691,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f ) ...@@ -691,7 +691,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
else assert( 0 ); else assert( 0 );
} }
} }
*/
// compute distance in reverse order // compute distance in reverse order
pThis = Vta_ManObj( p, Vec_IntEntryLast(vOrder) ); pThis = Vta_ManObj( p, Vec_IntEntryLast(vOrder) );
pThis->Prio = 1; pThis->Prio = 1;
...@@ -883,7 +883,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f ) ...@@ -883,7 +883,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
assert( 0 ); assert( 0 );
} }
/*
// verify // verify
Vta_ManForEachObjVec( vOrder, p, pThis, i ) Vta_ManForEachObjVec( vOrder, p, pThis, i )
pThis->Value = VTA_VARX; pThis->Value = VTA_VARX;
...@@ -948,7 +948,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f ) ...@@ -948,7 +948,7 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
printf( "Vta_ManRefineAbstraction(): Terminary simulation verification failed!\n" ); printf( "Vta_ManRefineAbstraction(): Terminary simulation verification failed!\n" );
// else // else
// printf( "Verification OK.\n" ); // printf( "Verification OK.\n" );
*/
// produce true counter-example // produce true counter-example
if ( pTop->Prio == 0 ) if ( pTop->Prio == 0 )
......
...@@ -498,35 +498,55 @@ static inline int solver2_assume(sat_solver2* s, lit l) ...@@ -498,35 +498,55 @@ static inline int solver2_assume(sat_solver2* s, lit l)
} }
static void solver2_canceluntil(sat_solver2* s, int level) { static void solver2_canceluntil(sat_solver2* s, int level) {
lit* trail;
int bound; int bound;
int lastLev; int lastLev;
int c, x; int c, x;
if (solver2_dlevel(s) < level) if (solver2_dlevel(s) <= level)
return; return;
assert( solver2_dlevel(s) > 0 );
trail = s->trail;
bound = (veci_begin(&s->trail_lim))[level]; bound = (veci_begin(&s->trail_lim))[level];
lastLev = (veci_begin(&s->trail_lim))[veci_size(&s->trail_lim)-1]; lastLev = (veci_begin(&s->trail_lim))[veci_size(&s->trail_lim)-1];
for (c = s->qtail-1; c >= bound; c--) for (c = s->qtail-1; c >= bound; c--)
{ {
x = lit_var(trail[c]); x = lit_var(s->trail[c]);
var_set_value(s, x, varX); var_set_value(s, x, varX);
s->reasons[x] = 0; s->reasons[x] = 0;
s->units[x] = 0; // temporary? s->units[x] = 0; // temporary?
if ( c < lastLev ) if ( c < lastLev )
var_set_polar(s, x, !lit_sign(trail[c])); var_set_polar(s, x, !lit_sign(s->trail[c]));
} }
for (c = s->qhead-1; c >= bound; c--) for (c = s->qhead-1; c >= bound; c--)
order_unassigned(s,lit_var(trail[c])); order_unassigned(s,lit_var(s->trail[c]));
s->qhead = s->qtail = bound; s->qhead = s->qtail = bound;
veci_resize(&s->trail_lim,level); veci_resize(&s->trail_lim,level);
} }
static void solver2_canceluntil_rollback(sat_solver2* s, int NewBound) {
int c, x;
assert( solver2_dlevel(s) == 0 );
assert( s->qtail == s->qhead );
assert( s->qtail >= NewBound );
for (c = s->qtail-1; c >= NewBound; c--)
{
x = lit_var(s->trail[c]);
var_set_value(s, x, varX);
s->reasons[x] = 0;
s->units[x] = 0; // temporary?
}
for (c = s->qhead-1; c >= NewBound; c--)
order_unassigned(s,lit_var(s->trail[c]));
s->qhead = s->qtail = NewBound;
}
static void solver2_record(sat_solver2* s, veci* cls, int proof_id) static void solver2_record(sat_solver2* s, veci* cls, int proof_id)
{ {
...@@ -1513,9 +1533,8 @@ void sat_solver2_rollback( sat_solver2* s ) ...@@ -1513,9 +1533,8 @@ void sat_solver2_rollback( sat_solver2* s )
} }
} }
// reset implication queue // reset implication queue
assert( (&s->trail_lim)->ptr[0] >= s->iSimpPivot ); assert( solver2_dlevel(s) == 0 );
(&s->trail_lim)->ptr[0] = s->iSimpPivot; solver2_canceluntil_rollback( s, s->iSimpPivot );
solver2_canceluntil( s, 0 );
// reset problem clauses // reset problem clauses
if ( s->hClausePivot < veci_size(&s->clauses) ) if ( s->hClausePivot < veci_size(&s->clauses) )
{ {
......
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