diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2018-09-08 17:15:37 +0300 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2018-09-08 17:15:37 +0300 |
commit | d798d61637ad632fdb3656194fcb8626e8f6df3d (patch) | |
tree | 6c8071ecced7444b56b706c862683a6cbc5b3dd4 /src/sat | |
parent | c76af92d19388d3fa26595d0698cb33d50dc9629 (diff) | |
download | abc-d798d61637ad632fdb3656194fcb8626e8f6df3d.tar.gz abc-d798d61637ad632fdb3656194fcb8626e8f6df3d.tar.bz2 abc-d798d61637ad632fdb3656194fcb8626e8f6df3d.zip |
Adding timeout to twoexact and lutexact.
Diffstat (limited to 'src/sat')
-rw-r--r-- | src/sat/bmc/bmc.h | 2 | ||||
-rw-r--r-- | src/sat/bmc/bmcMaj.c | 17 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/sat/bmc/bmc.h b/src/sat/bmc/bmc.h index 71a33595..cef93bb1 100644 --- a/src/sat/bmc/bmc.h +++ b/src/sat/bmc/bmc.h @@ -58,6 +58,7 @@ struct Bmc_EsPar_t_ int fOrderNodes; int fEnumSols; int fFewerVars; + int RuntimeLim; int fVerbose; char * pTtStr; }; @@ -76,6 +77,7 @@ static inline void Bmc_EsParSetDefault( Bmc_EsPar_t * pPars ) pPars->fOrderNodes = 0; pPars->fEnumSols = 0; pPars->fFewerVars = 0; + pPars->RuntimeLim = 0; pPars->fVerbose = 1; } diff --git a/src/sat/bmc/bmcMaj.c b/src/sat/bmc/bmcMaj.c index 74a3a5a7..08571a3b 100644 --- a/src/sat/bmc/bmcMaj.c +++ b/src/sat/bmc/bmcMaj.c @@ -500,6 +500,8 @@ Exa_Man_t * Exa_ManAlloc( Bmc_EsPar_t * pPars, word * pTruth ) p->vInfo = Exa_ManTruthTables( p ); p->pSat = bmcg_sat_solver_start(); bmcg_sat_solver_set_nvars( p->pSat, p->iVar ); + if ( pPars->RuntimeLim ) + bmcg_sat_solver_set_runtime_limit( p->pSat, Abc_Clock() + pPars->RuntimeLim * CLOCKS_PER_SEC ); return p; } void Exa_ManFree( Exa_Man_t * p ) @@ -828,6 +830,11 @@ void Exa_ManExactSynthesis( Bmc_EsPar_t * pPars ) printf( "The problem has no solution.\n" ); break; } + if ( status == GLUCOSE_UNDEC ) + { + printf( "The problem timed out after %d sec.\n", pPars->RuntimeLim ); + break; + } iMint = Exa_ManEval( p ); } if ( iMint == -1 ) @@ -971,6 +978,8 @@ static Exa3_Man_t * Exa3_ManAlloc( Bmc_EsPar_t * pPars, word * pTruth ) p->vUsed3 = Vec_BitStart( (1 << p->pPars->nVars) * p->pPars->nNodes * p->nObjs * p->nObjs * p->nObjs ); p->pSat = bmcg_sat_solver_start(); bmcg_sat_solver_set_nvars( p->pSat, p->iVar ); + if ( pPars->RuntimeLim ) + bmcg_sat_solver_set_runtime_limit( p->pSat, Abc_Clock() + pPars->RuntimeLim * CLOCKS_PER_SEC ); return p; } static void Exa3_ManFree( Exa3_Man_t * p ) @@ -1323,15 +1332,17 @@ void Exa3_ManExactSynthesis( Bmc_EsPar_t * pPars ) status = bmcg_sat_solver_solve( p->pSat, NULL, 0 ); if ( pPars->fVerbose && (!pPars->fUseIncr || i % 100 == 0) ) Exa3_ManPrint( p, i, iMint, Abc_Clock() - clkTotal ); - if ( status == GLUCOSE_UNSAT ) + if ( status == GLUCOSE_UNSAT || status == GLUCOSE_UNDEC ) break; iMint = Exa3_ManEval( p ); } - if ( pPars->fVerbose ) + if ( pPars->fVerbose && status != GLUCOSE_UNDEC ) Exa3_ManPrint( p, i, iMint, Abc_Clock() - clkTotal ); if ( iMint == -1 ) Exa3_ManPrintSolution( p, fCompl ); - else + else if ( status == GLUCOSE_UNDEC ) + printf( "The problem timed out after %d sec.\n", pPars->RuntimeLim ); + else printf( "The problem has no solution.\n" ); printf( "Added = %d. Tried = %d. ", p->nUsed[1], p->nUsed[0] ); Exa3_ManFree( p ); |