Commit 72404d1f by Alan Mishchenko

Proof-logging in the updated solver.

parent bb96fa36
...@@ -71,8 +71,10 @@ extern void * sat_solver2_store_release( sat_solver2 * s ); ...@@ -71,8 +71,10 @@ extern void * sat_solver2_store_release( sat_solver2 * s );
extern int var_is_global (sat_solver2* s, int v); extern int var_is_global (sat_solver2* s, int v);
extern void var_set_global(sat_solver2* s, int v, int glo); extern void var_set_global(sat_solver2* s, int v, int glo);
// clause grouping (these two only work after creating a clause before the solver is called) // clause grouping (these two only work after creating a clause before the solver is called)
extern int clause_is_partA (sat_solver2* s, int cid); extern int clause_is_partA (sat_solver2* s, int handle);
extern void clause_set_partA(sat_solver2* s, int cid, int partA); extern void clause_set_partA(sat_solver2* s, int handle, int partA);
// other clause functions
extern int clause_id(sat_solver2* s, int h);
//================================================================================================= //=================================================================================================
...@@ -89,7 +91,7 @@ struct sat_solver2_t ...@@ -89,7 +91,7 @@ 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_assigns; // Number of top-level assignments at last 'simplifyDB()'.
int simpdb_props; // Number of propagations before next 'simplifyDB()'. int simpdb_props; // Number of propagations before next 'simplifyDB()'.
double random_seed; double random_seed;
double progress_estimate; double progress_estimate;
...@@ -101,7 +103,8 @@ struct sat_solver2_t ...@@ -101,7 +103,8 @@ struct sat_solver2_t
// clauses // clauses
veci clauses; // clause memory veci clauses; // clause memory
veci* wlists; // watcher lists (for each literal) veci* wlists; // watcher lists (for each literal)
int iFirstLearnt; // the first learnt clause int iLearntFirst; // the first learnt clause
int iLearntLast; // in proof-logging mode, the ID of the final conflict clause (conf_final)
// activities // activities
#ifdef USE_FLOAT_ACTIVITY #ifdef USE_FLOAT_ACTIVITY
...@@ -135,13 +138,13 @@ struct sat_solver2_t ...@@ -135,13 +138,13 @@ struct sat_solver2_t
// 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 mark_levels; // temporary storage for labeled levels
veci min_lit_order; // ordering of removable literals veci min_lit_order; // ordering of removable literals
veci min_step_order;// ordering of resolution steps veci min_step_order; // ordering of resolution steps
veci glob_vars; // global variables
// proof logging // proof logging
veci proof_clas; // sequence of proof clauses veci proof_clas; // sequence of proof clauses
veci proof_vars; // sequence of proof variables veci proof_vars; // sequence of proof variables
int iStartChain; // temporary variable to remember beginning of the current chain in proof logging int iStartChain; // temporary variable to remember beginning of the current chain in proof logging
int fLastConfId; // in proof-logging mode, the ID of the final conflict clause (conf_final)
int nUnits; // the total number of unit clauses int nUnits; // the total number of unit clauses
// statistics // statistics
...@@ -149,9 +152,38 @@ struct sat_solver2_t ...@@ -149,9 +152,38 @@ struct sat_solver2_t
ABC_INT64_T nConfLimit; // external limit on the number of conflicts ABC_INT64_T nConfLimit; // external limit on the number of conflicts
ABC_INT64_T nInsLimit; // external limit on the number of implications ABC_INT64_T nInsLimit; // external limit on the number of implications
int nRuntimeLimit; // external limit on runtime int nRuntimeLimit; // external limit on runtime
};
typedef struct satset_t satset;
struct satset_t
{
unsigned learnt : 1;
unsigned mark : 1;
unsigned partA : 1;
unsigned nEnts : 29;
int Id;
lit pEnts[0];
}; };
static inline satset* satset_read (veci* p, cla h ) { return h ? (satset*)(veci_begin(p) + h) : NULL; }
static inline cla satset_handle (veci* p, satset* c) { return (cla)((int *)c - veci_begin(p)); }
static inline int satset_check (veci* p, satset* c) { return (int*)c > veci_begin(p) && (int*)c < veci_begin(p) + veci_size(p); }
static inline int satset_size (int nLits) { return sizeof(satset)/4 + nLits; }
static inline void satset_print (satset * c) {
int i;
printf( "{ " );
for ( i = 0; i < (int)c->nEnts; i++ )
printf( "%d ", (c->pEnts[i] & 1)? -(c->pEnts[i] >> 1) : c->pEnts[i] >> 1 );
printf( "}\n" );
}
#define satset_foreach_entry( p, c, h, s ) \
for ( h = s; (h < veci_size(p)) && (((c) = satset_read(p, h)), 1); h += satset_size(c->nEnts) )
//=================================================================================================
// Public APIs:
static inline int sat_solver2_nvars(sat_solver2* s) static inline int sat_solver2_nvars(sat_solver2* s)
{ {
return s->size; return s->size;
...@@ -213,6 +245,8 @@ static inline int sat_solver2_set_random(sat_solver2* s, int fNotUseRandom) ...@@ -213,6 +245,8 @@ static inline int sat_solver2_set_random(sat_solver2* s, int fNotUseRandom)
return fNotUseRandomOld; return fNotUseRandomOld;
} }
extern void Sat_ProofTest( veci * pClauses, veci * pProof, veci * pVars, veci * pRoots, int hRoot, veci * pGlobVars );
ABC_NAMESPACE_HEADER_END ABC_NAMESPACE_HEADER_END
#endif #endif
...@@ -29,15 +29,15 @@ ABC_NAMESPACE_HEADER_START ...@@ -29,15 +29,15 @@ ABC_NAMESPACE_HEADER_START
// vector of 32-bit intergers (added for 64-bit portability) // vector of 32-bit intergers (added for 64-bit portability)
struct veci_t { struct veci_t {
int size;
int cap; int cap;
int size;
int* ptr; int* ptr;
}; };
typedef struct veci_t veci; typedef struct veci_t veci;
static inline void veci_new (veci* v) { static inline void veci_new (veci* v) {
v->size = 0;
v->cap = 4; v->cap = 4;
v->size = 0;
v->ptr = (int*)ABC_ALLOC( char, sizeof(int)*v->cap); v->ptr = (int*)ABC_ALLOC( char, sizeof(int)*v->cap);
} }
...@@ -68,8 +68,8 @@ static inline void veci_remove(veci* v, int e) ...@@ -68,8 +68,8 @@ static inline void veci_remove(veci* v, int e)
// vector of 32- or 64-bit pointers // vector of 32- or 64-bit pointers
struct vecp_t { struct vecp_t {
int size;
int cap; int cap;
int size;
void** ptr; void** ptr;
}; };
typedef struct vecp_t vecp; typedef struct vecp_t vecp;
......
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