130 if ( vMapped && fPreorder )
149 aArea = pCutBest->
Cost;
154 if ( vMapped && !fPreorder )
246 int i, c, iClaBeg, iClaEnd, * pLit;
257 for ( c = iClaBeg; c < iClaEnd; c++ )
258 for ( pLit = p->
pClauses[c]+1; pLit < p->pClauses[c+1]; pLit++ )
264 for ( c = iClaBeg; c < iClaEnd; c++ )
265 for ( pLit = p->
pClauses[c]+1; pLit < p->pClauses[c+1]; pLit++ )
267 pPres[c] = (
unsigned char)( (unsigned)pPres[c] | (pPols0[
Abc_Lit2Var(*pLit)] << (2*(pLit-p->
pClauses[c]-1))) );
269 pPres[c] = (
unsigned char)( (
unsigned)pPres[c] | (pPols1[
Abc_Lit2Var(*pLit)] << (2*(pLit-p->
pClauses[c]-1))) );
271 for ( c = iClaBeg; c < iClaEnd; c++ )
272 for ( pLit = p->
pClauses[c]+1; pLit < p->pClauses[c+1]; pLit++ )
306 int MaxLine = 1000000;
307 int Var, Lit, nVars = -1, nClas = -1, i, Entry, iLine = 0;
311 char * pBuffer, * pToken;
312 FILE * pFile = fopen( pFileName,
"rb" );
315 printf(
"Cannot open file \"%s\" for writing.\n", pFileName );
319 while ( fgets(pBuffer, MaxLine, pFile) != NULL )
322 if ( pBuffer[0] ==
'c' )
324 if ( pBuffer[0] ==
'p' )
326 pToken =
strtok( pBuffer+1,
" \t" );
327 if (
strcmp(pToken,
"cnf") )
329 printf(
"Incorrect input file.\n" );
332 pToken =
strtok( NULL,
" \t" );
333 nVars = atoi( pToken );
334 pToken =
strtok( NULL,
" \t" );
335 nClas = atoi( pToken );
336 if ( nVars <= 0 || nClas <= 0 )
338 printf(
"Incorrect parameters.\n" );
346 pToken =
strtok( pBuffer,
" \t\r\n" );
347 if ( pToken == NULL )
352 Var = atoi( pToken );
356 if ( Lit >= 2*nVars )
358 printf(
"Literal %d is out-of-bound for %d variables.\n", Lit, nVars );
362 pToken =
strtok( NULL,
" \t\r\n" );
366 printf(
"There is no zero-terminator in line %d.\n", iLine );
372 printf(
"Warning! The number of clauses (%d) is different from declaration (%d).\n",
Vec_IntSize(vClas), nClas );
407 int status, RetValue = -1;
412 printf(
"CNF stats: Vars = %6d. Clauses = %7d. Literals = %8d. ", pCnf->
nVars, pCnf->
nClauses, pCnf->
nLiterals );
420 printf(
"The problem is trivially UNSAT.\n" );
426 status =
sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfLimit, 0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
429 else if ( status ==
l_True )
438 if ( RetValue == -1 )
440 else if ( RetValue == 0 )
unsigned char * Cnf_DataDeriveLitPolarities(Cnf_Dat_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
int Aig_ObjCollectSuper(Aig_Obj_t *pObj, Vec_Ptr_t *vSuper)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
static int Cnf_CutSopCost(Cnf_Man_t *p, Dar_Cut_t *pCut)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
void sat_solver_delete(sat_solver *s)
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
static int Abc_Var2Lit(int Var, int fCompl)
ABC_NAMESPACE_IMPL_START int Aig_ManScanMapping_rec(Cnf_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vMapped)
DECLARATIONS ///.
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define Aig_ManForEachCo(p, pObj, i)
#define ABC_ALLOC(type, num)
static abctime Abc_Clock()
static int Vec_PtrSize(Vec_Ptr_t *p)
int Cnf_DataSolveFromFile(char *pFileName, int nConfLimit, int fVerbose)
static void Abc_PrintTime(int level, const char *pStr, abctime time)
static int Aig_ManCoNum(Aig_Man_t *p)
Vec_Int_t * Cnf_DataCollectCiSatNums(Cnf_Dat_t *pCnf, Aig_Man_t *p)
static int Abc_LitIsCompl(int Lit)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Aig_ManCiNum(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_END
Vec_Int_t * Cnf_DataCollectCoSatNums(Cnf_Dat_t *pCnf, Aig_Man_t *p)
#define Cnf_CutForEachLeaf(p, pCut, pLeaf, i)
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Vec_Ptr_t * Aig_ManScanMapping(Cnf_Man_t *p, int fCollect)
static void Vec_IntFreeP(Vec_Int_t **p)
static void Abc_Print(int level, const char *format,...)
static Dar_Cut_t * Dar_ObjBestCut(Aig_Obj_t *pObj)
static int Aig_ManObjNumMax(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static int Vec_IntSize(Vec_Int_t *p)
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
#define Aig_ManForEachObj(p, pObj, i)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
int Cnf_ManScanMapping_rec(Cnf_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vMapped, int fPreorder)
#define Dar_CutForEachLeaf(p, pCut, pLeaf, i)
Vec_Ptr_t * Cnf_ManScanMapping(Cnf_Man_t *p, int fCollect, int fPreorder)
static int Abc_Lit2Var(int Lit)
#define ABC_CALLOC(type, num)
void Cnf_DataFree(Cnf_Dat_t *p)
void Sat_SolverPrintStats(FILE *pFile, sat_solver *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Cnf_Man_t_ Cnf_Man_t
INCLUDES ///.
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static int Aig_ObjIsAnd(Aig_Obj_t *pObj)
Cnf_Dat_t * Cnf_DataReadFromFile(char *pFileName)
static void Vec_PtrFree(Vec_Ptr_t *p)