diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2006-09-16 08:01:00 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2006-09-16 08:01:00 -0700 |
commit | 370578bf1c4504b65f49ab63fcf7ed9c88a15d69 (patch) | |
tree | d8297df3e080f52c6526fd7ccded9dd4cc601f2d /src/sat/msat | |
parent | aab0c478e4c78c6856919fcd1027583ca148f3eb (diff) | |
download | abc-370578bf1c4504b65f49ab63fcf7ed9c88a15d69.tar.gz abc-370578bf1c4504b65f49ab63fcf7ed9c88a15d69.tar.bz2 abc-370578bf1c4504b65f49ab63fcf7ed9c88a15d69.zip |
Version abc60916
Diffstat (limited to 'src/sat/msat')
-rw-r--r-- | src/sat/msat/msat.h | 1 | ||||
-rw-r--r-- | src/sat/msat/msatActivity.c | 5 | ||||
-rw-r--r-- | src/sat/msat/msatInt.h | 2 | ||||
-rw-r--r-- | src/sat/msat/msatSolverApi.c | 16 | ||||
-rw-r--r-- | src/sat/msat/msatSolverSearch.c | 6 |
5 files changed, 21 insertions, 9 deletions
diff --git a/src/sat/msat/msat.h b/src/sat/msat/msat.h index 1d9c0005..53353ba6 100644 --- a/src/sat/msat/msat.h +++ b/src/sat/msat/msat.h @@ -104,6 +104,7 @@ extern void Msat_SolverSetVarTypeA( Msat_Solver_t * p, int Var ); extern void Msat_SolverSetVarMap( Msat_Solver_t * p, Msat_IntVec_t * vVarMap ); extern void Msat_SolverMarkLastClauseTypeA( Msat_Solver_t * p ); extern void Msat_SolverMarkClausesStart( Msat_Solver_t * p ); +extern float * Msat_SolverReadFactors( Msat_Solver_t * p ); // returns the solution after incremental solving extern int Msat_SolverReadSolutions( Msat_Solver_t * p ); extern int * Msat_SolverReadSolutionsArray( Msat_Solver_t * p ); diff --git a/src/sat/msat/msatActivity.c b/src/sat/msat/msatActivity.c index 23925669..1cd795bd 100644 --- a/src/sat/msat/msatActivity.c +++ b/src/sat/msat/msatActivity.c @@ -45,8 +45,9 @@ void Msat_SolverVarBumpActivity( Msat_Solver_t * p, Msat_Lit_t Lit ) if ( p->dVarDecay < 0 ) // (negative decay means static variable order -- don't bump) return; Var = MSAT_LIT2VAR(Lit); - if ( (p->pdActivity[Var] += p->dVarInc) > 1e100 ) -// if ( (p->pdActivity[Var] += p->dVarInc * (1.0 + 0.005*p->pActLevels[Var])) > 1e100 ) + p->pdActivity[Var] += p->dVarInc; +// p->pdActivity[Var] += p->dVarInc * p->pFactors[Var]; + if ( p->pdActivity[Var] > 1e100 ) Msat_SolverVarRescaleActivity( p ); Msat_OrderUpdate( p->pOrder, Var ); } diff --git a/src/sat/msat/msatInt.h b/src/sat/msat/msatInt.h index 7845ec0b..03903abe 100644 --- a/src/sat/msat/msatInt.h +++ b/src/sat/msat/msatInt.h @@ -119,7 +119,7 @@ struct Msat_Solver_t_ double dClaDecay; // INVERSE decay factor for clause activity: stores 1/decay. double * pdActivity; // A heuristic measurement of the activity of a variable. - int * pActLevels; // the levels of the variables + float * pFactors; // the multiplicative factors of variable activity double dVarInc; // Amount to bump next variable with. double dVarDecay; // INVERSE decay factor for variable activity: stores 1/decay. Use negative value for static variable order. Msat_Order_t * pOrder; // Keeps track of the decision variable order. diff --git a/src/sat/msat/msatSolverApi.c b/src/sat/msat/msatSolverApi.c index 9317dcac..ee3507a6 100644 --- a/src/sat/msat/msatSolverApi.c +++ b/src/sat/msat/msatSolverApi.c @@ -64,6 +64,7 @@ void Msat_SolverClausesIncrementL( Msat_Solver_t * p ) { void Msat_SolverClausesDecrementL( Msat_Solver_t * p ) { p->nClausesAllocL--; } void Msat_SolverMarkLastClauseTypeA( Msat_Solver_t * p ) { Msat_ClauseSetTypeA( Msat_ClauseVecReadEntry( p->vClauses, Msat_ClauseVecReadSize(p->vClauses)-1 ), 1 ); } void Msat_SolverMarkClausesStart( Msat_Solver_t * p ) { p->nClausesStart = Msat_ClauseVecReadSize(p->vClauses); } +float * Msat_SolverReadFactors( Msat_Solver_t * p ) { return p->pFactors; } /**Function************************************************************* @@ -174,11 +175,11 @@ Msat_Solver_t * Msat_SolverAlloc( int nVarsAlloc, p->dVarDecay = dVarDecay; p->pdActivity = ALLOC( double, p->nVarsAlloc ); - p->pActLevels = ALLOC( int, p->nVarsAlloc ); + p->pFactors = ALLOC( float, p->nVarsAlloc ); for ( i = 0; i < p->nVarsAlloc; i++ ) { - p->pdActivity[i] = 0; - p->pActLevels[i] = 0; + p->pdActivity[i] = 0.0; + p->pFactors[i] = 1.0; } p->pAssigns = ALLOC( int, p->nVarsAlloc ); @@ -243,9 +244,12 @@ void Msat_SolverResize( Msat_Solver_t * p, int nVarsAlloc ) p->nVarsAlloc = nVarsAlloc; p->pdActivity = REALLOC( double, p->pdActivity, p->nVarsAlloc ); - p->pActLevels = REALLOC( int, p->pActLevels, p->nVarsAlloc ); + p->pFactors = REALLOC( float, p->pFactors, p->nVarsAlloc ); for ( i = nVarsAllocOld; i < p->nVarsAlloc; i++ ) - p->pdActivity[i] = 0; + { + p->pdActivity[i] = 0.0; + p->pFactors[i] = 1.0; + } p->pAssigns = REALLOC( int, p->pAssigns, p->nVarsAlloc ); p->pModel = REALLOC( int, p->pModel, p->nVarsAlloc ); @@ -399,7 +403,7 @@ void Msat_SolverFree( Msat_Solver_t * p ) Msat_ClauseVecFree( p->vLearned ); FREE( p->pdActivity ); - FREE( p->pActLevels ); + FREE( p->pFactors ); Msat_OrderFree( p->pOrder ); for ( i = 0; i < 2 * p->nVarsAlloc; i++ ) diff --git a/src/sat/msat/msatSolverSearch.c b/src/sat/msat/msatSolverSearch.c index 4b73d6b3..11a6540c 100644 --- a/src/sat/msat/msatSolverSearch.c +++ b/src/sat/msat/msatSolverSearch.c @@ -534,12 +534,18 @@ Msat_Type_t Msat_SolverSearch( Msat_Solver_t * p, int nConfLimit, int nLearnedLi Msat_Clause_t * pConf; Msat_Var_t Var; int nLevelBack, nConfs, nAssigns, Value; + int i; assert( Msat_SolverReadDecisionLevel(p) == p->nLevelRoot ); p->Stats.nStarts++; p->dVarDecay = 1 / pPars->dVarDecay; p->dClaDecay = 1 / pPars->dClaDecay; + // reset the activities + for ( i = 0; i < p->nVars; i++ ) + p->pdActivity[i] = (double)p->pFactors[i]; +// p->pdActivity[i] = 0.0; + nConfs = 0; while ( 1 ) { |