52 pPars->nRecycle = 300;
53 pPars->nFrameMax = 10000;
55 pPars->nTimeOutGap = 0;
56 pPars->nConfLimit = 0;
57 pPars->nRestLimit = 0;
58 pPars->fTwoRounds = 0;
63 pPars->fVeryVerbose = 0;
64 pPars->fNotVerbose = 0;
68 pPars->timeLastSolved = 0;
86 int i, Entry, nCoreLits, * pCoreLits;
102 for ( i = 0; i < pCube->nLits; i++ )
103 if (
lit_sign(pCube->Lits[i]) == 0 )
108 assert( i < pCube->nLits );
165 if ( RetValue2 == -1 )
173 if ( pCubeMin != NULL )
269 int temp, i, j, best_i, nSize = pCube->nLits;
271 for ( i = 0; i < nSize; i++ )
273 for ( i = 0; i < nSize-1; i++ )
276 for ( j = i+1; j < nSize; j++ )
278 if ( pPrios[pCube->Lits[pArray[j]]>>1] < pPrios[pCube->Lits[pArray[best_i]]>>1] )
281 pArray[i] = pArray[best_i];
282 pArray[best_i] = temp;
307 int i, j, n, Lit, RetValue;
313 if ( RetValue == -1 )
324 if ( pCubeMin == NULL )
328 if ( !p->
pPars->fSkipGeneral )
333 for ( j = 0; j < pCubeMin->nLits; j++ )
340 assert( pCubeMin->Lits[i] != -1 );
344 Lit = pCubeMin->Lits[i]; pCubeMin->Lits[i] = -1;
346 if ( RetValue == -1 )
351 pCubeMin->Lits[i] = Lit;
356 for ( n = j; n < pCubeMin->nLits-1; n++ )
357 pOrder[n] = pOrder[n+1];
363 assert( pCubeMin->nLits > 0 );
370 if ( p->
pPars->fTwoRounds )
371 for ( j = 0; j < pCubeMin->nLits; j++ )
378 assert( pCubeMin->Lits[i] != -1 );
382 Lit = pCubeMin->Lits[i]; pCubeMin->Lits[i] = -1;
384 if ( RetValue == -1 )
389 pCubeMin->Lits[i] = Lit;
394 for ( n = j; n < pCubeMin->nLits-1; n++ )
395 pOrder[n] = pOrder[n+1];
401 assert( pCubeMin->nLits > 0 );
409 assert( ppCubeMin != NULL );
410 *ppCubeMin = pCubeMin;
445 if ( pThis->
iFrame > kMax )
468 if ( RetValue == -1 )
482 if ( RetValue == -1 )
489 assert( pCubeMin != NULL );
494 for ( k = pThis->
iFrame; k < kMax; k++ )
497 if ( RetValue == -1 )
506 if ( p->
pPars->fVeryVerbose )
513 for ( i = 0; i < pCubeMin->nLits; i++ )
515 assert( pCubeMin->Lits[i] >= 0 );
522 for ( i = 1; i <= k; i++ )
525 if ( (k < kMax || p->pPars->fReuseProofOblig) && !p->
pPars->fShortest )
528 pThis->
prio = Prio--;
538 assert( pCubeMin == NULL );
540 pThis->
prio = Prio--;
572 int fPrintClauses = 0;
576 int k, RetValue = -1;
582 if ( p->
pPars->fSolveAll )
587 p->
pPars->nProveOuts++;
588 if ( p->
pPars->fUseBridge )
613 if ( !p->
pPars->fSolveAll )
616 p->
pAig->pSeqModel = pCexNew;
620 p->
pPars->nFailOuts++;
622 if ( !p->
pPars->fNotVerbose )
623 Abc_Print( 1,
"Output %*d was trivially asserted in frame %2d (solved %*d out of %*d outputs).\n",
626 if ( p->
pPars->fUseBridge )
631 if ( p->
pPars->fVerbose )
633 if ( !p->
pPars->fSilent )
634 Abc_Print( 1,
"Quitting due to callback on fail.\n" );
635 p->
pPars->iFrame = k;
639 return p->
pPars->nFailOuts ? 0 : -1;
652 if ( p->
pPars->nTimeOutGap && p->
pPars->timeLastSolved && Abc_Clock() > p->
pPars->timeLastSolved + p->
pPars->nTimeOutGap * CLOCKS_PER_SEC )
654 if ( p->
pPars->fVerbose )
656 if ( !p->
pPars->fSilent )
657 Abc_Print( 1,
"Reached gap timeout (%d seconds).\n", p->
pPars->nTimeOutGap );
658 p->
pPars->iFrame = k;
664 if ( RetValue == -1 )
666 if ( p->
pPars->fVerbose )
669 Abc_Print( 1,
"Reached timeout (%d seconds).\n", p->
pPars->nTimeOut );
670 else if ( p->
pPars->nTimeOutGap && p->
pPars->timeLastSolved && Abc_Clock() > p->
pPars->timeLastSolved + p->
pPars->nTimeOutGap * CLOCKS_PER_SEC )
671 Abc_Print( 1,
"Reached gap timeout (%d seconds).\n", p->
pPars->nTimeOutGap );
678 else if ( p->
pPars->nConfLimit )
679 Abc_Print( 1,
"Reached conflict limit (%d).\n", p->
pPars->nConfLimit );
680 else if ( p->
pPars->fVerbose )
681 Abc_Print( 1,
"Computation cancelled by the callback.\n" );
682 p->
pPars->iFrame = k;
688 if ( RetValue == -1 )
690 if ( p->
pPars->fVerbose )
693 Abc_Print( 1,
"Reached timeout (%d seconds).\n", p->
pPars->nTimeOut );
694 else if ( p->
pPars->nTimeOutGap && p->
pPars->timeLastSolved && Abc_Clock() > p->
pPars->timeLastSolved + p->
pPars->nTimeOutGap * CLOCKS_PER_SEC )
695 Abc_Print( 1,
"Reached gap timeout (%d seconds).\n", p->
pPars->nTimeOutGap );
702 else if ( p->
pPars->nConfLimit )
703 Abc_Print( 1,
"Reached conflict limit (%d).\n", p->
pPars->nConfLimit );
704 else if ( p->
pPars->fVerbose )
705 Abc_Print( 1,
"Computation cancelled by the callback.\n" );
706 p->
pPars->iFrame = k;
713 Abc_Print( 1,
"*** Clauses after frame %d:\n", k );
716 if ( p->
pPars->fVerbose )
718 p->
pPars->iFrame = k;
719 if ( !p->
pPars->fSolveAll )
724 p->
pPars->nFailOuts++;
728 if ( p->
pPars->fUseBridge )
733 if ( p->
pPars->fVerbose )
735 if ( !p->
pPars->fSilent )
736 Abc_Print( 1,
"Quitting due to callback on fail.\n" );
737 p->
pPars->iFrame = k;
740 if ( !p->
pPars->fNotVerbose )
741 Abc_Print( 1,
"Output %*d was asserted in frame %2d (%2d) (solved %*d out of %*d outputs).\n",
749 if ( p->
pPars->fVerbose )
760 p->
pPars->nDropOuts++;
761 if ( p->
pPars->vOutMap )
763 if ( !p->
pPars->fNotVerbose )
770 if ( p->
pPars->fVerbose )
779 Abc_Print( 1,
"*** Clauses after frame %d:\n", k );
784 if ( RetValue == -1 )
786 if ( p->
pPars->fVerbose )
788 if ( !p->
pPars->fSilent )
791 Abc_Print( 1,
"Reached timeout (%d seconds).\n", p->
pPars->nTimeOut );
793 Abc_Print( 1,
"Reached conflict limit (%d).\n", p->
pPars->nConfLimit );
795 p->
pPars->iFrame = k;
800 if ( p->
pPars->fVerbose )
802 if ( !p->
pPars->fSilent )
804 if ( !p->
pPars->fSilent )
806 p->
pPars->iFrame = k;
810 if ( p->
pPars->vOutMap )
815 if ( p->
pPars->fUseBridge )
818 if ( p->
pPars->nProveOuts == Saig_ManPoNum(p->
pAig) )
820 if ( p->
pPars->nFailOuts > 0 )
824 if ( p->
pPars->fVerbose )
830 p->
pPars->iFrame = k;
837 Abc_Print( 1,
"*** Clauses after frame %d:\n", k );
840 if ( p->
pPars->fVerbose )
842 if ( !p->
pPars->fSilent )
843 Abc_Print( 1,
"Reached timeout (%d seconds).\n", p->
pPars->nTimeOut );
844 p->
pPars->iFrame = k;
847 if ( p->
pPars->nTimeOutGap && p->
pPars->timeLastSolved && Abc_Clock() > p->
pPars->timeLastSolved + p->
pPars->nTimeOutGap * CLOCKS_PER_SEC )
851 Abc_Print( 1,
"*** Clauses after frame %d:\n", k );
854 if ( p->
pPars->fVerbose )
856 if ( !p->
pPars->fSilent )
857 Abc_Print( 1,
"Reached gap timeout (%d seconds).\n", p->
pPars->nTimeOutGap );
858 p->
pPars->iFrame = k;
861 if ( p->
pPars->nFrameMax && k >= p->
pPars->nFrameMax )
863 if ( p->
pPars->fVerbose )
865 if ( !p->
pPars->fSilent )
866 Abc_Print( 1,
"Reached limit on the number of timeframes (%d).\n", p->
pPars->nFrameMax );
867 p->
pPars->iFrame = k;
891 if ( pPars->nTimeOutOne && !pPars->fSolveAll )
892 pPars->nTimeOutOne = 0;
893 if ( pPars->nTimeOutOne && pPars->nTimeOut == 0 )
894 pPars->nTimeOut = pPars->nTimeOutOne *
Saig_ManPoNum(pAig) / 1000 + (int)((pPars->nTimeOutOne *
Saig_ManPoNum(pAig) % 1000) > 0);
895 if ( pPars->fVerbose )
898 Abc_Print( 1,
"VarMax = %d. FrameMax = %d. QueMax = %d. TimeMax = %d. ",
903 Abc_Print( 1,
"MonoCNF = %s. SkipGen = %s. SolveAll = %s.\n",
904 pPars->fMonoCnf ?
"yes" :
"no",
905 pPars->fSkipGeneral ?
"yes" :
"no",
906 pPars->fSolveAll ?
"yes" :
"no" );
919 if ( p->
pPars->fDumpInv )
925 if ( pPars->vOutMap )
929 if ( pPars->fUseBridge )
void Pdr_ManPrintProgress(Pdr_Man_t *p, int fClose, abctime Time)
DECLARATIONS ///.
static int * Vec_IntArray(Vec_Int_t *p)
int Pdr_ManCheckCube(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, Pdr_Set_t **ppPred, int nConfLimit)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Pdr_Set_t * Pdr_SetCreateSubset(Pdr_Set_t *pSet, int *pLits, int nLits)
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
int Pdr_ManPushClauses(Pdr_Man_t *p)
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
static int Saig_ManPoNum(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
static Aig_Obj_t * Aig_ObjChild0(Aig_Obj_t *pObj)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
Vec_Int_t * Pdr_ManLitsToCube(Pdr_Man_t *p, int k, int *pArray, int nArray)
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
FUNCTION DEFINITIONS ///.
int Pdr_ManSolve(Aig_Man_t *pAig, Pdr_Par_t *pPars)
void Pdr_ManReportInvariant(Pdr_Man_t *p)
void Pdr_ManSolverAddClause(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
int Pdr_ManGeneralize(Pdr_Man_t *p, int k, Pdr_Set_t *pCube, Pdr_Set_t **ppPred, Pdr_Set_t **ppCubeMin)
void Pdr_SetDeref(Pdr_Set_t *p)
int Pdr_SetContains(Pdr_Set_t *pOld, Pdr_Set_t *pNew)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static Aig_Obj_t * Aig_ManConst0(Aig_Man_t *p)
void Pdr_SetPrint(FILE *pFile, Pdr_Set_t *p, int nRegs, Vec_Int_t *vFlopCounts)
Pdr_Man_t * Pdr_ManStart(Aig_Man_t *pAig, Pdr_Par_t *pPars, Vec_Int_t *vPrioInit)
DECLARATIONS ///.
Abc_Cex_t * Pdr_ManDeriveCex(Pdr_Man_t *p)
FUNCTION DECLARATIONS ///.
void Pdr_ManSetPropertyOutput(Pdr_Man_t *p, int k)
static abctime Abc_Clock()
static int Abc_MaxInt(int a, int b)
static int Vec_PtrSize(Vec_Ptr_t *p)
Pdr_Obl_t * Pdr_OblRef(Pdr_Obl_t *p)
static void * Vec_PtrPop(Vec_Ptr_t *p)
static int sat_solver_final(sat_solver *s, int **ppArray)
void Pdr_QueuePush(Pdr_Man_t *p, Pdr_Obl_t *pObl)
Abc_Cex_t * Abc_CexMakeTriv(int nRegs, int nTruePis, int nTruePos, int iFrameOut)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static int Abc_MinInt(int a, int b)
Pdr_Obl_t * Pdr_QueuePop(Pdr_Man_t *p)
Pdr_Set_t * Pdr_SetDup(Pdr_Set_t *pSet)
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
int * Pdr_ManSortByPriority(Pdr_Man_t *p, Pdr_Set_t *pCube)
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
void Pdr_QueueStop(Pdr_Man_t *p)
int Pdr_ManSolveInt(Pdr_Man_t *p)
static int Vec_IntEntry(Vec_Int_t *p, int i)
static int Abc_Base10Log(unsigned n)
#define ABC_NAMESPACE_IMPL_END
void Pdr_ManVerifyInvariant(Pdr_Man_t *p)
void Pdr_QueueClean(Pdr_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Pdr_Set_t_ Pdr_Set_t
INCLUDES ///.
static void Vec_IntPush(Vec_Int_t *p, int Entry)
void Pdr_ManDumpClauses(Pdr_Man_t *p, char *pFileName, int fProved)
ABC_NAMESPACE_IMPL_START int Gia_ManToBridgeResult(FILE *pFile, int Result, Abc_Cex_t *pCex, int iPoProved)
DECLARATIONS ///.
void Pdr_OblDeref(Pdr_Obl_t *p)
int Pdr_ManBlockCube(Pdr_Man_t *p, Pdr_Set_t *pCube)
static void Abc_Print(int level, const char *format,...)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
int Pdr_SetCompare(Pdr_Set_t **pp1, Pdr_Set_t **pp2)
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static sat_solver * Pdr_ManSolver(Pdr_Man_t *p, int k)
MACRO DEFINITIONS ///.
int Pdr_ManCheckContainment(Pdr_Man_t *p, int k, Pdr_Set_t *pSet)
Pdr_Set_t * Pdr_ManReduceClause(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
static int Aig_ManRegNum(Aig_Man_t *p)
static int Vec_IntSize(Vec_Int_t *p)
void Pdr_ManPrintClauses(Pdr_Man_t *p, int kStart)
static int lit_sign(lit l)
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
void Pdr_ManStop(Pdr_Man_t *p)
int Gia_ManToBridgeAbort(FILE *pFile, int Size, unsigned char *pBuffer)
sat_solver * Pdr_ManCreateSolver(Pdr_Man_t *p, int k)
DECLARATIONS ///.
#define Vec_VecForEachLevelStartStop(vGlob, vVec, i, LevelStart, LevelStop)
Pdr_Obl_t * Pdr_QueueHead(Pdr_Man_t *p)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define Saig_ManForEachPo(p, pObj, i)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Pdr_Obl_t * Pdr_OblStart(int k, int prio, Pdr_Set_t *pState, Pdr_Obl_t *pNext)
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
int Pdr_ManCheckCubeCs(Pdr_Man_t *p, int k, Pdr_Set_t *pCube)
int Pdr_SetIsInit(Pdr_Set_t *p, int iRemove)
int Pdr_QueueIsEmpty(Pdr_Man_t *p)
Pdr_Set_t * Pdr_SetCreateFrom(Pdr_Set_t *pSet, int iRemove)