Commit a40c13a9 by Alan Mishchenko

Recording and reusing learned util clauses in bmc2.

parent 2379dea4
...@@ -207,7 +207,7 @@ void Rnm_ManCollect_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vObjs, int ...@@ -207,7 +207,7 @@ void Rnm_ManCollect_rec( Gia_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vObjs, int
} }
void Rnm_ManCollect( Rnm_Man_t * p ) void Rnm_ManCollect( Rnm_Man_t * p )
{ {
Gia_Obj_t * pObj; Gia_Obj_t * pObj = NULL;
int i; int i;
// mark const/PIs/PPIs // mark const/PIs/PPIs
Gia_ManIncrementTravId( p->pGia ); Gia_ManIncrementTravId( p->pGia );
......
...@@ -1461,6 +1461,8 @@ unsigned * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj ) ...@@ -1461,6 +1461,8 @@ unsigned * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj )
pTruth = Gla_ObjTruthElem( p, Gia_ObjCioId(pRoot) ); pTruth = Gla_ObjTruthElem( p, Gia_ObjCioId(pRoot) );
else if ( Gia_ObjIsAnd(pRoot) ) else if ( Gia_ObjIsAnd(pRoot) )
pTruth = Gla_ObjTruthNode( p, pRoot ); pTruth = Gla_ObjTruthNode( p, pRoot );
else
pTruth = NULL;
return (unsigned *)Gla_ObjTruthDup( p, Gla_ObjTruthFree2(p), pTruth, Gia_ObjIsCo(pObj) && Gia_ObjFaninC0(pObj) ); return (unsigned *)Gla_ObjTruthDup( p, Gla_ObjTruthFree2(p), pTruth, Gia_ObjIsCo(pObj) && Gia_ObjFaninC0(pObj) );
} }
......
...@@ -671,7 +671,7 @@ Abc_Cex_t * Saig_BmcGenerateCounterExample( Saig_Bmc_t * p ) ...@@ -671,7 +671,7 @@ Abc_Cex_t * Saig_BmcGenerateCounterExample( Saig_Bmc_t * p )
int Saig_BmcSolveTargets( Saig_Bmc_t * p, int nStart, int * pnOutsSolved ) int Saig_BmcSolveTargets( Saig_Bmc_t * p, int nStart, int * pnOutsSolved )
{ {
Aig_Obj_t * pObj; Aig_Obj_t * pObj;
int i, VarNum, Lit, RetValue; int i, k, VarNum, Lit, status, RetValue;
assert( Vec_PtrSize(p->vTargets) > 0 ); assert( Vec_PtrSize(p->vTargets) > 0 );
if ( p->pSat->qtail != p->pSat->qhead ) if ( p->pSat->qtail != p->pSat->qhead )
{ {
...@@ -688,7 +688,23 @@ int Saig_BmcSolveTargets( Saig_Bmc_t * p, int nStart, int * pnOutsSolved ) ...@@ -688,7 +688,23 @@ int Saig_BmcSolveTargets( Saig_Bmc_t * p, int nStart, int * pnOutsSolved )
Lit = toLitCond( VarNum, Aig_IsComplement(pObj) ); Lit = toLitCond( VarNum, Aig_IsComplement(pObj) );
RetValue = sat_solver_solve( p->pSat, &Lit, &Lit + 1, (ABC_INT64_T)p->nConfMaxOne, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 ); RetValue = sat_solver_solve( p->pSat, &Lit, &Lit + 1, (ABC_INT64_T)p->nConfMaxOne, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
if ( RetValue == l_False ) // unsat if ( RetValue == l_False ) // unsat
{
// add final unit clause
Lit = lit_neg( Lit );
status = sat_solver_addclause( p->pSat, &Lit, &Lit + 1 );
assert( status );
// add learned units
for ( k = 0; k < veci_size(&p->pSat->unit_lits); k++ )
{
Lit = veci_begin(&p->pSat->unit_lits)[k];
status = sat_solver_addclause( p->pSat, &Lit, &Lit + 1 );
assert( status );
}
veci_resize(&p->pSat->unit_lits, 0);
// propagate units
sat_solver_compress( p->pSat );
continue; continue;
}
if ( RetValue == l_Undef ) // undecided if ( RetValue == l_Undef ) // undecided
return l_Undef; return l_Undef;
// generate counter-example // generate counter-example
......
...@@ -2402,7 +2402,7 @@ void Extra_NpnTest() ...@@ -2402,7 +2402,7 @@ void Extra_NpnTest()
clock_t clk = clock(); clock_t clk = clock();
word * pFuncs; word * pFuncs;
int * pComp, * pPerm; int * pComp, * pPerm;
int i, k, nUnique = 0; int i;//, k, nUnique = 0;
/* /*
// read functions // read functions
pFuncs = Extra_NpnRead( "C:\\_projects\\abc\\_TEST\\allan\\lib6var5M.txt", nFuncs ); pFuncs = Extra_NpnRead( "C:\\_projects\\abc\\_TEST\\allan\\lib6var5M.txt", nFuncs );
......
...@@ -1526,6 +1526,7 @@ int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit ...@@ -1526,6 +1526,7 @@ int sat_solver_solve(sat_solver* s, lit* begin, lit* end, ABC_INT64_T nConfLimit
return l_False; return l_False;
} }
//////////////////////////////////////////////// ////////////////////////////////////////////////
veci_resize(&s->unit_lits, 0);
// set the external limits // set the external limits
s->nCalls++; s->nCalls++;
......
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