73 int i, iLit, iParVarBeg, Iter;
74 int nSolutions = 0, RetValue = 0;
82 for ( Iter = 1 ; ; Iter++ )
84 int status =
sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfLimit, 0, 0, 0 );
85 if ( status ==
l_False ) { RetValue = 1;
break; }
86 if ( status ==
l_Undef ) { RetValue = 0;
break; }
94 printf(
"%5d : ", Iter );
101 { RetValue = 1;
break; }
102 if ( nTimeOut && (
Abc_Clock() - clkStart)/CLOCKS_PER_SEC >= nTimeOut ) { RetValue = 0;
break; }
106 if ( nTimeOut && (
Abc_Clock() - clkStart)/CLOCKS_PER_SEC >= nTimeOut )
107 printf(
"Enumerated %d assignments when timeout (%d sec) was reached. ", nSolutions, nTimeOut );
108 else if ( nConfLimit && !RetValue )
109 printf(
"Enumerated %d assignments when conflict limit (%d) was reached. ", nSolutions, nConfLimit );
111 printf(
"Enumerated the complete set of %d assignments. ", nSolutions );
132 Vec_Int_t * vVarMap, * vForAlls, * vExists;
156 printf(
"The 2QBF formula was written into file \"%s\".\n", pFileName );
182 p->fVerbose = fVerbose;
224 for ( i = 0; i < nPars; i++ )
226 for ( m = 0; m < nMints; m++ )
229 pObj->
Value = (i < nPars) ? Gia_Obj2Lit(pNew, Gia_ManPi(pNew, i)) : ((m >> (i - nPars)) & 1);
286 for ( i = 0; i < pCnf->
nClauses; i++ )
315 for ( i = 0; i < p->nPars; i++ )
320 printf(
"%5d : ", Iter );
342 int i, Entry, RetValue;
351 for ( i = 0; i < p->nVars; i++ )
354 return RetValue ==
l_True ? 1 : 0;
370 int i, status, Lits[2];
371 for ( i = 0; i < 4*11; i++ )
383 int i, status, Entry, Lits[2];
385 printf(
" Pattern " );
392 printf(
" Var =%4d ", i );
423 int i, status, RetValue = 0;
427 printf(
"Solving QBF for \"%s\" with %d parameters, %d variables and %d AIG nodes.\n",
438 if ( status == 0 ) { RetValue = 1;
break; }
441 status =
sat_solver_solve( p->pSatSyn, NULL, NULL, (ABC_INT64_T)nConfLimit, 0, 0, 0 );
445 if ( status ==
l_False ) { RetValue = 1;
break; }
446 if ( status ==
l_Undef ) { RetValue = -1;
break; }
453 if ( nIterLimit && i+1 == nIterLimit ) { RetValue = -1;
break; }
454 if ( nTimeOut && (
Abc_Clock() - p->clkStart)/CLOCKS_PER_SEC >= nTimeOut ) { RetValue = -1;
break; }
458 printf(
"Parameters: " );
463 if ( RetValue == -1 && nTimeOut && (
Abc_Clock() - p->clkStart)/CLOCKS_PER_SEC >= nTimeOut )
464 printf(
"The problem timed out after %d sec. ", nTimeOut );
465 else if ( RetValue == -1 && nConfLimit )
466 printf(
"The problem aborted after %d conflicts. ", nConfLimit );
467 else if ( RetValue == -1 && nIterLimit )
468 printf(
"The problem aborted after %d iterations. ", nIterLimit );
469 else if ( RetValue == 1 )
470 printf(
"The problem is UNSAT after %d iterations. ", i );
472 printf(
"The problem is SAT after %d iterations. ", i );
static int * Vec_IntArray(Vec_Int_t *p)
int Gia_QbfSolve(Gia_Man_t *pGia, int nPars, int nIterLimit, int nConfLimit, int nTimeOut, int fVerbose)
void Gia_ManStop(Gia_Man_t *p)
#define Gia_ManForEachCo(p, pObj, i)
static int Gia_ManPoNum(Gia_Man_t *p)
Gia_Man_t * Gia_QbfQuantify(Gia_Man_t *p, int nPars)
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
void Gia_QbfOnePattern(Qbf_Man_t *p, Vec_Int_t *vValues)
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Cnf_DataWriteIntoFile(Cnf_Dat_t *p, char *pFileName, int fReadable, Vec_Int_t *vForAlls, Vec_Int_t *vExists)
static char * Gia_ManName(Gia_Man_t *p)
static Gia_Obj_t * Gia_ManPo(Gia_Man_t *p, int v)
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)
static int Gia_ManAppendCi(Gia_Man_t *p)
void sat_solver_delete(sat_solver *s)
static int Abc_Var2Lit(int Var, int fCompl)
int sat_solver_nconflicts(sat_solver *s)
void Gia_QbfDumpFile(Gia_Man_t *pGia, int nPars)
int Gia_QbfVerify(Qbf_Man_t *p, Vec_Int_t *vValues)
static abctime Abc_Clock()
void Gia_QbfLearnConstraint(Qbf_Man_t *p, Vec_Int_t *vValues)
static Vec_Int_t * Vec_IntStartFull(int nSize)
static int * Vec_IntLimit(Vec_Int_t *p)
static int sat_solver_var_value(sat_solver *s, int v)
static int sat_solver_add_buffer(sat_solver *pSat, int iVarA, int iVarB, int fCompl)
static void Vec_IntPrintBinary(Vec_Int_t *vVec)
#define Gia_ManForEachCi(p, pObj, i)
int Gia_ManSatEnum(Gia_Man_t *pGia, int nConfLimit, int nTimeOut, int fVerbose)
FUNCTION DEFINITIONS ///.
static void Abc_PrintTime(int level, const char *pStr, abctime time)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Gia_ManAndNum(Gia_Man_t *p)
static Vec_Int_t * Vec_IntStart(int nSize)
static int Abc_LitIsCompl(int Lit)
Gia_Man_t * Gia_QbfCofactor(Gia_Man_t *p, int nPars, Vec_Int_t *vValues, Vec_Int_t *vParMap)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Gia_QbfPrint(Qbf_Man_t *p, Vec_Int_t *vValues, int Iter)
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
static void Gia_ObjFlipFaninC0(Gia_Obj_t *pObj)
typedefABC_NAMESPACE_IMPL_START struct Qbf_Man_t_ Qbf_Man_t
DECLARATIONS ///.
void sat_solver_setnvars(sat_solver *s, int n)
static int Vec_IntEntry(Vec_Int_t *p, int i)
int sat_solver_nvars(sat_solver *s)
#define ABC_NAMESPACE_IMPL_END
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
#define Gia_ManForEachAnd(p, pObj, i)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
#define Gia_ManForEachPi(p, pObj, i)
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Cnf_Dat_t * Mf_ManGenerateCnf(Gia_Man_t *pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fVerbose)
void Cnf_DataLift(Cnf_Dat_t *p, int nVarsPlus)
int sat_solver_nclauses(sat_solver *s)
#define ABC_NAMESPACE_IMPL_START
static int Gia_ManCiNum(Gia_Man_t *p)
static int Abc_LitNot(int Lit)
sat_solver * sat_solver_new(void)
static int Vec_IntSize(Vec_Int_t *p)
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
void Gia_QbfAddSpecialConstr(Qbf_Man_t *p)
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
#define ABC_CALLOC(type, num)
int Gia_QbfAddCofactor(Qbf_Man_t *p, Gia_Man_t *pCof)
void Cnf_DataFree(Cnf_Dat_t *p)
Qbf_Man_t * Gia_QbfAlloc(Gia_Man_t *pGia, int nPars, int fVerbose)
void Gia_ManHashAlloc(Gia_Man_t *p)
static void Vec_IntFree(Vec_Int_t *p)
static int Gia_ManPiNum(Gia_Man_t *p)
static void Vec_IntClear(Vec_Int_t *p)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
char * Abc_UtilStrsav(char *s)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
static int Gia_ManObjNum(Gia_Man_t *p)
void Gia_QbfFree(Qbf_Man_t *p)
static int Gia_ManCiIdToId(Gia_Man_t *p, int CiId)
static int Gia_ManRegNum(Gia_Man_t *p)