Commit 09d3e1ff by Alan Mishchenko

Proof-logging in the updated solver.

parent a7031bb3
...@@ -105,8 +105,8 @@ int Fra_FraigSat( Aig_Man_t * pMan, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimi ...@@ -105,8 +105,8 @@ int Fra_FraigSat( Aig_Man_t * pMan, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimi
// simplify the problem // simplify the problem
clk = clock(); clk = clock();
status = sat_solver2_simplify(pSat); status = sat_solver2_simplify(pSat);
printf( "Simplified the problem to %d variables and %d clauses. ", sat_solver2_nvars(pSat), sat_solver2_nclauses(pSat) ); // printf( "Simplified the problem to %d variables and %d clauses. ", sat_solver2_nvars(pSat), sat_solver2_nclauses(pSat) );
ABC_PRT( "Time", clock() - clk ); // ABC_PRT( "Time", clock() - clk );
if ( status == 0 ) if ( status == 0 )
{ {
Vec_IntFree( vCiIds ); Vec_IntFree( vCiIds );
......
...@@ -113,8 +113,8 @@ extern void * sat_solver_store_release( sat_solver * s ); ...@@ -113,8 +113,8 @@ extern void * sat_solver_store_release( sat_solver * s );
//================================================================================================= //=================================================================================================
// Solver representation: // Solver representation:
//struct clause_t; struct clause_t;
//typedef struct clause_t clause; typedef struct clause_t clause;
struct sat_solver_t struct sat_solver_t
{ {
......
...@@ -32,7 +32,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA ...@@ -32,7 +32,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
ABC_NAMESPACE_HEADER_START ABC_NAMESPACE_HEADER_START
//#define USE_FLOAT_ACTIVITY
//================================================================================================= //=================================================================================================
// Public interface: // Public interface:
...@@ -70,9 +70,6 @@ extern void * sat_solver2_store_release( sat_solver2 * s ); ...@@ -70,9 +70,6 @@ extern void * sat_solver2_store_release( sat_solver2 * s );
//================================================================================================= //=================================================================================================
// Solver representation: // Solver representation:
//struct clause_t;
//typedef struct clause_t clause;
struct varinfo_t; struct varinfo_t;
typedef struct varinfo_t varinfo; typedef struct varinfo_t varinfo;
...@@ -91,21 +88,26 @@ struct sat_solver2_t ...@@ -91,21 +88,26 @@ struct sat_solver2_t
int verbosity; // Verbosity level. 0=silent, 1=some progress report, 2=everything int verbosity; // Verbosity level. 0=silent, 1=some progress report, 2=everything
int fNotUseRandom; // do not allow random decisions with a fixed probability int fNotUseRandom; // do not allow random decisions with a fixed probability
// int fSkipSimplify; // set to one to skip simplification of the clause database // int fSkipSimplify; // set to one to skip simplification of the clause database
int fProofLogging; // enable proof-logging
// clauses // clauses
veci clauses; // clause memory
veci* wlists; // watcher lists (for each literal)
int iLearnt; // the first learnt clause int iLearnt; // the first learnt clause
int iLast; // the last learnt clause int iLast; // the last learnt clause
veci* wlists; // watcher lists (for each literal)
// clause memory
int * pMemArray;
int nMemAlloc;
int nMemSize;
// activities // activities
#ifdef USE_FLOAT_ACTIVITY
double var_inc; // Amount to bump next variable with.
double var_decay; // INVERSE decay factor for variable activity: stores 1/decay.
float cla_inc; // Amount to bump next clause with.
float cla_decay; // INVERSE decay factor for clause activity: stores 1/decay.
double* activity; // A heuristic measurement of the activity of a variable.
#else
int var_inc; // Amount to bump next variable with. int var_inc; // Amount to bump next variable with.
int cla_inc; // Amount to bump next clause with. int cla_inc; // Amount to bump next clause with.
unsigned* activity; // A heuristic measurement of the activity of a variable. unsigned* activity; // A heuristic measurement of the activity of a variable.
#endif
veci claActs; // clause activities veci claActs; // clause activities
veci claProofs; // clause proofs veci claProofs; // clause proofs
...@@ -123,6 +125,15 @@ struct sat_solver2_t ...@@ -123,6 +125,15 @@ struct sat_solver2_t
veci model; // If problem is solved, this vector contains the model (contains: lbool). veci model; // If problem is solved, this vector contains the model (contains: lbool).
veci conf_final; // If problem is unsatisfiable (possibly under assumptions), veci conf_final; // If problem is unsatisfiable (possibly under assumptions),
// this vector represent the final conflict clause expressed in the assumptions. // this vector represent the final conflict clause expressed in the assumptions.
veci mark_levels; // temporary storage for labeled levels
veci min_lit_order; // ordering of removable literals
veci min_step_order;// ordering of resolution steps
// proof logging
veci proof_clas; // sequence of proof clauses
veci proof_vars; // sequence of proof variables
int iStartChain; // beginning of the chain
// statistics // statistics
stats_t stats; stats_t stats;
ABC_INT64_T nConfLimit; // external limit on the number of conflicts ABC_INT64_T nConfLimit; // external limit on the number of conflicts
......
...@@ -169,16 +169,15 @@ void Sat_SolverPrintStats( FILE * pFile, sat_solver * p ) ...@@ -169,16 +169,15 @@ void Sat_SolverPrintStats( FILE * pFile, sat_solver * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Sat_Solver2PrintStats( FILE * pFile, sat_solver2 * p ) void Sat_Solver2PrintStats( FILE * pFile, sat_solver2 * s )
{ {
// printf( "calls : %10d (%d)\n", (int)p->nCalls, (int)p->nCalls2 ); printf( "starts : %10d\n", (int)s->stats.starts );
printf( "starts : %10d\n", (int)p->stats.starts ); printf( "conflicts : %10d\n", (int)s->stats.conflicts );
printf( "conflicts : %10d\n", (int)p->stats.conflicts ); printf( "decisions : %10d\n", (int)s->stats.decisions );
printf( "decisions : %10d\n", (int)p->stats.decisions ); printf( "propagations : %10d\n", (int)s->stats.propagations );
printf( "propagations : %10d\n", (int)p->stats.propagations ); // printf( "inspects : %10d\n", (int)s->stats.inspects );
// printf( "inspects : %10d\n", (int)p->stats.inspects ); // printf( "inspects2 : %10d\n", (int)s->stats.inspects2 );
// printf( "inspects2 : %10d\n", (int)p->stats.inspects2 ); printf( "memory : %10d\n", veci_size(&s->clauses) );
printf( "memory : %10d\n", p->nMemSize );
} }
/**Function************************************************************* /**Function*************************************************************
......
...@@ -44,7 +44,8 @@ static inline void veci_new (veci* v) { ...@@ -44,7 +44,8 @@ static inline void veci_new (veci* v) {
static inline void veci_delete (veci* v) { ABC_FREE(v->ptr); } static inline void veci_delete (veci* v) { ABC_FREE(v->ptr); }
static inline int* veci_begin (veci* v) { return v->ptr; } static inline int* veci_begin (veci* v) { return v->ptr; }
static inline int veci_size (veci* v) { return v->size; } static inline int veci_size (veci* v) { return v->size; }
static inline void veci_resize (veci* v, int k) { v->size = k; } // only safe to shrink !! static inline void veci_resize (veci* v, int k) { assert(k <= v->size); v->size = k; } // only safe to shrink !!
static inline int veci_pop (veci* v) { assert(v->size); return v->ptr[--v->size]; }
static inline void veci_push (veci* v, int e) static inline void veci_push (veci* v, int e)
{ {
if (v->size == v->cap) { if (v->size == v->cap) {
...@@ -82,7 +83,7 @@ static inline void vecp_new (vecp* v) { ...@@ -82,7 +83,7 @@ static inline void vecp_new (vecp* v) {
static inline void vecp_delete (vecp* v) { ABC_FREE(v->ptr); } static inline void vecp_delete (vecp* v) { ABC_FREE(v->ptr); }
static inline void** vecp_begin (vecp* v) { return v->ptr; } static inline void** vecp_begin (vecp* v) { return v->ptr; }
static inline int vecp_size (vecp* v) { return v->size; } static inline int vecp_size (vecp* v) { return v->size; }
static inline void vecp_resize (vecp* v, int k) { v->size = k; } // only safe to shrink !! static inline void vecp_resize (vecp* v, int k) { assert(k <= v->size); v->size = k; } // only safe to shrink !!
static inline void vecp_push (vecp* v, void* e) static inline void vecp_push (vecp* v, void* e)
{ {
if (v->size == v->cap) { if (v->size == v->cap) {
...@@ -143,9 +144,6 @@ struct stats_t ...@@ -143,9 +144,6 @@ struct stats_t
}; };
typedef struct stats_t stats_t; typedef struct stats_t stats_t;
struct clause_t;
typedef struct clause_t clause;
ABC_NAMESPACE_HEADER_END ABC_NAMESPACE_HEADER_END
#endif #endif
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