Commit c265d244 by Alan Mishchenko

Added learned clause recycling to the SAT solver (may impact bmc2, bmc3, dsat, etc).

parent 685faae8
...@@ -1199,6 +1199,10 @@ SOURCE=.\src\sat\csat\csat_apis.h ...@@ -1199,6 +1199,10 @@ SOURCE=.\src\sat\csat\csat_apis.h
# PROP Default_Filter "" # PROP Default_Filter ""
# Begin Source File # Begin Source File
SOURCE=.\src\sat\bsat\satClause.h
# End Source File
# Begin Source File
SOURCE=.\src\sat\bsat\satInter.c SOURCE=.\src\sat\bsat\satInter.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -54,13 +54,13 @@ static inline void Aig_ManInterAddBuffer( sat_solver2 * pSat, int iVarA, int iVa ...@@ -54,13 +54,13 @@ static inline void Aig_ManInterAddBuffer( sat_solver2 * pSat, int iVarA, int iVa
Lits[1] = toLitCond( iVarB, !fCompl ); Lits[1] = toLitCond( iVarB, !fCompl );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVarA, 1 ); Lits[0] = toLitCond( iVarA, 1 );
Lits[1] = toLitCond( iVarB, fCompl ); Lits[1] = toLitCond( iVarB, fCompl );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -85,28 +85,28 @@ static inline void Aig_ManInterAddXor( sat_solver2 * pSat, int iVarA, int iVarB, ...@@ -85,28 +85,28 @@ static inline void Aig_ManInterAddXor( sat_solver2 * pSat, int iVarA, int iVarB,
Lits[2] = toLitCond( iVarC, 1 ); Lits[2] = toLitCond( iVarC, 1 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVarA, !fCompl ); Lits[0] = toLitCond( iVarA, !fCompl );
Lits[1] = toLitCond( iVarB, 0 ); Lits[1] = toLitCond( iVarB, 0 );
Lits[2] = toLitCond( iVarC, 0 ); Lits[2] = toLitCond( iVarC, 0 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVarA, fCompl ); Lits[0] = toLitCond( iVarA, fCompl );
Lits[1] = toLitCond( iVarB, 1 ); Lits[1] = toLitCond( iVarB, 1 );
Lits[2] = toLitCond( iVarC, 0 ); Lits[2] = toLitCond( iVarC, 0 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVarA, fCompl ); Lits[0] = toLitCond( iVarA, fCompl );
Lits[1] = toLitCond( iVarB, 0 ); Lits[1] = toLitCond( iVarB, 0 );
Lits[2] = toLitCond( iVarC, 1 ); Lits[2] = toLitCond( iVarC, 1 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -152,7 +152,7 @@ void Aig_ManInterTest( Aig_Man_t * pMan, int fVerbose ) ...@@ -152,7 +152,7 @@ void Aig_ManInterTest( Aig_Man_t * pMan, int fVerbose )
for ( i = 0; i < pCnf->nClauses; i++ ) for ( i = 0; i < pCnf->nClauses; i++ )
{ {
Cid = sat_solver2_addclause( pSat, pCnf->pClauses[i], pCnf->pClauses[i+1] ); Cid = sat_solver2_addclause( pSat, pCnf->pClauses[i], pCnf->pClauses[i+1] );
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
} }
// add clauses of B // add clauses of B
...@@ -283,7 +283,7 @@ Aig_Man_t * Aig_ManInterRepar( Aig_Man_t * pMan, int fVerbose ) ...@@ -283,7 +283,7 @@ Aig_Man_t * Aig_ManInterRepar( Aig_Man_t * pMan, int fVerbose )
for ( i = 0; i < pCnf->nClauses; i++ ) for ( i = 0; i < pCnf->nClauses; i++ )
{ {
Cid = sat_solver2_addclause( pSat, pCnf->pClauses[i], pCnf->pClauses[i+1] ); Cid = sat_solver2_addclause( pSat, pCnf->pClauses[i], pCnf->pClauses[i+1] );
clause_set_partA( pSat, Cid, k==0 ); clause2_set_partA( pSat, Cid, k==0 );
} }
// add equality p[k] == A1/B1 // add equality p[k] == A1/B1
Aig_ManForEachCo( pMan, pObj, i ) Aig_ManForEachCo( pMan, pObj, i )
...@@ -293,7 +293,7 @@ Aig_Man_t * Aig_ManInterRepar( Aig_Man_t * pMan, int fVerbose ) ...@@ -293,7 +293,7 @@ Aig_Man_t * Aig_ManInterRepar( Aig_Man_t * pMan, int fVerbose )
for ( i = 0; i < pCnf->nClauses; i++ ) for ( i = 0; i < pCnf->nClauses; i++ )
{ {
Cid = sat_solver2_addclause( pSat, pCnf->pClauses[i], pCnf->pClauses[i+1] ); Cid = sat_solver2_addclause( pSat, pCnf->pClauses[i], pCnf->pClauses[i+1] );
clause_set_partA( pSat, Cid, k==0 ); clause2_set_partA( pSat, Cid, k==0 );
} }
// add comparator (!p[k] ^ A2/B2) == or[k] // add comparator (!p[k] ^ A2/B2) == or[k]
Vec_IntClear( vVars ); Vec_IntClear( vVars );
...@@ -303,7 +303,7 @@ Aig_Man_t * Aig_ManInterRepar( Aig_Man_t * pMan, int fVerbose ) ...@@ -303,7 +303,7 @@ Aig_Man_t * Aig_ManInterRepar( Aig_Man_t * pMan, int fVerbose )
Vec_IntPush( vVars, toLitCond(ShiftOr[k] + i, 1) ); Vec_IntPush( vVars, toLitCond(ShiftOr[k] + i, 1) );
} }
Cid = sat_solver2_addclause( pSat, Vec_IntArray(vVars), Vec_IntArray(vVars) + Vec_IntSize(vVars) ); Cid = sat_solver2_addclause( pSat, Vec_IntArray(vVars), Vec_IntArray(vVars) + Vec_IntSize(vVars) );
clause_set_partA( pSat, Cid, k==0 ); clause2_set_partA( pSat, Cid, k==0 );
// return to normal // return to normal
Cnf_DataLift( pCnf, -ShiftCnf[k]-pCnf->nVars ); Cnf_DataLift( pCnf, -ShiftCnf[k]-pCnf->nVars );
} }
...@@ -362,7 +362,7 @@ Aig_Man_t * Aig_ManInterRepar( Aig_Man_t * pMan, int fVerbose ) ...@@ -362,7 +362,7 @@ Aig_Man_t * Aig_ManInterRepar( Aig_Man_t * pMan, int fVerbose )
for ( i = 0; i < pCnfInter->nClauses; i++ ) for ( i = 0; i < pCnfInter->nClauses; i++ )
{ {
Cid = sat_solver2_addclause( pSat, pCnfInter->pClauses[i], pCnfInter->pClauses[i+1] ); Cid = sat_solver2_addclause( pSat, pCnfInter->pClauses[i], pCnfInter->pClauses[i+1] );
clause_set_partA( pSat, Cid, c==0 ); clause2_set_partA( pSat, Cid, c==0 );
} }
// connect to the inputs // connect to the inputs
Aig_ManForEachCi( pInter, pObj, i ) Aig_ManForEachCi( pInter, pObj, i )
......
...@@ -210,10 +210,11 @@ static inline double Vec_ReportMemory( Vec_Set_t * p ) ...@@ -210,10 +210,11 @@ static inline double Vec_ReportMemory( Vec_Set_t * p )
***********************************************************************/ ***********************************************************************/
static inline int Vec_SetAppend( Vec_Set_t * p, int * pArray, int nSize ) static inline int Vec_SetAppend( Vec_Set_t * p, int * pArray, int nSize )
{ {
word * pPage = p->pPages[p->iPage];
int nWords = Vec_SetWordNum( nSize ); int nWords = Vec_SetWordNum( nSize );
assert( nWords < (1 << p->nPageSize) ); assert( nWords + 3 < (1 << p->nPageSize) );
p->nEntries++; // need two extra at the begining of the page and one extra in the end
if ( Vec_SetLimit( p->pPages[p->iPage] ) + nWords > (1 << p->nPageSize) ) if ( Vec_SetLimit(pPage) + nWords >= (1 << p->nPageSize) )
{ {
if ( ++p->iPage == p->nPagesAlloc ) if ( ++p->iPage == p->nPagesAlloc )
{ {
...@@ -223,12 +224,14 @@ static inline int Vec_SetAppend( Vec_Set_t * p, int * pArray, int nSize ) ...@@ -223,12 +224,14 @@ static inline int Vec_SetAppend( Vec_Set_t * p, int * pArray, int nSize )
} }
if ( p->pPages[p->iPage] == NULL ) if ( p->pPages[p->iPage] == NULL )
p->pPages[p->iPage] = ABC_ALLOC( word, (1 << p->nPageSize) ); p->pPages[p->iPage] = ABC_ALLOC( word, (1 << p->nPageSize) );
Vec_SetWriteLimit( p->pPages[p->iPage], 2 ); pPage = p->pPages[p->iPage];
p->pPages[p->iPage][1] = ~0; Vec_SetWriteLimit(pPage, 2);
pPage[1] = ~0;
} }
if ( pArray ) if ( pArray )
memcpy( p->pPages[p->iPage] + Vec_SetLimit(p->pPages[p->iPage]), pArray, sizeof(int) * nSize ); memcpy( pPage + Vec_SetLimit(pPage), pArray, sizeof(int) * nSize );
Vec_SetIncLimit( p->pPages[p->iPage], nWords ); p->nEntries++;
Vec_SetIncLimit( pPage, nWords );
return Vec_SetHandCurrent(p) - nWords; return Vec_SetHandCurrent(p) - nWords;
} }
static inline int Vec_SetAppendS( Vec_Set_t * p, int nSize ) static inline int Vec_SetAppendS( Vec_Set_t * p, int nSize )
......
...@@ -28,6 +28,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA ...@@ -28,6 +28,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include "satClause.h"
#include "satVec.h" #include "satVec.h"
#include "misc/vec/vecSet.h" #include "misc/vec/vecSet.h"
...@@ -79,8 +80,8 @@ extern void * sat_solver_store_release( sat_solver * s ); ...@@ -79,8 +80,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 varinfo_t; struct varinfo_t;
typedef struct varinfo_t varinfo; typedef struct varinfo_t varinfo;
...@@ -93,7 +94,7 @@ struct sat_solver_t ...@@ -93,7 +94,7 @@ struct sat_solver_t
int qtail; // Tail index of queue. int qtail; // Tail index of queue.
// clauses // clauses
Vec_Set_t Mem; Sat_Mem_t Mem;
int hLearnts; // the first learnt clause int hLearnts; // the first learnt clause
int hBinary; // the special binary clause int hBinary; // the special binary clause
clause * binary; clause * binary;
...@@ -137,8 +138,13 @@ struct sat_solver_t ...@@ -137,8 +138,13 @@ struct sat_solver_t
double random_seed; double random_seed;
double progress_estimate; double progress_estimate;
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 fVerbose;
stats_t stats; stats_t stats;
int nLearntMax; // max number of learned clauses
int nDBreduces; // number of DB reductions
// veci learned; // contain learnt clause handles
veci act_clas; // contain clause activities
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
...@@ -166,6 +172,11 @@ struct sat_solver_t ...@@ -166,6 +172,11 @@ struct sat_solver_t
veci temp_clause; // temporary storage for a CNF clause veci temp_clause; // temporary storage for a CNF clause
}; };
static inline clause * clause_read( sat_solver * s, cla h )
{
return Sat_MemClauseHand( &s->Mem, h );
}
static int sat_solver_var_value( sat_solver* s, int v ) static int sat_solver_var_value( sat_solver* s, int v )
{ {
assert( v >= 0 && v < s->size ); assert( v >= 0 && v < s->size );
......
...@@ -28,6 +28,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA ...@@ -28,6 +28,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include "satClause.h"
#include "satVec.h" #include "satVec.h"
#include "misc/vec/vecSet.h" #include "misc/vec/vecSet.h"
...@@ -63,10 +64,10 @@ extern void Sat_Solver2DoubleClauses( sat_solver2 * p, int iVar ); ...@@ -63,10 +64,10 @@ extern void Sat_Solver2DoubleClauses( sat_solver2 * p, int iVar );
extern int var_is_partA (sat_solver2* s, int v); extern int var_is_partA (sat_solver2* s, int v);
extern void var_set_partA(sat_solver2* s, int v, int partA); extern void var_set_partA(sat_solver2* s, int v, int partA);
// 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 handle); extern int clause2_is_partA (sat_solver2* s, int handle);
extern void clause_set_partA(sat_solver2* s, int handle, int partA); extern void clause2_set_partA(sat_solver2* s, int handle, int partA);
// other clause functions // other clause functions
extern int clause_id(sat_solver2* s, int h); extern int clause2_id(sat_solver2* s, int h);
// proof-based APIs // proof-based APIs
extern void * Sat_ProofCore( sat_solver2 * s ); extern void * Sat_ProofCore( sat_solver2 * s );
...@@ -274,7 +275,7 @@ static inline int sat_solver2_add_const( sat_solver2 * pSat, int iVar, int fComp ...@@ -274,7 +275,7 @@ static inline int sat_solver2_add_const( sat_solver2 * pSat, int iVar, int fComp
Lits[0] = toLitCond( iVar, fCompl ); Lits[0] = toLitCond( iVar, fCompl );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 1 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 1 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
return 1; return 1;
} }
static inline int sat_solver2_add_buffer( sat_solver2 * pSat, int iVarA, int iVarB, int fCompl, int fMark ) static inline int sat_solver2_add_buffer( sat_solver2 * pSat, int iVarA, int iVarB, int fCompl, int fMark )
...@@ -287,13 +288,13 @@ static inline int sat_solver2_add_buffer( sat_solver2 * pSat, int iVarA, int iVa ...@@ -287,13 +288,13 @@ static inline int sat_solver2_add_buffer( sat_solver2 * pSat, int iVarA, int iVa
Lits[1] = toLitCond( iVarB, !fCompl ); Lits[1] = toLitCond( iVarB, !fCompl );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVarA, 1 ); Lits[0] = toLitCond( iVarA, 1 );
Lits[1] = toLitCond( iVarB, fCompl ); Lits[1] = toLitCond( iVarB, fCompl );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
return 2; return 2;
} }
static inline int sat_solver2_add_and( sat_solver2 * pSat, int iVar, int iVar0, int iVar1, int fCompl0, int fCompl1, int fMark ) static inline int sat_solver2_add_and( sat_solver2 * pSat, int iVar, int iVar0, int iVar1, int fCompl0, int fCompl1, int fMark )
...@@ -305,20 +306,20 @@ static inline int sat_solver2_add_and( sat_solver2 * pSat, int iVar, int iVar0, ...@@ -305,20 +306,20 @@ static inline int sat_solver2_add_and( sat_solver2 * pSat, int iVar, int iVar0,
Lits[1] = toLitCond( iVar0, fCompl0 ); Lits[1] = toLitCond( iVar0, fCompl0 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVar, 1 ); Lits[0] = toLitCond( iVar, 1 );
Lits[1] = toLitCond( iVar1, fCompl1 ); Lits[1] = toLitCond( iVar1, fCompl1 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVar, 0 ); Lits[0] = toLitCond( iVar, 0 );
Lits[1] = toLitCond( iVar0, !fCompl0 ); Lits[1] = toLitCond( iVar0, !fCompl0 );
Lits[2] = toLitCond( iVar1, !fCompl1 ); Lits[2] = toLitCond( iVar1, !fCompl1 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
return 3; return 3;
} }
static inline int sat_solver2_add_xor( sat_solver2 * pSat, int iVarA, int iVarB, int iVarC, int fCompl, int fMark ) static inline int sat_solver2_add_xor( sat_solver2 * pSat, int iVarA, int iVarB, int iVarC, int fCompl, int fMark )
...@@ -332,28 +333,28 @@ static inline int sat_solver2_add_xor( sat_solver2 * pSat, int iVarA, int iVarB, ...@@ -332,28 +333,28 @@ static inline int sat_solver2_add_xor( sat_solver2 * pSat, int iVarA, int iVarB,
Lits[2] = toLitCond( iVarC, 1 ); Lits[2] = toLitCond( iVarC, 1 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVarA, !fCompl ); Lits[0] = toLitCond( iVarA, !fCompl );
Lits[1] = toLitCond( iVarB, 0 ); Lits[1] = toLitCond( iVarB, 0 );
Lits[2] = toLitCond( iVarC, 0 ); Lits[2] = toLitCond( iVarC, 0 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVarA, fCompl ); Lits[0] = toLitCond( iVarA, fCompl );
Lits[1] = toLitCond( iVarB, 1 ); Lits[1] = toLitCond( iVarB, 1 );
Lits[2] = toLitCond( iVarC, 0 ); Lits[2] = toLitCond( iVarC, 0 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVarA, fCompl ); Lits[0] = toLitCond( iVarA, fCompl );
Lits[1] = toLitCond( iVarB, 0 ); Lits[1] = toLitCond( iVarB, 0 );
Lits[2] = toLitCond( iVarC, 1 ); Lits[2] = toLitCond( iVarC, 1 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 3 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
return 4; return 4;
} }
static inline int sat_solver2_add_constraint( sat_solver2 * pSat, int iVar, int iVar2, int fCompl, int fMark ) static inline int sat_solver2_add_constraint( sat_solver2 * pSat, int iVar, int iVar2, int fCompl, int fMark )
...@@ -366,13 +367,13 @@ static inline int sat_solver2_add_constraint( sat_solver2 * pSat, int iVar, int ...@@ -366,13 +367,13 @@ static inline int sat_solver2_add_constraint( sat_solver2 * pSat, int iVar, int
Lits[1] = toLitCond( iVar2, 0 ); Lits[1] = toLitCond( iVar2, 0 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
Lits[0] = toLitCond( iVar, fCompl ); Lits[0] = toLitCond( iVar, fCompl );
Lits[1] = toLitCond( iVar2, 1 ); Lits[1] = toLitCond( iVar2, 1 );
Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 ); Cid = sat_solver2_addclause( pSat, Lits, Lits + 2 );
if ( fMark ) if ( fMark )
clause_set_partA( pSat, Cid, 1 ); clause2_set_partA( pSat, Cid, 1 );
return 2; return 2;
} }
......
...@@ -30,14 +30,18 @@ ABC_NAMESPACE_IMPL_START ...@@ -30,14 +30,18 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS /// /// DECLARATIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/*
struct clause_t struct clause_t
{ {
int size_learnt; unsigned size : 24;
unsigned lbd : 6;
unsigned leant : 1;
unsigned mark : 1;
lit lits[0]; lit lits[0];
}; };
static inline int clause_size( clause* c ) { return c->size; }
static inline int clause_size( clause* c ) { return c->size_learnt >> 1; }
static inline lit* clause_begin( clause* c ) { return c->lits; } static inline lit* clause_begin( clause* c ) { return c->lits; }
*/
static void Sat_SolverClauseWriteDimacs( FILE * pFile, clause * pC, int fIncrement ); static void Sat_SolverClauseWriteDimacs( FILE * pFile, clause * pC, int fIncrement );
...@@ -127,6 +131,7 @@ void Sat_SolverWriteDimacs( sat_solver * p, char * pFileName, lit* assumptionsBe ...@@ -127,6 +131,7 @@ void Sat_SolverWriteDimacs( sat_solver * p, char * pFileName, lit* assumptionsBe
***********************************************************************/ ***********************************************************************/
void Sat_SolverClauseWriteDimacs( FILE * pFile, clause * pC, int fIncrement ) void Sat_SolverClauseWriteDimacs( FILE * pFile, clause * pC, int fIncrement )
{ {
/*
lit * pLits = clause_begin(pC); lit * pLits = clause_begin(pC);
int nLits = clause_size(pC); int nLits = clause_size(pC);
int i; int i;
...@@ -136,6 +141,7 @@ void Sat_SolverClauseWriteDimacs( FILE * pFile, clause * pC, int fIncrement ) ...@@ -136,6 +141,7 @@ void Sat_SolverClauseWriteDimacs( FILE * pFile, clause * pC, int fIncrement )
if ( fIncrement ) if ( fIncrement )
fprintf( pFile, "0" ); fprintf( pFile, "0" );
fprintf( pFile, "\n" ); fprintf( pFile, "\n" );
*/
} }
/**Function************************************************************* /**Function*************************************************************
......
...@@ -127,8 +127,6 @@ static inline void vecp_remove(vecp* v, void* e) ...@@ -127,8 +127,6 @@ static inline void vecp_remove(vecp* v, void* e)
#endif #endif
#endif #endif
typedef int lit;
typedef int cla;
typedef char lbool; typedef char lbool;
static const int var_Undef = -1; static const int var_Undef = -1;
......
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