48 abctime nTimeToStop = TimeOut ? Abc_Clock() + TimeOut * CLOCKS_PER_SEC : 0;
50 int s, i, IterMax = 100000, nAndsMin = -1, iIterLast = -1;
54 for ( s = 0; s < 10+Seed; s++ )
56 for ( i = 0; i < IterMax; i++ )
58 char * pCompress2rs =
"balance -l; resub -K 6 -l; rewrite -l; resub -K 6 -N 2 -l; refactor -l; resub -K 8 -l; balance -l; resub -K 8 -N 2 -l; rewrite -l; resub -K 10 -l; rewrite -z -l; resub -K 10 -N 2 -l; balance -l; resub -K 12 -l; refactor -z -l; resub -K 12 -N 2 -l; rewrite -z -l; balance -l";
62 int fCom = (Rand >> 1) & 1;
63 int fFx = (Rand >> 2) & 1;
64 int KLut = fUseTwo ? 2 + (i % 5) : 3 + (i % 4);
69 sprintf( pComp,
"; &put; %s; %s; %s; &get", pCompress2rs, pCompress2rs, pCompress2rs );
71 sprintf( pComp,
"; &put; %s; %s; &get", pCompress2rs, pCompress2rs );
73 sprintf( pComp,
"; &put; %s; &get", pCompress2rs );
76 sprintf( Command,
"&dch%s; &if -a -K %d; &mfs -e -W 20 -L 20%s%s",
77 fDch ?
" -f" :
"", KLut, fFx ?
"; &fx; &st" :
"", pComp );
82 Abc_Print( 1,
"Something did not work out with the command \"%s\".\n", Command );
91 Abc_Print( 1,
"Something did not work out with the command \"%s\".\n", Command );
97 if ( Gia_ManAndNum(pNew) > Gia_ManAndNum(pTemp) )
104 else if ( Gia_ManAndNum(pNew) + Gia_ManAndNum(pNew)/10 < Gia_ManAndNum(pTemp) )
109 if ( fChange && fVerbose )
111 printf(
"Iter %6d : ", i );
112 printf(
"Time %8.2f sec : ", (
float)1.0*(Abc_Clock() - clkStart)/CLOCKS_PER_SEC );
113 printf(
"And = %6d ", Gia_ManAndNum(pNew) );
116 printf(
"<== best : " );
119 printf(
"%s", Command );
122 if ( nTimeToStop && Abc_Clock() > nTimeToStop )
125 printf(
"Runtime limit (%d sec) is reached after %d iterations.\n", TimeOut, i );
128 if ( i - iIterLast > nNoImpr )
130 printf(
"Completed %d iterations without improvement in %.2f seconds.\n",
131 nNoImpr, (
float)1.0*(Abc_Clock() - clkStart)/CLOCKS_PER_SEC );
136 printf(
"Iteration limit (%d iters) is reached after %.2f seconds.\n", IterMax, (
float)1.0*(Abc_Clock() - clkStart)/CLOCKS_PER_SEC );
137 else if ( nAnds && nAndsMin <= nAnds )
138 printf(
"Quality goal (%d nodes <= %d nodes) is achieved after %d iterations and %.2f seconds.\n",
139 nAndsMin, nAnds, i, (
float)1.0*(Abc_Clock() - clkStart)/CLOCKS_PER_SEC );
148 for ( i = 0; i < nIters; i++ )
152 if ( Gia_ManAndNum(pBest) > Gia_ManAndNum(pThis) )
178 char * pCompress2rs =
"balance -l; resub -K 6 -l; rewrite -l; resub -K 6 -N 2 -l; refactor -l; resub -K 8 -l; balance -l; resub -K 8 -N 2 -l; rewrite -l; resub -K 10 -l; rewrite -z -l; resub -K 10 -N 2 -l; balance -l; resub -K 12 -l; refactor -z -l; resub -K 12 -N 2 -l; rewrite -z -l; balance -l";
179 unsigned Rand = random_seed;
182 int fCom = (Rand >> 1) & 1;
183 int fFx = (Rand >> 2) & 1;
185 int KLut = fUseTwo ? 2 + (Rand % 5) : 3 + (Rand % 4);
190 sprintf( pComp,
"; &put; %s; %s; %s; &get", pCompress2rs, pCompress2rs, pCompress2rs );
191 else if ( fCom == 2 )
192 sprintf( pComp,
"; &put; %s; %s; &get", pCompress2rs, pCompress2rs );
193 else if ( fCom == 1 )
194 sprintf( pComp,
"; &put; %s; &get", pCompress2rs );
195 else if ( fCom == 0 )
197 sprintf( Command,
"&dch%s; &if -a -K %d; &mfs -e -W 20 -L 20%s%s",
198 fDch ?
" -f" :
"", KLut, fFx ?
"; &fx; &st" :
"", pComp );
205 Abc_Print( 1,
"Something did not work out with the command \"%s\".\n", Command );
214 Abc_Print( 1,
"Something did not work out with the command \"%s\".\n", Command );
void Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
Gia_Man_t * Abc_FrameGetGia(Abc_Frame_t *pAbc)
unsigned Abc_Random(int fReset)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
ABC_DLL void Abc_FrameSetBatchMode(int Mode)
ABC_DLL Gia_Man_t * Abc_FrameReadGia(Abc_Frame_t *p)
ABC_DLL int Abc_FrameIsBatchMode()
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
Gia_Man_t * Gia_ManDeepSyn(Gia_Man_t *pGia, int nIters, int nNoImpr, int TimeOut, int nAnds, int Seed, int fUseTwo, int fVerbose)
ABC_NAMESPACE_IMPL_START Gia_Man_t * Gia_ManDeepSynOne(int nNoImpr, int TimeOut, int nAnds, int Seed, int fUseTwo, int fVerbose)
DECLARATIONS ///.
Gia_Man_t * Gia_ManRandSyn(Gia_Man_t *p, unsigned random_seed)
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
int Gia_ManLevelNum(Gia_Man_t *p)