diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2021-10-10 14:43:19 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2021-10-10 14:43:19 -0700 |
commit | f0236d5ac1b6d127354b5dd67aba79735bfceaa2 (patch) | |
tree | be8d9546ace37c20dea71e876fae02c19f415c16 /src/sat/bsat/satSolver.h | |
parent | d514029e342f3ed72459fccce89666049e62867c (diff) | |
download | abc-f0236d5ac1b6d127354b5dd67aba79735bfceaa2.tar.gz abc-f0236d5ac1b6d127354b5dd67aba79735bfceaa2.tar.bz2 abc-f0236d5ac1b6d127354b5dd67aba79735bfceaa2.zip |
Experiments with pattern generation.
Diffstat (limited to 'src/sat/bsat/satSolver.h')
-rw-r--r-- | src/sat/bsat/satSolver.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/sat/bsat/satSolver.h b/src/sat/bsat/satSolver.h index f4126567..53f3ebe2 100644 --- a/src/sat/bsat/satSolver.h +++ b/src/sat/bsat/satSolver.h @@ -292,6 +292,24 @@ static inline int sat_solver_final(sat_solver* s, int ** ppArray) return s->conf_final.size; } +static inline void sat_solver_randomize( sat_solver * pSat, int iVar, int nVars ) +{ + int i, nPols = 0, * pVars = ABC_ALLOC( int, nVars ); + for ( i = 0; i < nVars; i++ ) + if ( Abc_Random(0) & 1 ) + pVars[nPols++] = iVar + i; + sat_solver_set_polarity( pSat, pVars, nPols ); + for ( i = 0; i < nVars; i++ ) + pVars[i] = iVar + i; + for ( i = 0; i < nVars; i++ ) + { + int j = Abc_Random(0) % nVars; + ABC_SWAP( int, pVars[i], pVars[j] ); + } + sat_solver_set_var_activity( pSat, pVars, nVars ); + ABC_FREE( pVars ); +} + static inline abctime sat_solver_set_runtime_limit(sat_solver* s, abctime Limit) { abctime nRuntimeLimit = s->nRuntimeLimit; |