139 #define Tas_QueForEachEntry( Que, pObj, i ) \
140 for ( i = (Que).iHead; (i < (Que).iTail) && ((pObj) = (Que).pData[i]); i++ )
142 #define Tas_ClauseForEachVar( p, hClause, pObj ) \
143 for ( (p)->pIter = (p)->pClauses.pData + hClause; (pObj = *pIter); (p)->pIter++ )
144 #define Tas_ClauseForEachVar1( p, hClause, pObj ) \
145 for ( (p)->pIter = (p)->pClauses.pData+hClause+1; (pObj = *pIter); (p)->pIter++ )
165 pPars->nBTLimit = 2000;
166 pPars->nJustLimit = 2000;
167 pPars->fUseActive = 0;
168 pPars->fUseHighest = 1;
169 pPars->fUseLowest = 0;
170 pPars->fUseMaxFF = 0;
172 pPars->VarDecay = (float)0.95;
193 p->
Pars.nBTLimit = nBTLimit;
271 return p->
Pars.nJustThis > p->
Pars.nJustLimit || p->
Pars.nBTThis > p->
Pars.nBTLimit;
383 *piHeadOld = p->
iHead;
384 *piTailOld = p->
iTail;
385 for ( i = *piHeadOld; i < *piTailOld; i++ )
387 p->
iHead = *piTailOld;
420 int iHeadOld = p->
iHead;
465 float BestCost = 0.0;
471 if ( pObjMax == NULL ||
533 if ( pObjMax == NULL || pObjMax < pObj )
557 if ( pObjMax == NULL ||
580 if ( pObjMin == NULL || pObjMin > pObj )
599 int i, iMaxFF = 0, iCurFF;
605 if ( iMaxFF < iCurFF )
631 assert( iBound <= p->pProp.iTail );
665 if ( pRes0 == NULL && pRes1 != 0 )
695 for ( pIter = pQue->
pData + hClause; *pIter; pIter++ );
696 return pIter - pQue->
pData - hClause ;
716 printf(
"Level %2d : ", Level );
717 for ( i = hClause; (pObj = pQue->
pData[i]); i++ )
739 printf(
"Level %2d : ", Level );
740 for ( i = hClause; (pObj = pQue->
pData[i]); i++ )
760 int i, k, j, iLitLevel, iLitLevel2;
772 for ( i = k = pQue->
iHead + 1; i < pQue->iTail; i++ )
774 pObj = pQue->
pData[i];
787 if ( iLitLevel < Level )
789 pQue->
pData[k++] = pObj;
792 assert( iLitLevel == Level );
797 assert( pReason == pObj );
798 for ( j = 1; j < pCls->
nLits; j++ )
810 if ( pReason == pObj )
821 if ( pReason != pObj )
827 printf(
"Tas_ManDeriveReason(): Failed to derive the clause!!!\n" );
877 int i, LevelMax = -1, LevelCur;
888 for ( i = hClause0 + 1; (pObj = pQue->
pData[i]); i++ )
896 if ( LevelMax < LevelCur )
899 for ( i = hClause1 + 1; (pObj = pQue->
pData[i]); i++ )
907 if ( LevelMax < LevelCur )
910 for ( i = pQue->
iHead + 1; i < pQue->iTail; i++ )
938 memset( pCls, 0,
sizeof(
int) * nSize );
959 if ( pClause->
pLits[0] == Lit )
987 for ( i = hClause; (pObj = pQue->
pData[i]); i++ )
993 pClause->
nLits = nLits;
994 for ( i = hClause; (pObj = pQue->
pData[i]); i++ )
1028 for ( i = 0; i < pCls->
nLits; i++ )
1054 int * piPrev, iCur, iTemp;
1058 for ( iCur = p->
pWatches[Lit]; iCur; iCur = *piPrev )
1062 if ( pCur->
pLits[0] == LitF )
1065 pCur->
pLits[1] = LitF;
1066 iTemp = pCur->
iNext[0];
1068 pCur->
iNext[1] = iTemp;
1077 piPrev = &pCur->
iNext[1];
1082 for ( i = 2; i < (int)pCur->
nLits; i++ )
1091 pCur->
pLits[i] = LitF;
1093 *piPrev = pCur->
iNext[1];
1098 if ( i < (
int)pCur->
nLits )
1119 piPrev = &pCur->
iNext[1];
1144 int Value0, Value1, hClause;
1165 if ( Value0 == 0 || Value1 == 0 )
1167 if ( Value0 == 0 && Value1 != 0 )
1169 if ( Value0 != 0 && Value1 == 0 )
1171 assert( Value0 == 0 && Value1 == 0 );
1181 if ( Value0 == 0 || Value1 == 0 )
1183 if ( Value0 == 1 && Value1 == 1 )
1185 if ( Value0 == 1 || Value1 == 1 )
1221 if ( Value0 == 0 || Value1 == 0 )
1223 if ( Value0 == 1 && Value1 == 1 )
1225 assert( Value0 == 1 || Value1 == 1 );
1289 int hClause, hLearn0, hLearn1;
1290 int iPropHead, iJustHead, iJustTail;
1310 if ( p->
Pars.fUseActive )
1312 else if ( p->
Pars.fUseHighest )
1315 else if ( p->
Pars.fUseLowest )
1317 else if ( p->
Pars.fUseMaxFF )
1368 int i, Entry, RetValue = 0;
1378 p->
Pars.nBTThis = p->
Pars.nJustThis = p->
Pars.nBTThisNc = 0;
1403 p->
Pars.nBTTotal += p->
Pars.nBTThis;
1426 int i, Entry, RetValue = 0;
1437 p->
Pars.nBTThis = p->
Pars.nJustThis = p->
Pars.nBTThisNc = 0;
1462 p->
Pars.nBTTotal += p->
Pars.nBTThis;
1491 printf(
"Conf = %6d ", p->
Pars.nBTLimit );
1492 printf(
"JustMax = %5d ", p->
Pars.nJustLimit );
1494 printf(
"Unsat calls %6d (%6.2f %%) Ave conf = %8.1f ",
1497 printf(
"Sat calls %6d (%6.2f %%) Ave conf = %8.1f ",
1500 printf(
"Undef calls %6d (%6.2f %%) Ave conf = %8.1f ",
1522 Vec_Int_t * vCex, * vVisit, * vCexStore;
1568 p->
Pars.fUseHighest = 1;
1569 p->
Pars.fUseLowest = 0;
1623 *pvStatus = vStatus;
1644 unsigned * pInfo, * pPres;
1646 for ( i = 0; i < nLits; i++ )
1654 for ( i = 0; i < nLits; i++ )
1679 for ( k = 1; k < 32; k++ )
1682 return (
int)(k < 32);
1704 Vec_Int_t * vCex, * vVisit, * vCexStore;
1709 int Tried = 0, Stored = 0, Step =
Gia_ManCoNum(pAig) / nPatMax;
1735 p->
Pars.fUseHighest = 1;
1736 p->
Pars.fUseLowest = 0;
1773 printf(
"Tried = %d Stored = %d\n", Tried, Stored );
int Tas_StorePatternTry(Vec_Ptr_t *vInfo, Vec_Ptr_t *vPres, int iBit, int *pLits, int nLits)
static int * Vec_IntArray(Vec_Int_t *p)
void Gia_ManCreateRefs(Gia_Man_t *p)
void Gia_ManCleanPhase(Gia_Man_t *p)
static Gia_Obj_t * Gia_ObjChild0(Gia_Obj_t *pObj)
static int Tas_ManCreateFromCls(Tas_Man_t *p, Tas_Cls_t *pCls, int Level)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Tas_ManResolve(Tas_Man_t *p, int Level, int hClause0, int hClause1)
static void Tas_QueRestore(Tas_Que_t *p, int iHeadOld, int iTailOld)
static Gia_Obj_t * Tas_ManDecideHighestFanin(Tas_Man_t *p)
#define Gia_ManForEachCo(p, pObj, i)
static Gia_Obj_t * Tas_VarReason1(Tas_Man_t *p, Gia_Obj_t *pVar)
static int Gia_ManPoNum(Gia_Man_t *p)
static int Gia_ObjFaninC1(Gia_Obj_t *pObj)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static Gia_Obj_t * Tas_ManDecideLowest(Tas_Man_t *p)
static Gia_Obj_t * Gia_Regular(Gia_Obj_t *p)
static int Abc_InfoHasBit(unsigned *p, int i)
static Gia_Obj_t * Gia_ObjFromLit(Gia_Man_t *p, int iLit)
#define ABC_REALLOC(type, obj, num)
static int Gia_ObjIsCand(Gia_Obj_t *pObj)
static void Tas_ManPrintClause(Tas_Man_t *p, int Level, int hClause)
static void Abc_InfoXorBit(unsigned *p, int i)
static void Tas_ManSaveModel(Tas_Man_t *p, Vec_Int_t *vCex)
static void Tas_ManDeriveReason(Tas_Man_t *p, int Level)
void Gia_ManCleanMark0(Gia_Man_t *p)
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
static int Abc_Var2Lit(int Var, int fCompl)
static int Tas_VarFanin1Value(Gia_Obj_t *pVar)
static void Vec_PtrCleanSimInfo(Vec_Ptr_t *vInfo, int iWord, int nWords)
static int Tas_VarValue(Gia_Obj_t *pVar)
static void Tas_ManAssign(Tas_Man_t *p, Gia_Obj_t *pObj, int Level, Gia_Obj_t *pRes0, Gia_Obj_t *pRes1)
static int Gia_ObjRefNum(Gia_Man_t *p, Gia_Obj_t *pObj)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define ABC_ALLOC(type, num)
static Vec_Str_t * Vec_StrAlloc(int nCap)
static abctime Abc_Clock()
static int Abc_MaxInt(int a, int b)
static void Vec_StrPush(Vec_Str_t *p, char Entry)
static int Tas_VarFanin0Value(Gia_Obj_t *pVar)
static int Tas_ManAnalyze(Tas_Man_t *p, int Level, Gia_Obj_t *pVar, Gia_Obj_t *pFan0, Gia_Obj_t *pFan1)
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
static int Tas_ManClauseSize(Tas_Man_t *p, int hClause)
void Tas_ManSolveMiterNc2(Gia_Man_t *pAig, int nConfs, Gia_Man_t *pAigOld, Vec_Ptr_t *vOldRoots, Vec_Ptr_t *vSimInfo)
void Gia_ManCleanMark1(Gia_Man_t *p)
static Gia_Obj_t * Gia_ManConst1(Gia_Man_t *p)
static void Tas_ManPrintClauseNew(Tas_Man_t *p, int Level, int hClause)
static int Tas_VarToLit(Tas_Man_t *p, Gia_Obj_t *pObj)
static int Tas_ClauseDecLevel(Tas_Man_t *p, int hClause)
static void Tas_ManWatchClause(Tas_Man_t *p, Tas_Cls_t *pClause, int Lit)
static int Tas_ManPropagateOne(Tas_Man_t *p, Gia_Obj_t *pVar, int Level)
#define ABC_PRTP(a, t, T)
static Gia_Obj_t * Gia_ObjChild1(Gia_Obj_t *pObj)
Vec_Int_t * Tas_ManSolveMiterNc(Gia_Man_t *pAig, int nConfs, Vec_Str_t **pvStatus, int fVerbose)
static Gia_Obj_t * Gia_Not(Gia_Obj_t *p)
static int Gia_ManAndNum(Gia_Man_t *p)
static int Tas_QueHasNode(Tas_Que_t *p, Gia_Obj_t *pObj)
void Tas_ManStop(Tas_Man_t *p)
static int Tas_VarIsAssigned(Gia_Obj_t *pVar)
static int Abc_LitIsCompl(int Lit)
#define Tas_QueForEachEntry(Que, pObj, i)
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static void Gia_ObjSetProved(Gia_Man_t *p, int Id)
static Gia_Obj_t * Tas_ManDecideMaxFF(Tas_Man_t *p)
int Tas_ManSolve(Tas_Man_t *p, Gia_Obj_t *pObj, Gia_Obj_t *pObj2)
static int Tas_VarHasReasonCls(Tas_Man_t *p, Gia_Obj_t *pVar)
static void Tas_QuePush(Tas_Que_t *p, Gia_Obj_t *pObj)
static int Vec_IntEntry(Vec_Int_t *p, int i)
int Tas_StorePattern(Vec_Ptr_t *vSimInfo, Vec_Ptr_t *vPres, Vec_Int_t *vCex)
static int Tas_LitIsTrue(Gia_Obj_t *pObj, int Lit)
void Tas_SetDefaultParams(Tas_Par_t *pPars)
FUNCTION DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_END
int Tas_ManPropagate(Tas_Man_t *p, int Level)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
static Gia_Obj_t * Tas_ManDecideHighest(Tas_Man_t *p)
static Gia_Obj_t * Tas_ManDecideHighestA(Tas_Man_t *p)
void Gia_ManFillValue(Gia_Man_t *p)
static void Tas_VarUnassign(Gia_Obj_t *pVar)
typedefABC_NAMESPACE_IMPL_START struct Tas_Par_t_ Tas_Par_t
DECLARATIONS ///.
static int Tas_VarIsJust(Gia_Obj_t *pVar)
int Tas_ManSolve_rec(Tas_Man_t *p, int Level)
#define ABC_NAMESPACE_IMPL_START
void Cec_ManSatAddToStore(Vec_Int_t *vCexStore, Vec_Int_t *vCex, int Out)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_InfoSetBit(unsigned *p, int i)
static int Gia_ManCiNum(Gia_Man_t *p)
static int Abc_LitNot(int Lit)
static int Vec_IntSize(Vec_Int_t *p)
static int Gia_IsComplement(Gia_Obj_t *p)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static Tas_Cls_t * Tas_ManAllocCls(Tas_Man_t *p, int nSize)
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
static Tas_Cls_t * Tas_ClsFromHandle(Tas_Man_t *p, int h)
int Tas_ManSolveArray(Tas_Man_t *p, Vec_Ptr_t *vObjs)
static int Tas_VarDecLevel(Tas_Man_t *p, Gia_Obj_t *pVar)
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
static int Tas_ManPropagateWatch(Tas_Man_t *p, int Level, int Lit)
static int Abc_Lit2Var(int Lit)
#define ABC_CALLOC(type, num)
static Gia_Obj_t * Tas_ManFindActive(Tas_Man_t *p)
static int Tas_QueIsEmpty(Tas_Que_t *p)
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
static Tas_Cls_t * Tas_ManCreateCls(Tas_Man_t *p, int hClause)
static int Gia_ObjProved(Gia_Man_t *p, int Id)
static void Vec_PtrClear(Vec_Ptr_t *p)
static Tas_Cls_t * Tas_VarReasonCls(Tas_Man_t *p, Gia_Obj_t *pVar)
static int Tas_ManPropagateTwo(Tas_Man_t *p, Gia_Obj_t *pVar, int Level)
void Gia_ManCollectTest(Gia_Man_t *p)
void Tas_ManSatPrintStats(Tas_Man_t *p)
Vec_Int_t * Tas_ReadModel(Tas_Man_t *p)
static int Tas_VarFaninFanoutMax(Tas_Man_t *p, Gia_Obj_t *pObj)
static void Tas_VarAssign(Gia_Obj_t *pVar)
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static void Tas_ManCancelUntil(Tas_Man_t *p, int iBound)
Tas_Man_t * Tas_ManAlloc(Gia_Man_t *pAig, int nBTLimit)
static void Vec_IntClear(Vec_Int_t *p)
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
static int Tas_ManCheckLimits(Tas_Man_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
static int Gia_ObjFaninId1(Gia_Obj_t *pObj, int ObjId)
static void Tas_QueStore(Tas_Que_t *p, int *piHeadOld, int *piTailOld)
static Gia_Obj_t * Tas_VarReason0(Tas_Man_t *p, Gia_Obj_t *pVar)
static int Tas_ClsHandle(Tas_Man_t *p, Tas_Cls_t *pClause)
static int Gia_ObjCioId(Gia_Obj_t *pObj)
static int Gia_ManObjNum(Gia_Man_t *p)
static void Tas_VarSetValue(Gia_Obj_t *pVar, int v)
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
static void Vec_PtrFree(Vec_Ptr_t *p)
static int Gia_ObjFaninId0(Gia_Obj_t *pObj, int ObjId)
static int Gia_ManCoNum(Gia_Man_t *p)
static int Gia_ManRegNum(Gia_Man_t *p)
static int Tas_QueFinish(Tas_Que_t *p)