Commit ce0e8caf by Alan Mishchenko

Variable timeframe abstraction.

parent c7e85561
...@@ -308,7 +308,7 @@ int Aig_Gla3CreateSatSolver( Aig_Gla3Man_t * p ) ...@@ -308,7 +308,7 @@ int Aig_Gla3CreateSatSolver( Aig_Gla3Man_t * p )
Vec_IntPush( p->vCla2Fra, 0 ); Vec_IntPush( p->vCla2Fra, 0 );
assert( Vec_IntSize(p->vCla2Fra) == Vec_IntSize(p->vCla2Obj) ); assert( Vec_IntSize(p->vCla2Fra) == Vec_IntSize(p->vCla2Obj) );
assert( nVars == Vec_IntSize(p->vVar2Inf) ); assert( nVars == Vec_IntSize(p->vVar2Inf) );
assert( Vec_IntSize(p->vCla2Obj) == (int)p->pSat->stats.clauses ); assert( Vec_IntSize(p->vCla2Obj) == (int)p->pSat->stats.clauses+1 );
if ( p->fVerbose ) if ( p->fVerbose )
printf( "The resulting SAT problem contains %d variables and %d clauses.\n", printf( "The resulting SAT problem contains %d variables and %d clauses.\n",
p->pSat->size, p->pSat->stats.clauses ); p->pSat->size, p->pSat->stats.clauses );
...@@ -337,8 +337,8 @@ Aig_Gla3Man_t * Aig_Gla3ManStart( Aig_Man_t * pAig, int nStart, int nFramesMax, ...@@ -337,8 +337,8 @@ Aig_Gla3Man_t * Aig_Gla3ManStart( Aig_Man_t * pAig, int nStart, int nFramesMax,
p->vObj2Vec = Vec_IntStart( Aig_ManObjNumMax(pAig) ); p->vObj2Vec = Vec_IntStart( Aig_ManObjNumMax(pAig) );
p->vVec2Var = Vec_IntAlloc( 1 << 20 ); p->vVec2Var = Vec_IntAlloc( 1 << 20 );
p->vVar2Inf = Vec_IntAlloc( 1 << 20 ); p->vVar2Inf = Vec_IntAlloc( 1 << 20 );
p->vCla2Obj = Vec_IntAlloc( 1 << 20 ); p->vCla2Obj = Vec_IntAlloc( 1 << 20 ); Vec_IntPush( p->vCla2Obj, -1 );
p->vCla2Fra = Vec_IntAlloc( 1 << 20 ); p->vCla2Fra = Vec_IntAlloc( 1 << 20 ); Vec_IntPush( p->vCla2Fra, -1 );
// skip first vector ID // skip first vector ID
p->nStart = nStart; p->nStart = nStart;
......
...@@ -26234,7 +26234,7 @@ int Abc_CommandAbc9GlaCba( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -26234,7 +26234,7 @@ int Abc_CommandAbc9GlaCba( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( 1, "The number of frames should be a positive integer.\n" ); Abc_Print( 1, "The number of frames should be a positive integer.\n" );
return 0; return 0;
} }
if ( pPars->nStart > 0 && pPars->nStart >= pPars->nFramesMax ) if ( pPars->nStart > 0 && pPars->nFramesMax > 0 && pPars->nStart >= pPars->nFramesMax )
{ {
Abc_Print( 1, "The starting frame is larger than the max number of frames.\n" ); Abc_Print( 1, "The starting frame is larger than the max number of frames.\n" );
return 0; return 0;
......
...@@ -447,9 +447,13 @@ void Sat_ProofCheck( sat_solver2 * s ) ...@@ -447,9 +447,13 @@ void Sat_ProofCheck( sat_solver2 * s )
Vec_Int_t * vUsed, * vTemp; Vec_Int_t * vUsed, * vTemp;
satset * pSet, * pSet0, * pSet1; satset * pSet, * pSet0, * pSet1;
int i, k, hRoot, Handle, Counter = 0, clk = clock(); int i, k, hRoot, Handle, Counter = 0, clk = clock();
if ( s->hLearntLast < 0 ) // if ( s->hLearntLast < 0 )
// return;
// hRoot = veci_begin(&s->claProofs)[satset_read(&s->learnts, s->hLearntLast>>1)->Id];
hRoot = s->hProofLast;
if ( hRoot == -1 )
return; return;
hRoot = veci_begin(&s->claProofs)[satset_read(&s->learnts, s->hLearntLast>>1)->Id];
// collect visited clauses // collect visited clauses
vUsed = Proof_CollectUsedIter( vProof, NULL, hRoot ); vUsed = Proof_CollectUsedIter( vProof, NULL, hRoot );
Proof_CleanCollected( vProof, vUsed ); Proof_CleanCollected( vProof, vUsed );
...@@ -490,7 +494,7 @@ void Sat_ProofCheck( sat_solver2 * s ) ...@@ -490,7 +494,7 @@ void Sat_ProofCheck( sat_solver2 * s )
Synopsis [Collects nodes belonging to the UNSAT core.] Synopsis [Collects nodes belonging to the UNSAT core.]
Description [The resulting array contains 0-based IDs of root clauses.] Description [The resulting array contains 1-based IDs of root clauses.]
SideEffects [] SideEffects []
...@@ -518,7 +522,8 @@ Vec_Int_t * Sat_ProofCollectCore( Vec_Int_t * vClauses, Vec_Int_t * vProof, Vec_ ...@@ -518,7 +522,8 @@ Vec_Int_t * Sat_ProofCollectCore( Vec_Int_t * vClauses, Vec_Int_t * vProof, Vec_
{ {
pNode->mark = 0; pNode->mark = 0;
if ( fUseIds ) if ( fUseIds )
Vec_IntWriteEntry( vCore, i, pNode->Id - 1 ); // Vec_IntWriteEntry( vCore, i, pNode->Id - 1 );
Vec_IntWriteEntry( vCore, i, pNode->Id );
} }
return vCore; return vCore;
} }
...@@ -592,9 +597,12 @@ void * Sat_ProofInterpolant( sat_solver2 * s, void * pGloVars ) ...@@ -592,9 +597,12 @@ void * Sat_ProofInterpolant( sat_solver2 * s, void * pGloVars )
Aig_Man_t * pAig; Aig_Man_t * pAig;
Aig_Obj_t * pObj; Aig_Obj_t * pObj;
int i, k, iVar, Lit, Entry, hRoot; int i, k, iVar, Lit, Entry, hRoot;
if ( s->hLearntLast < 0 ) // if ( s->hLearntLast < 0 )
// return NULL;
// hRoot = veci_begin(&s->claProofs)[satset_read(&s->learnts, s->hLearntLast>>1)->Id];
hRoot = s->hProofLast;
if ( hRoot == -1 )
return NULL; return NULL;
hRoot = veci_begin(&s->claProofs)[satset_read(&s->learnts, s->hLearntLast>>1)->Id];
Sat_ProofInterpolantCheckVars( s, vGlobVars ); Sat_ProofInterpolantCheckVars( s, vGlobVars );
...@@ -693,9 +701,12 @@ word * Sat_ProofInterpolantTruth( sat_solver2 * s, void * pGloVars ) ...@@ -693,9 +701,12 @@ word * Sat_ProofInterpolantTruth( sat_solver2 * s, void * pGloVars )
word * pRes = ABC_ALLOC( word, nWords ); word * pRes = ABC_ALLOC( word, nWords );
int i, k, iVar, Lit, Entry, hRoot; int i, k, iVar, Lit, Entry, hRoot;
assert( nVars > 0 && nVars <= 16 ); assert( nVars > 0 && nVars <= 16 );
if ( s->hLearntLast < 0 ) // if ( s->hLearntLast < 0 )
// return NULL;
// hRoot = veci_begin(&s->claProofs)[satset_read(&s->learnts, s->hLearntLast>>1)->Id];
hRoot = s->hProofLast;
if ( hRoot == -1 )
return NULL; return NULL;
hRoot = veci_begin(&s->claProofs)[satset_read(&s->learnts, s->hLearntLast>>1)->Id];
Sat_ProofInterpolantCheckVars( s, vGlobVars ); Sat_ProofInterpolantCheckVars( s, vGlobVars );
...@@ -794,9 +805,13 @@ void * Sat_ProofCore( sat_solver2 * s ) ...@@ -794,9 +805,13 @@ void * Sat_ProofCore( sat_solver2 * s )
Vec_Int_t * vProof = (Vec_Int_t *)&s->proofs; Vec_Int_t * vProof = (Vec_Int_t *)&s->proofs;
Vec_Int_t * vCore, * vUsed; Vec_Int_t * vCore, * vUsed;
int hRoot; int hRoot;
if ( s->hLearntLast < 0 ) // if ( s->hLearntLast < 0 )
// return NULL;
// hRoot = veci_begin(&s->claProofs)[satset_read(&s->learnts, s->hLearntLast>>1)->Id];
hRoot = s->hProofLast;
if ( hRoot == -1 )
return NULL; return NULL;
hRoot = veci_begin(&s->claProofs)[satset_read(&s->learnts, s->hLearntLast>>1)->Id];
// collect visited clauses // collect visited clauses
vUsed = Proof_CollectUsedIter( vProof, NULL, hRoot ); vUsed = Proof_CollectUsedIter( vProof, NULL, hRoot );
// collect core clauses // collect core clauses
......
...@@ -85,8 +85,6 @@ struct sat_solver2_t ...@@ -85,8 +85,6 @@ struct sat_solver2_t
int qtail; // Tail index of queue. int qtail; // Tail index of queue.
int root_level; // Level of first proper decision. int root_level; // Level of first proper decision.
int simpdb_assigns; // Number of top-level assignments at last 'simplifyDB()'.
int simpdb_props; // Number of propagations before next 'simplifyDB()'.
double random_seed; double random_seed;
double progress_estimate; double progress_estimate;
int verbosity; // Verbosity level. 0=silent, 1=some progress report, 2=everything // activities int verbosity; // Verbosity level. 0=silent, 1=some progress report, 2=everything // activities
...@@ -111,9 +109,10 @@ struct sat_solver2_t ...@@ -111,9 +109,10 @@ struct sat_solver2_t
veci clauses; // clause memory veci clauses; // clause memory
veci learnts; // learnt memory veci learnts; // learnt memory
veci* wlists; // watcher lists (for each literal) veci* wlists; // watcher lists (for each literal)
int hLearntLast; // in proof-logging mode, the ID of the final conflict clause (conf_final)
int hProofLast; // in proof-logging mode, the ID of the final conflict clause (conf_final)
int hClausePivot; // the pivot among problem clause int hClausePivot; // the pivot among problem clause
int hLearntPivot; // the pivot among learned clause int hLearntPivot; // the pivot among learned clause
int hLearntLast; // in proof-logging mode, the ID of the final conflict clause (conf_final)
int iVarPivot; // the pivot among the variables int iVarPivot; // the pivot among the variables
int iSimpPivot; // marker of unit-clauses int iSimpPivot; // marker of unit-clauses
...@@ -247,10 +246,11 @@ static inline int sat_solver2_set_random(sat_solver2* s, int fNotUseRandom) ...@@ -247,10 +246,11 @@ static inline int sat_solver2_set_random(sat_solver2* s, int fNotUseRandom)
static inline void sat_solver2_bookmark(sat_solver2* s) static inline void sat_solver2_bookmark(sat_solver2* s)
{ {
assert( s->qhead == s->qtail );
s->hLearntPivot = veci_size(&s->learnts); s->hLearntPivot = veci_size(&s->learnts);
s->hClausePivot = veci_size(&s->clauses); s->hClausePivot = veci_size(&s->clauses);
s->iVarPivot = s->size; s->iVarPivot = s->size;
s->iSimpPivot = s->simpdb_assigns; s->iSimpPivot = s->qhead;
} }
static inline int sat_solver2_add_const( sat_solver2 * pSat, int iVar, int fCompl, int fMark ) static inline int sat_solver2_add_const( sat_solver2 * pSat, int iVar, int fCompl, int fMark )
......
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