ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
AbcGlucose.cpp File Reference
Include dependency graph for AbcGlucose.cpp:

Go to the source code of this file.

Macros

#define USE_SIMP_SOLVER   1
 DECLARATIONS ///.
 
#define Gia_CubeForEachVar(pCube, Value, i)
 
#define Gia_SopForEachCube(pSop, nFanins, pCube)
 

Functions

SimpSolverglucose_solver_start ()
 FUNCTION DEFINITIONS ///.
 
void glucose_solver_stop (Gluco::SimpSolver *S)
 
void glucose_solver_reset (Gluco::SimpSolver *S)
 
int glucose_solver_addclause (Gluco::SimpSolver *S, int *plits, int nlits)
 
void glucose_solver_setcallback (Gluco::SimpSolver *S, void *pman, int(*pfunc)(void *, int, int *))
 
int glucose_solver_solve (Gluco::SimpSolver *S, int *plits, int nlits)
 
int glucose_solver_addvar (Gluco::SimpSolver *S)
 
int * glucose_solver_read_cex (Gluco::SimpSolver *S)
 
int glucose_solver_read_cex_varvalue (Gluco::SimpSolver *S, int ivar)
 
void glucose_solver_setstop (Gluco::SimpSolver *S, int *pstop)
 
bmcg_sat_solverbmcg_sat_solver_start ()
 MACRO DEFINITIONS ///.
 
void bmcg_sat_solver_stop (bmcg_sat_solver *s)
 
void bmcg_sat_solver_reset (bmcg_sat_solver *s)
 
int bmcg_sat_solver_addclause (bmcg_sat_solver *s, int *plits, int nlits)
 
void bmcg_sat_solver_setcallback (bmcg_sat_solver *s, void *pman, int(*pfunc)(void *, int, int *))
 
int bmcg_sat_solver_solve (bmcg_sat_solver *s, int *plits, int nlits)
 
int bmcg_sat_solver_final (bmcg_sat_solver *s, int **ppArray)
 
int bmcg_sat_solver_addvar (bmcg_sat_solver *s)
 
void bmcg_sat_solver_set_nvars (bmcg_sat_solver *s, int nvars)
 
int bmcg_sat_solver_eliminate (bmcg_sat_solver *s, int turn_off_elim)
 
int bmcg_sat_solver_var_is_elim (bmcg_sat_solver *s, int v)
 
void bmcg_sat_solver_var_set_frozen (bmcg_sat_solver *s, int v, int freeze)
 
int bmcg_sat_solver_elim_varnum (bmcg_sat_solver *s)
 
int * bmcg_sat_solver_read_cex (bmcg_sat_solver *s)
 
int bmcg_sat_solver_read_cex_varvalue (bmcg_sat_solver *s, int ivar)
 
void bmcg_sat_solver_set_stop (bmcg_sat_solver *s, int *pstop)
 
abctime bmcg_sat_solver_set_runtime_limit (bmcg_sat_solver *s, abctime Limit)
 
void bmcg_sat_solver_set_conflict_budget (bmcg_sat_solver *s, int Limit)
 
int bmcg_sat_solver_varnum (bmcg_sat_solver *s)
 
int bmcg_sat_solver_clausenum (bmcg_sat_solver *s)
 
int bmcg_sat_solver_learntnum (bmcg_sat_solver *s)
 
int bmcg_sat_solver_conflictnum (bmcg_sat_solver *s)
 
int bmcg_sat_solver_minimize_assumptions (bmcg_sat_solver *s, int *plits, int nlits, int pivot)
 
int bmcg_sat_solver_add_and (bmcg_sat_solver *s, int iVar, int iVar0, int iVar1, int fCompl0, int fCompl1, int fCompl)
 
int bmcg_solver_add_xor (bmcg_sat_solver *pSat, int iVarA, int iVarB, int iVarC, int fCompl)
 
int bmcg_sat_solver_jftr (bmcg_sat_solver *s)
 
void bmcg_sat_solver_set_jftr (bmcg_sat_solver *s, int jftr)
 
void bmcg_sat_solver_set_var_fanin_lit (bmcg_sat_solver *s, int var, int lit0, int lit1)
 
void bmcg_sat_solver_start_new_round (bmcg_sat_solver *s)
 
void bmcg_sat_solver_mark_cone (bmcg_sat_solver *s, int var)
 
void glucose_print_stats (SimpSolver &s, abctime clk)
 
void Glucose_ReadDimacs (char *pFileName, SimpSolver &s)
 
void Glucose_SolveCnf (char *pFileName, Glucose_Pars *pPars, int fDumpCnf)
 
Vec_Int_tGlucose_SolverFromAig (Gia_Man_t *p, SimpSolver &s)
 
Vec_Int_tGlucose_SolverFromAig2 (Gia_Man_t *p, SimpSolver &S)
 
Vec_Str_tGlucose_GenerateCubes (bmcg_sat_solver *pSat[2], Vec_Int_t *vCiSatVars, Vec_Int_t *vVar2Index, int CubeLimit)
 
Vec_Str_tbmcg_sat_solver_sop (Gia_Man_t *p, int CubeLimit)
 
void bmcg_sat_solver_print_sop (Gia_Man_t *p)
 
void bmcg_sat_solver_print_sop_lit (Gia_Man_t *p, int Lit)
 
void bmcg_sat_generate_dvars (Vec_Int_t *vCiVars, Vec_Str_t *vSop, Vec_Int_t *vDLits)
 
int bmcg_sat_solver_quantify2 (Gia_Man_t *p, int iLit, int fHash, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t *vDLits)
 
int Gia_ManSatAndCollect_rec (Gia_Man_t *p, int iObj, Vec_Int_t *vObjsUsed, Vec_Int_t *vCiVars)
 
void Gia_ManQuantLoadCnf (Gia_Man_t *p, Vec_Int_t *vObjsUsed, bmcg_sat_solver *pSats[])
 
int Gia_ManFactorSop (Gia_Man_t *p, Vec_Int_t *vCiObjIds, Vec_Str_t *vSop, int fHash)
 
int bmcg_sat_solver_quantify (bmcg_sat_solver *pSats[], Gia_Man_t *p, int iLit, int fHash, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t *vDLits)
 
int Gia_ManCiIsToKeep (void *pData, int i)
 
void Glucose_QuantifyAigTest (Gia_Man_t *p)
 
int bmcg_sat_solver_quantify_test (bmcg_sat_solver *pSats[], Gia_Man_t *p, int iLit, int fHash, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t *vDLits)
 
int bmcg_sat_solver_equiv_overlap_check (bmcg_sat_solver *pSat, Gia_Man_t *p, int iLit0, int iLit1, int fEquiv)
 
void Glucose_CheckTwoNodesTest (Gia_Man_t *p)
 
int Glucose_SolveAig (Gia_Man_t *p, Glucose_Pars *pPars)
 

Macro Definition Documentation

◆ Gia_CubeForEachVar

#define Gia_CubeForEachVar ( pCube,
Value,
i )
Value:
for ( i = 0; (pCube[i] != ' ') && (Value = pCube[i]); i++ )

Function*************************************************************

Synopsis [Computing d-literals.]

Description []

SideEffects []

SeeAlso []

Definition at line 1056 of file AbcGlucose.cpp.

1056#define Gia_CubeForEachVar( pCube, Value, i ) \
1057 for ( i = 0; (pCube[i] != ' ') && (Value = pCube[i]); i++ )

◆ Gia_SopForEachCube

#define Gia_SopForEachCube ( pSop,
nFanins,
pCube )
Value:
for ( pCube = (pSop); *pCube; pCube += (nFanins) + 3 )

Definition at line 1058 of file AbcGlucose.cpp.

1058#define Gia_SopForEachCube( pSop, nFanins, pCube ) \
1059 for ( pCube = (pSop); *pCube; pCube += (nFanins) + 3 )

◆ USE_SIMP_SOLVER

#define USE_SIMP_SOLVER   1

DECLARATIONS ///.

Definition at line 42 of file AbcGlucose.cpp.

Function Documentation

◆ bmcg_sat_generate_dvars()

void bmcg_sat_generate_dvars ( Vec_Int_t * vCiVars,
Vec_Str_t * vSop,
Vec_Int_t * vDLits )

Definition at line 1061 of file AbcGlucose.cpp.

1062{
1063 int i, Lit, Counter, nCubes = 0;
1064 char Value, * pCube, * pSop = Vec_StrArray( vSop );
1065 Vec_Int_t * vCounts = Vec_IntStart( 2*Vec_IntSize(vCiVars) );
1066 Vec_IntClear( vDLits );
1067 Gia_SopForEachCube( pSop, Vec_IntSize(vCiVars), pCube )
1068 {
1069 nCubes++;
1070 Gia_CubeForEachVar( pCube, Value, i )
1071 {
1072 if ( Value == '1' )
1073 Vec_IntAddToEntry( vCounts, 2*i, 1 );
1074 else if ( Value == '0' )
1075 Vec_IntAddToEntry( vCounts, 2*i+1, 1 );
1076 }
1077 }
1078 Vec_IntForEachEntry( vCounts, Counter, Lit )
1079 if ( Counter == nCubes )
1080 Vec_IntPush( vDLits, Abc_Var2Lit(Vec_IntEntry(vCiVars, Abc_Lit2Var(Lit)), Abc_LitIsCompl(Lit)) );
1081 Vec_IntSort( vDLits, 0 );
1082 Vec_IntFree( vCounts );
1083}
#define Gia_SopForEachCube(pSop, nFanins, pCube)
#define Gia_CubeForEachVar(pCube, Value, i)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ bmcg_sat_solver_add_and()

int bmcg_sat_solver_add_and ( bmcg_sat_solver * s,
int iVar,
int iVar0,
int iVar1,
int fCompl0,
int fCompl1,
int fCompl )

Definition at line 306 of file AbcGlucose.cpp.

307{
308 int Lits[3];
309
310 Lits[0] = Abc_Var2Lit( iVar, !fCompl );
311 Lits[1] = Abc_Var2Lit( iVar0, fCompl0 );
312 if ( !bmcg_sat_solver_addclause( s, Lits, 2 ) )
313 return 0;
314
315 Lits[0] = Abc_Var2Lit( iVar, !fCompl );
316 Lits[1] = Abc_Var2Lit( iVar1, fCompl1 );
317 if ( !bmcg_sat_solver_addclause( s, Lits, 2 ) )
318 return 0;
319
320 Lits[0] = Abc_Var2Lit( iVar, fCompl );
321 Lits[1] = Abc_Var2Lit( iVar0, !fCompl0 );
322 Lits[2] = Abc_Var2Lit( iVar1, !fCompl1 );
323 if ( !bmcg_sat_solver_addclause( s, Lits, 3 ) )
324 return 0;
325
326 return 1;
327}
int bmcg_sat_solver_addclause(bmcg_sat_solver *s, int *plits, int nlits)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_addclause()

int bmcg_sat_solver_addclause ( bmcg_sat_solver * s,
int * plits,
int nlits )

Definition at line 160 of file AbcGlucose.cpp.

161{
162 return glucose_solver_addclause((Gluco::SimpSolver*)s,plits,nlits);
163}
int glucose_solver_addclause(Gluco::SimpSolver *S, int *plits, int nlits)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_addvar()

int bmcg_sat_solver_addvar ( bmcg_sat_solver * s)

Definition at line 181 of file AbcGlucose.cpp.

182{
184}
int glucose_solver_addvar(Gluco::SimpSolver *S)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_clausenum()

int bmcg_sat_solver_clausenum ( bmcg_sat_solver * s)

Definition at line 249 of file AbcGlucose.cpp.

250{
251 return ((Gluco::SimpSolver*)s)->nClauses();
252}
Here is the caller graph for this function:

◆ bmcg_sat_solver_conflictnum()

int bmcg_sat_solver_conflictnum ( bmcg_sat_solver * s)

Definition at line 257 of file AbcGlucose.cpp.

258{
259 return ((Gluco::SimpSolver*)s)->conflicts;
260}
Here is the caller graph for this function:

◆ bmcg_sat_solver_elim_varnum()

int bmcg_sat_solver_elim_varnum ( bmcg_sat_solver * s)

Definition at line 210 of file AbcGlucose.cpp.

211{
212// return 0;
213 return ((Gluco::SimpSolver*)s)->eliminated_vars;
214}
Here is the caller graph for this function:

◆ bmcg_sat_solver_eliminate()

int bmcg_sat_solver_eliminate ( bmcg_sat_solver * s,
int turn_off_elim )

Definition at line 193 of file AbcGlucose.cpp.

194{
195// return 1;
196 return ((Gluco::SimpSolver*)s)->eliminate(turn_off_elim != 0);
197}
Here is the caller graph for this function:

◆ bmcg_sat_solver_equiv_overlap_check()

int bmcg_sat_solver_equiv_overlap_check ( bmcg_sat_solver * pSat,
Gia_Man_t * p,
int iLit0,
int iLit1,
int fEquiv )

Function*************************************************************

Synopsis [Checks equivalence or intersection of two nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1414 of file AbcGlucose.cpp.

1415{
1416 bmcg_sat_solver * pSats[2] = { pSat, NULL };
1417 Vec_Int_t * vObjsUsed = Vec_IntAlloc( 100 );
1418 int i, iVar, iSatVar[2], iSatLit[2], Lits[2], status;
1419 if ( Vec_IntSize(&p->vCopies) < Gia_ManObjNum(p) )
1420 Vec_IntFillExtra( &p->vCopies, Gia_ManObjNum(p), -1 );
1421
1422 // assign const0 variable number 0
1423 iVar = Vec_IntSize(vObjsUsed);
1424 Vec_IntPush( vObjsUsed, 0 );
1425 Gia_ObjSetCopyArray( p, 0, iVar );
1426 assert( iVar == 0 );
1427
1428 iSatVar[0] = Gia_ManSatAndCollect_rec( p, Abc_Lit2Var(iLit0), vObjsUsed, NULL );
1429 iSatVar[1] = Gia_ManSatAndCollect_rec( p, Abc_Lit2Var(iLit1), vObjsUsed, NULL );
1430
1431 iSatLit[0] = Abc_Var2Lit( iSatVar[0], Abc_LitIsCompl(iLit0) );
1432 iSatLit[1] = Abc_Var2Lit( iSatVar[1], Abc_LitIsCompl(iLit1) );
1433 Gia_ManQuantLoadCnf( p, vObjsUsed, pSats );
1434 Vec_IntForEachEntry( vObjsUsed, iVar, i )
1435 Gia_ObjSetCopyArray( p, iVar, -1 );
1436 Vec_IntFree( vObjsUsed );
1437
1438 if ( fEquiv )
1439 {
1440 Lits[0] = iSatLit[0];
1441 Lits[1] = Abc_LitNot(iSatLit[1]);
1442 status = bmcg_sat_solver_solve( pSats[0], Lits, 2 );
1443 if ( status == GLUCOSE_UNSAT )
1444 {
1445 Lits[0] = Abc_LitNot(iSatLit[0]);
1446 Lits[1] = iSatLit[1];
1447 status = bmcg_sat_solver_solve( pSats[0], Lits, 2 );
1448 }
1449 return status == GLUCOSE_UNSAT;
1450 }
1451 else
1452 {
1453 Lits[0] = iSatLit[0];
1454 Lits[1] = iSatLit[1];
1455 status = bmcg_sat_solver_solve( pSats[0], Lits, 2 );
1456 return status == GLUCOSE_SAT;
1457 }
1458}
void Gia_ManQuantLoadCnf(Gia_Man_t *p, Vec_Int_t *vObjsUsed, bmcg_sat_solver *pSats[])
int Gia_ManSatAndCollect_rec(Gia_Man_t *p, int iObj, Vec_Int_t *vObjsUsed, Vec_Int_t *vCiVars)
int bmcg_sat_solver_solve(bmcg_sat_solver *s, int *plits, int nlits)
#define GLUCOSE_UNSAT
INCLUDES ///.
Definition AbcGlucose.h:34
void bmcg_sat_solver
Definition AbcGlucose.h:63
#define GLUCOSE_SAT
Definition AbcGlucose.h:35
Cube * p
Definition exorList.c:222
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_final()

int bmcg_sat_solver_final ( bmcg_sat_solver * s,
int ** ppArray )

Definition at line 175 of file AbcGlucose.cpp.

176{
177 *ppArray = (int *)(Lit *)((Gluco::SimpSolver*)s)->conflict;
178 return ((Gluco::SimpSolver*)s)->conflict.size();
179}
Here is the caller graph for this function:

◆ bmcg_sat_solver_jftr()

int bmcg_sat_solver_jftr ( bmcg_sat_solver * s)

Definition at line 361 of file AbcGlucose.cpp.

362{
363 return ((Gluco::SimpSolver*)s)->jftr;
364}

◆ bmcg_sat_solver_learntnum()

int bmcg_sat_solver_learntnum ( bmcg_sat_solver * s)

Definition at line 253 of file AbcGlucose.cpp.

254{
255 return ((Gluco::SimpSolver*)s)->nLearnts();
256}
Here is the caller graph for this function:

◆ bmcg_sat_solver_mark_cone()

void bmcg_sat_solver_mark_cone ( bmcg_sat_solver * s,
int var )

Definition at line 381 of file AbcGlucose.cpp.

382{
383 ((Gluco::SimpSolver*)s)->sat_solver_mark_cone(var);
384}
int var(Lit p)
Definition SolverTypes.h:71
Here is the call graph for this function:

◆ bmcg_sat_solver_minimize_assumptions()

int bmcg_sat_solver_minimize_assumptions ( bmcg_sat_solver * s,
int * plits,
int nlits,
int pivot )

Definition at line 262 of file AbcGlucose.cpp.

263{
264 vec<int>*array = &((Gluco::SimpSolver*)s)->user_vec;
265 int i, nlitsL, nlitsR, nresL, nresR, status;
266 assert( pivot >= 0 );
267// assert( nlits - pivot >= 2 );
268 assert( nlits - pivot >= 1 );
269 if ( nlits - pivot == 1 )
270 {
271 // since the problem is UNSAT, we try to solve it without assuming the last literal
272 // if the result is UNSAT, the last literal can be dropped; otherwise, it is needed
273 status = bmcg_sat_solver_solve( s, plits, pivot );
274 return status != GLUCOSE_UNSAT; // return 1 if the problem is not UNSAT
275 }
276 assert( nlits - pivot >= 2 );
277 nlitsL = (nlits - pivot) / 2;
278 nlitsR = (nlits - pivot) - nlitsL;
279 assert( nlitsL + nlitsR == nlits - pivot );
280 // solve with these assumptions
281 status = bmcg_sat_solver_solve( s, plits, pivot + nlitsL );
282 if ( status == GLUCOSE_UNSAT ) // these are enough
283 return bmcg_sat_solver_minimize_assumptions( s, plits, pivot + nlitsL, pivot );
284 // these are not enough
285 // solve for the right lits
286// nResL = nLitsR == 1 ? 1 : sat_solver_minimize_assumptions( s, pLits + nLitsL, nLitsR, nConfLimit );
287 nresL = nlitsR == 1 ? 1 : bmcg_sat_solver_minimize_assumptions( s, plits, nlits, pivot + nlitsL );
288 // swap literals
289 array->clear();
290 for ( i = 0; i < nlitsL; i++ )
291 array->push(plits[pivot + i]);
292 for ( i = 0; i < nresL; i++ )
293 plits[pivot + i] = plits[pivot + nlitsL + i];
294 for ( i = 0; i < nlitsL; i++ )
295 plits[pivot + nresL + i] = (*array)[i];
296 // solve with these assumptions
297 status = bmcg_sat_solver_solve( s, plits, pivot + nresL );
298 if ( status == GLUCOSE_UNSAT ) // these are enough
299 return nresL;
300 // solve for the left lits
301// nResR = nLitsL == 1 ? 1 : sat_solver_minimize_assumptions( s, pLits + nResL, nLitsL, nConfLimit );
302 nresR = nlitsL == 1 ? 1 : bmcg_sat_solver_minimize_assumptions( s, plits, pivot + nresL + nlitsL, pivot + nresL );
303 return nresL + nresR;
304}
int bmcg_sat_solver_minimize_assumptions(bmcg_sat_solver *s, int *plits, int nlits, int pivot)
void clear(bool dealloc=false)
Definition Vec.h:124
void push(void)
Definition Vec.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_print_sop()

void bmcg_sat_solver_print_sop ( Gia_Man_t * p)

Definition at line 1023 of file AbcGlucose.cpp.

1024{
1025 Vec_Str_t * vSop = bmcg_sat_solver_sop( p, 0 );
1026 printf( "%s", Vec_StrArray(vSop) );
1027 Vec_StrFree( vSop );
1028}
Vec_Str_t * bmcg_sat_solver_sop(Gia_Man_t *p, int CubeLimit)
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_print_sop_lit()

void bmcg_sat_solver_print_sop_lit ( Gia_Man_t * p,
int Lit )

Definition at line 1029 of file AbcGlucose.cpp.

1030{
1031 Vec_Int_t * vCisUsed = Vec_IntAlloc( 100 );
1032 int i, ObjId, iNode = Abc_Lit2Var( Lit );
1033 Gia_ManCollectCis( p, &iNode, 1, vCisUsed );
1034 Vec_IntSort( vCisUsed, 0 );
1035 Vec_IntForEachEntry( vCisUsed, ObjId, i )
1036 Vec_IntWriteEntry( vCisUsed, i, Gia_ManIdToCioId(p, ObjId) );
1037 Vec_IntPrint( vCisUsed );
1038 Gia_Man_t * pNew = Gia_ManDupConeSupp( p, Lit, vCisUsed );
1039 Vec_IntFree( vCisUsed );
1041 Gia_ManStop( pNew );
1042 printf( "\n" );
1043}
void bmcg_sat_solver_print_sop(Gia_Man_t *p)
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManDupConeSupp(Gia_Man_t *p, int iLit, Vec_Int_t *vCiIds)
Definition giaDup.c:2235
void Gia_ManCollectCis(Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vSupp)
Definition giaDfs.c:71
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_quantify()

int bmcg_sat_solver_quantify ( bmcg_sat_solver * pSats[],
Gia_Man_t * p,
int iLit,
int fHash,
int(* pFuncCiToKeep )(void *, int),
void * pData,
Vec_Int_t * vDLits )

Definition at line 1256 of file AbcGlucose.cpp.

1257{
1258 Vec_Int_t * vObjsUsed = Vec_IntAlloc( 100 ); // GIA objs
1259 Vec_Int_t * vCiVars = Vec_IntAlloc( 100 ); // CI SAT vars
1260 Vec_Int_t * vVarMap = NULL; Vec_Str_t * vSop = NULL;
1261 int i, iVar, iVarLast, Lit, RetValue, Count = 0, Result = -1;
1262 if ( vDLits ) Vec_IntClear( vDLits );
1263 if ( iLit < 2 )
1264 return iLit;
1265 if ( Vec_IntSize(&p->vCopies) < Gia_ManObjNum(p) )
1266 Vec_IntFillExtra( &p->vCopies, Gia_ManObjNum(p), -1 );
1267 // assign variable number 0 to const0 node
1268 iVar = Vec_IntSize(vObjsUsed);
1269 Vec_IntPush( vObjsUsed, 0 );
1270 Gia_ObjSetCopyArray( p, 0, iVar );
1271 assert( iVar == 0 );
1272
1273 // collect other variables
1274 iVarLast = Gia_ManSatAndCollect_rec( p, Abc_Lit2Var(iLit), vObjsUsed, vCiVars );
1275 Gia_ManQuantLoadCnf( p, vObjsUsed, pSats );
1276
1277 // check constants
1278 Lit = Abc_Var2Lit( iVarLast, !Abc_LitIsCompl(iLit) );
1279 RetValue = bmcg_sat_solver_addclause( pSats[0], &Lit, 1 ); // offset
1280 if ( !RetValue || bmcg_sat_solver_solve(pSats[0], NULL, 0) == GLUCOSE_UNSAT )
1281 {
1282 Result = 1;
1283 goto cleanup;
1284 }
1285 Lit = Abc_Var2Lit( iVarLast, Abc_LitIsCompl(iLit) );
1286 RetValue = bmcg_sat_solver_addclause( pSats[1], &Lit, 1 ); // onset
1287 if ( !RetValue || bmcg_sat_solver_solve(pSats[1], NULL, 0) == GLUCOSE_UNSAT )
1288 {
1289 Result = 0;
1290 goto cleanup;
1291 }
1292/*
1293 // reorder CI SAT variables to have keep-vars first
1294 Vec_Int_t * vCiVars2 = Vec_IntAlloc( 100 ); // CI SAT vars
1295 Vec_IntForEachEntry( vCiVars, iVar, i )
1296 {
1297 Gia_Obj_t * pObj = Gia_ManObj( p, Vec_IntEntry(vObjsUsed, iVar) );
1298 assert( Gia_ObjIsCi(pObj) );
1299 if ( pFuncCiToKeep(pData, Gia_ObjCioId(pObj)) )
1300 Vec_IntPush( vCiVars2, iVar );
1301 }
1302 Vec_IntForEachEntry( vCiVars, iVar, i )
1303 {
1304 Gia_Obj_t * pObj = Gia_ManObj( p, Vec_IntEntry(vObjsUsed, iVar) );
1305 assert( Gia_ObjIsCi(pObj) );
1306 if ( !pFuncCiToKeep(pData, Gia_ObjCioId(pObj)) )
1307 Vec_IntPush( vCiVars2, iVar );
1308 }
1309 ABC_SWAP( Vec_Int_t *, vCiVars2, vCiVars );
1310 Vec_IntFree( vCiVars2 );
1311*/
1312 // map CI SAT variables into their indexes used in the cubes
1313 vVarMap = Vec_IntStartFull( Vec_IntSize(vObjsUsed) );
1314 Vec_IntForEachEntry( vCiVars, iVar, i )
1315 {
1316 Gia_Obj_t * pObj = Gia_ManObj( p, Vec_IntEntry(vObjsUsed, iVar) );
1317 assert( Gia_ObjIsCi(pObj) );
1318 if ( pFuncCiToKeep(pData, Gia_ObjCioId(pObj)) )
1319 Vec_IntWriteEntry( vVarMap, iVar, i ), Count++;
1320 }
1321 if ( Count == 0 || Count == Vec_IntSize(vCiVars) )
1322 {
1323 Result = Count == 0 ? 1 : iLit;
1324 goto cleanup;
1325 }
1326 // generate cubes
1327 vSop = Glucose_GenerateCubes( pSats, vCiVars, vVarMap, 0 );
1328 //printf( "%s", Vec_StrArray(vSop) );
1329 // convert into object IDs
1330 Vec_IntForEachEntry( vCiVars, iVar, i )
1331 Vec_IntWriteEntry( vCiVars, i, Vec_IntEntry(vObjsUsed, iVar) );
1332 // generate unate variables
1333 if ( vDLits )
1334 bmcg_sat_generate_dvars( vCiVars, vSop, vDLits );
1335 // convert into an AIG
1336 RetValue = Gia_ManAndNum(p);
1337 Result = Gia_ManFactorSop( p, vCiVars, vSop, fHash );
1338
1339 // report the result
1340// printf( "Performed quantification with %5d nodes, %3d keep-vars, %3d quant-vars, resulting in %5d cubes and %5d nodes. ",
1341// Vec_IntSize(vObjsUsed), Count, Vec_IntSize(vCiVars) - Count, Vec_StrCountEntry(vSop, '\n'), Gia_ManAndNum(p)-RetValue );
1342// Abc_PrintTime( 1, "Time", Abc_Clock() - clkAll );
1343
1344cleanup:
1345 Vec_IntForEachEntry( vObjsUsed, iVar, i )
1346 Gia_ObjSetCopyArray( p, iVar, -1 );
1347 Vec_IntFree( vObjsUsed );
1348 Vec_IntFree( vCiVars );
1349 Vec_IntFreeP( &vVarMap );
1350 Vec_StrFreeP( &vSop );
1351 return Result;
1352}
Vec_Str_t * Glucose_GenerateCubes(bmcg_sat_solver *pSat[2], Vec_Int_t *vCiSatVars, Vec_Int_t *vVar2Index, int CubeLimit)
int Gia_ManFactorSop(Gia_Man_t *p, Vec_Int_t *vCiObjIds, Vec_Str_t *vSop, int fHash)
void bmcg_sat_generate_dvars(Vec_Int_t *vCiVars, Vec_Str_t *vSop, Vec_Int_t *vDLits)
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_quantify2()

int bmcg_sat_solver_quantify2 ( Gia_Man_t * p,
int iLit,
int fHash,
int(* pFuncCiToKeep )(void *, int),
void * pData,
Vec_Int_t * vDLits )

Function*************************************************************

Synopsis [Performs SAT-based quantification.]

Description []

SideEffects []

SeeAlso []

Definition at line 1096 of file AbcGlucose.cpp.

1097{
1098 int fSynthesize = 0;
1099 extern Gia_Man_t * Abc_SopSynthesizeOne( char * pSop, int fClp );
1100 Gia_Man_t * pMan, * pNew, * pTemp; Vec_Str_t * vSop;
1101 int i, CiId, ObjId, Res, nCubes = 0, nNodes, Count = 0, iNode = Abc_Lit2Var(iLit);
1102 Vec_Int_t * vCisUsed = Vec_IntAlloc( 100 );
1103 Gia_ManCollectCis( p, &iNode, 1, vCisUsed );
1104 Vec_IntSort( vCisUsed, 0 );
1105 if ( vDLits ) Vec_IntClear( vDLits );
1106 if ( iLit < 2 )
1107 return iLit;
1108 // remap into CI Ids
1109 Vec_IntForEachEntry( vCisUsed, ObjId, i )
1110 Vec_IntWriteEntry( vCisUsed, i, Gia_ManIdToCioId(p, ObjId) );
1111 // duplicate cone
1112 pNew = Gia_ManDupConeSupp( p, iLit, vCisUsed );
1113 assert( Gia_ManCiNum(pNew) == Vec_IntSize(vCisUsed) );
1114 nNodes = Gia_ManAndNum(pNew);
1115
1116 // perform quantification one CI at a time
1117 assert( pFuncCiToKeep );
1118 Vec_IntForEachEntry( vCisUsed, CiId, i )
1119 if ( !pFuncCiToKeep( pData, CiId ) )
1120 {
1121 //printf( "Quantifying %d.\n", CiId );
1122 pNew = Gia_ManDupExist( pTemp = pNew, i );
1123 Gia_ManStop( pTemp );
1124 Count++;
1125 }
1126 if ( Gia_ManPoIsConst(pNew, 0) )
1127 {
1128 int RetValue = Gia_ManPoIsConst1(pNew, 0);
1129 Vec_IntFree( vCisUsed );
1130 Gia_ManStop( pNew );
1131 return RetValue;
1132 }
1133
1134 if ( fSynthesize )
1135 {
1136 vSop = bmcg_sat_solver_sop( pNew, 0 );
1137 Gia_ManStop( pNew );
1138 pMan = Abc_SopSynthesizeOne( Vec_StrArray(vSop), 1 );
1139 nCubes = Vec_StrCountEntry(vSop, '\n');
1140 if ( vDLits )
1141 {
1142 // convert into object IDs
1143 Vec_Int_t * vCisObjs = Vec_IntAlloc( Vec_IntSize(vCisUsed) );
1144 Vec_IntForEachEntry( vCisUsed, CiId, i )
1145 Vec_IntPush( vCisObjs, CiId + 1 );
1146 bmcg_sat_generate_dvars( vCisObjs, vSop, vDLits );
1147 Vec_IntFree( vCisObjs );
1148 }
1149 Vec_StrFree( vSop );
1150
1151 if ( Gia_ManPoIsConst(pMan, 0) )
1152 {
1153 int RetValue = Gia_ManPoIsConst1(pMan, 0);
1154 Vec_IntFree( vCisUsed );
1155 Gia_ManStop( pMan );
1156 return RetValue;
1157 }
1158 }
1159 else
1160 {
1161 pMan = pNew;
1162 }
1163
1164 Res = Gia_ManDupConeBack( p, pMan, vCisUsed );
1165
1166 // report the result
1167 //printf( "Performed quantification with %5d nodes, %3d keep-vars, %3d quant-vars, resulting in %5d cubes and %5d nodes. ",
1168 // nNodes, Vec_IntSize(vCisUsed) - Count, Count, nCubes, Gia_ManAndNum(pMan) );
1169 //Abc_PrintTime( 1, "Time", Abc_Clock() - clkAll );
1170
1171 Vec_IntFree( vCisUsed );
1172 Gia_ManStop( pMan );
1173 return Res;
1174}
ABC_DLL Gia_Man_t * Abc_SopSynthesizeOne(char *pSop, int fClp)
Definition abcUtil.c:3244
Gia_Man_t * Gia_ManDupExist(Gia_Man_t *p, int iVar)
Definition giaDup.c:2012
int Gia_ManDupConeBack(Gia_Man_t *p, Gia_Man_t *pNew, Vec_Int_t *vCiIds)
Definition giaDup.c:2270
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_quantify_test()

int bmcg_sat_solver_quantify_test ( bmcg_sat_solver * pSats[],
Gia_Man_t * p,
int iLit,
int fHash,
int(* pFuncCiToKeep )(void *, int),
void * pData,
Vec_Int_t * vDLits )

Definition at line 1384 of file AbcGlucose.cpp.

1385{
1386 extern int Gia_ManQuantExist( Gia_Man_t * p, int iLit, int(*pFuncCiToKeep)(void *, int), void * pData );
1387 int Res1 = Gia_ManQuantExist( p, iLit, pFuncCiToKeep, pData );
1388 int Res2 = bmcg_sat_solver_quantify2( p, iLit, 1, pFuncCiToKeep, pData, NULL );
1389
1391 if ( bmcg_sat_solver_equiv_overlap_check( pSat, p, Res1, Res2, 1 ) )
1392 printf( "Verification passed.\n" );
1393 else
1394 {
1395 printf( "Verification FAILED.\n" );
1398 printf( "\n" );
1399 }
1400 return Res1;
1401}
bmcg_sat_solver * bmcg_sat_solver_start()
MACRO DEFINITIONS ///.
void bmcg_sat_solver_print_sop_lit(Gia_Man_t *p, int Lit)
int bmcg_sat_solver_quantify2(Gia_Man_t *p, int iLit, int fHash, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t *vDLits)
int bmcg_sat_solver_equiv_overlap_check(bmcg_sat_solver *pSat, Gia_Man_t *p, int iLit0, int iLit1, int fEquiv)
int Gia_ManQuantExist(Gia_Man_t *p, int iLit, int(*pFuncCiToKeep)(void *, int), void *pData)
Definition giaExist.c:505
Here is the call graph for this function:

◆ bmcg_sat_solver_read_cex()

int * bmcg_sat_solver_read_cex ( bmcg_sat_solver * s)

Definition at line 216 of file AbcGlucose.cpp.

217{
219}
int * glucose_solver_read_cex(Gluco::SimpSolver *S)
Here is the call graph for this function:

◆ bmcg_sat_solver_read_cex_varvalue()

int bmcg_sat_solver_read_cex_varvalue ( bmcg_sat_solver * s,
int ivar )

Definition at line 220 of file AbcGlucose.cpp.

221{
223}
int glucose_solver_read_cex_varvalue(Gluco::SimpSolver *S, int ivar)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_reset()

void bmcg_sat_solver_reset ( bmcg_sat_solver * s)

Definition at line 154 of file AbcGlucose.cpp.

155{
157}
void glucose_solver_reset(Gluco::SimpSolver *S)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_set_conflict_budget()

void bmcg_sat_solver_set_conflict_budget ( bmcg_sat_solver * s,
int Limit )

Definition at line 237 of file AbcGlucose.cpp.

238{
239 if ( Limit > 0 )
240 ((Gluco::SimpSolver*)s)->setConfBudget( (int64_t)Limit );
241 else
242 ((Gluco::SimpSolver*)s)->budgetOff();
243}
Here is the caller graph for this function:

◆ bmcg_sat_solver_set_jftr()

void bmcg_sat_solver_set_jftr ( bmcg_sat_solver * s,
int jftr )

Definition at line 366 of file AbcGlucose.cpp.

367{
368 ((Gluco::SimpSolver*)s)->jftr = jftr;
369}

◆ bmcg_sat_solver_set_nvars()

void bmcg_sat_solver_set_nvars ( bmcg_sat_solver * s,
int nvars )

Definition at line 186 of file AbcGlucose.cpp.

187{
188 int i;
189 for ( i = bmcg_sat_solver_varnum(s); i < nvars; i++ )
191}
int bmcg_sat_solver_varnum(bmcg_sat_solver *s)
int bmcg_sat_solver_addvar(bmcg_sat_solver *s)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_set_runtime_limit()

abctime bmcg_sat_solver_set_runtime_limit ( bmcg_sat_solver * s,
abctime Limit )

Definition at line 230 of file AbcGlucose.cpp.

231{
232 abctime nRuntimeLimit = ((Gluco::SimpSolver*)s)->nRuntimeLimit;
233 ((Gluco::SimpSolver*)s)->nRuntimeLimit = Limit;
234 return nRuntimeLimit;
235}
ABC_INT64_T abctime
Definition abc_global.h:332
Here is the caller graph for this function:

◆ bmcg_sat_solver_set_stop()

void bmcg_sat_solver_set_stop ( bmcg_sat_solver * s,
int * pstop )

Definition at line 225 of file AbcGlucose.cpp.

226{
228}
void glucose_solver_setstop(Gluco::SimpSolver *S, int *pstop)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_set_var_fanin_lit()

void bmcg_sat_solver_set_var_fanin_lit ( bmcg_sat_solver * s,
int var,
int lit0,
int lit1 )

Definition at line 371 of file AbcGlucose.cpp.

372{
373 ((Gluco::SimpSolver*)s)->sat_solver_set_var_fanin_lit(var, lit0, lit1);
374}
Here is the call graph for this function:

◆ bmcg_sat_solver_setcallback()

void bmcg_sat_solver_setcallback ( bmcg_sat_solver * s,
void * pman,
int(* pfunc )(void *, int, int *) )

Definition at line 165 of file AbcGlucose.cpp.

166{
168}
void glucose_solver_setcallback(Gluco::SimpSolver *S, void *pman, int(*pfunc)(void *, int, int *))
Here is the call graph for this function:

◆ bmcg_sat_solver_solve()

int bmcg_sat_solver_solve ( bmcg_sat_solver * s,
int * plits,
int nlits )

Definition at line 170 of file AbcGlucose.cpp.

171{
172 return glucose_solver_solve((Gluco::SimpSolver*)s,plits,nlits);
173}
int glucose_solver_solve(Gluco::SimpSolver *S, int *plits, int nlits)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_sop()

Vec_Str_t * bmcg_sat_solver_sop ( Gia_Man_t * p,
int CubeLimit )

Definition at line 980 of file AbcGlucose.cpp.

981{
983
984 // generate CNF for the on-set and off-set
985 Cnf_Dat_t * pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( p, 8 /*nLutSize*/, 0 /*fCnfObjIds*/, 0/*fAddOrCla*/, 0, 0/*verbose*/ );
986 int i, n, nVars = Gia_ManCiNum(p), Lit;//, Count = 0;
987 int iFirstVar = pCnf->nVars - nVars;
988 assert( Gia_ManCoNum(p) == 1 );
989 for ( n = 0; n < 2; n++ )
990 {
991 bmcg_sat_solver_set_nvars( pSat[n], pCnf->nVars );
992 Lit = Abc_Var2Lit( 1, !n ); // output variable is 1
993 for ( i = 0; i < pCnf->nClauses; i++ )
994 if ( !bmcg_sat_solver_addclause( pSat[n], pCnf->pClauses[i], pCnf->pClauses[i+1]-pCnf->pClauses[i] ) )
995 assert( 0 );
996 if ( !bmcg_sat_solver_addclause( pSat[n], &Lit, 1 ) )
997 {
998 Vec_Str_t * vSop = Vec_StrAlloc( 10 );
999 Vec_StrPrintF( vSop, " %d\n\0", !n );
1000 Cnf_DataFree( pCnf );
1001 return vSop;
1002 }
1003 }
1004 Cnf_DataFree( pCnf );
1005
1006 // collect cube vars and map SAT vars into them
1007 Vec_Int_t * vVars = Vec_IntAlloc( 100 );
1008 Vec_Int_t * vVarMap = Vec_IntStartFull( iFirstVar + nVars );
1009 for ( i = 0; i < nVars; i++ )
1010 {
1011 Vec_IntPush( vVars, iFirstVar+i );
1012 Vec_IntWriteEntry( vVarMap, iFirstVar+i, i );
1013 }
1014
1015 Vec_Str_t * vSop = Glucose_GenerateCubes( pSat, vVars, vVarMap, CubeLimit );
1016 Vec_IntFree( vVarMap );
1017 Vec_IntFree( vVars );
1018
1019 bmcg_sat_solver_stop( pSat[0] );
1020 bmcg_sat_solver_stop( pSat[1] );
1021 return vSop;
1022}
void bmcg_sat_solver_set_nvars(bmcg_sat_solver *s, int nvars)
void bmcg_sat_solver_stop(bmcg_sat_solver *s)
struct Cnf_Dat_t_ Cnf_Dat_t
Definition cnf.h:52
void Cnf_DataFree(Cnf_Dat_t *p)
Definition cnfMan.c:207
void * Mf_ManGenerateCnf(Gia_Man_t *pGia, int nLutSize, int fCnfObjIds, int fAddOrCla, int fMapping, int fVerbose)
Definition giaMf.c:1877
int nVars
Definition cnf.h:59
int ** pClauses
Definition cnf.h:62
int nClauses
Definition cnf.h:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_start()

bmcg_sat_solver * bmcg_sat_solver_start ( )

MACRO DEFINITIONS ///.

Function*************************************************************

Synopsis [Wrapper APIs to calling from ABC.]

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file AbcGlucose.cpp.

147{
149}
SimpSolver * glucose_solver_start()
FUNCTION DEFINITIONS ///.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_start_new_round()

void bmcg_sat_solver_start_new_round ( bmcg_sat_solver * s)

Definition at line 376 of file AbcGlucose.cpp.

377{
378 ((Gluco::SimpSolver*)s)->sat_solver_start_new_round();
379}

◆ bmcg_sat_solver_stop()

void bmcg_sat_solver_stop ( bmcg_sat_solver * s)

Definition at line 150 of file AbcGlucose.cpp.

151{
153}
void glucose_solver_stop(Gluco::SimpSolver *S)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bmcg_sat_solver_var_is_elim()

int bmcg_sat_solver_var_is_elim ( bmcg_sat_solver * s,
int v )

Definition at line 199 of file AbcGlucose.cpp.

200{
201// return 0;
202 return ((Gluco::SimpSolver*)s)->isEliminated(v);
203}
Here is the caller graph for this function:

◆ bmcg_sat_solver_var_set_frozen()

void bmcg_sat_solver_var_set_frozen ( bmcg_sat_solver * s,
int v,
int freeze )

Definition at line 205 of file AbcGlucose.cpp.

206{
207 ((Gluco::SimpSolver*)s)->setFrozen(v, freeze != 0);
208}
Here is the caller graph for this function:

◆ bmcg_sat_solver_varnum()

int bmcg_sat_solver_varnum ( bmcg_sat_solver * s)

Definition at line 245 of file AbcGlucose.cpp.

246{
247 return ((Gluco::SimpSolver*)s)->nVars();
248}
Here is the caller graph for this function:

◆ bmcg_solver_add_xor()

int bmcg_solver_add_xor ( bmcg_sat_solver * pSat,
int iVarA,
int iVarB,
int iVarC,
int fCompl )

Definition at line 329 of file AbcGlucose.cpp.

330{
331 int Lits[3];
332 int Cid;
333 assert( iVarA >= 0 && iVarB >= 0 && iVarC >= 0 );
334
335 Lits[0] = Abc_Var2Lit( iVarA, !fCompl );
336 Lits[1] = Abc_Var2Lit( iVarB, 1 );
337 Lits[2] = Abc_Var2Lit( iVarC, 1 );
338 Cid = bmcg_sat_solver_addclause( pSat, Lits, 3 );
339 assert( Cid );
340
341 Lits[0] = Abc_Var2Lit( iVarA, !fCompl );
342 Lits[1] = Abc_Var2Lit( iVarB, 0 );
343 Lits[2] = Abc_Var2Lit( iVarC, 0 );
344 Cid = bmcg_sat_solver_addclause( pSat, Lits, 3 );
345 assert( Cid );
346
347 Lits[0] = Abc_Var2Lit( iVarA, fCompl );
348 Lits[1] = Abc_Var2Lit( iVarB, 1 );
349 Lits[2] = Abc_Var2Lit( iVarC, 0 );
350 Cid = bmcg_sat_solver_addclause( pSat, Lits, 3 );
351 assert( Cid );
352
353 Lits[0] = Abc_Var2Lit( iVarA, fCompl );
354 Lits[1] = Abc_Var2Lit( iVarB, 0 );
355 Lits[2] = Abc_Var2Lit( iVarC, 1 );
356 Cid = bmcg_sat_solver_addclause( pSat, Lits, 3 );
357 assert( Cid );
358 return 4;
359}
Here is the call graph for this function:

◆ Gia_ManCiIsToKeep()

int Gia_ManCiIsToKeep ( void * pData,
int i )

Definition at line 1353 of file AbcGlucose.cpp.

1354{
1355 return i % 5 != 0;
1356}
Here is the caller graph for this function:

◆ Gia_ManFactorSop()

int Gia_ManFactorSop ( Gia_Man_t * p,
Vec_Int_t * vCiObjIds,
Vec_Str_t * vSop,
int fHash )

Definition at line 1237 of file AbcGlucose.cpp.

1238{
1239 extern Gia_Man_t * Abc_SopSynthesizeOne( char * pSop, int fClp );
1240 Gia_Man_t * pMan = Abc_SopSynthesizeOne( Vec_StrArray(vSop), 1 );
1241 Gia_Obj_t * pObj; int i, Result;
1242 assert( Gia_ManPiNum(pMan) == Vec_IntSize(vCiObjIds) );
1243 Gia_ManConst0(pMan)->Value = 0;
1244 Gia_ManForEachPi( pMan, pObj, i )
1245 pObj->Value = Abc_Var2Lit( Vec_IntEntry(vCiObjIds, i), 0 );
1246 Gia_ManForEachAnd( pMan, pObj, i )
1247 if ( fHash )
1248 pObj->Value = Gia_ManHashAnd( p, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1249 else
1250 pObj->Value = Gia_ManAppendAnd( p, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1251 pObj = Gia_ManPo(pMan, 0);
1252 Result = Gia_ObjFanin0Copy(pObj);
1253 Gia_ManStop( pMan );
1254 return Result;
1255}
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
unsigned Value
Definition gia.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManQuantLoadCnf()

void Gia_ManQuantLoadCnf ( Gia_Man_t * p,
Vec_Int_t * vObjsUsed,
bmcg_sat_solver * pSats[] )

Definition at line 1207 of file AbcGlucose.cpp.

1208{
1209 Gia_Obj_t * pObj; int i;
1210 bmcg_sat_solver_reset( pSats[0] );
1211 if ( pSats[1] )
1212 bmcg_sat_solver_reset( pSats[1] );
1213 bmcg_sat_solver_set_nvars( pSats[0], Vec_IntSize(vObjsUsed) );
1214 if ( pSats[1] )
1215 bmcg_sat_solver_set_nvars( pSats[1], Vec_IntSize(vObjsUsed) );
1216 Gia_ManForEachObjVec( vObjsUsed, p, pObj, i )
1217 if ( Gia_ObjIsAnd(pObj) )
1218 {
1219 int iObj = Gia_ObjId( p, pObj );
1220 int iVar = Gia_ObjCopyArray(p, iObj);
1221 int iVar0 = Gia_ObjCopyArray(p, Gia_ObjFaninId0(pObj, iObj));
1222 int iVar1 = Gia_ObjCopyArray(p, Gia_ObjFaninId1(pObj, iObj));
1223 bmcg_sat_solver_add_and( pSats[0], iVar, iVar0, iVar1, Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
1224 if ( pSats[1] )
1225 bmcg_sat_solver_add_and( pSats[1], iVar, iVar0, iVar1, Gia_ObjFaninC0(pObj), Gia_ObjFaninC1(pObj), 0 );
1226 }
1227 else if ( Gia_ObjIsConst0(pObj) )
1228 {
1229 int Lit = Abc_Var2Lit( Gia_ObjCopyArray(p, 0), 1 );
1230 int RetValue = bmcg_sat_solver_addclause( pSats[0], &Lit, 1 );
1231 assert( RetValue );
1232 if ( pSats[1] )
1233 bmcg_sat_solver_addclause( pSats[1], &Lit, 1 );
1234 assert( Lit == 1 );
1235 }
1236}
void bmcg_sat_solver_reset(bmcg_sat_solver *s)
int bmcg_sat_solver_add_and(bmcg_sat_solver *s, int iVar, int iVar0, int iVar1, int fCompl0, int fCompl1, int fCompl)
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSatAndCollect_rec()

int Gia_ManSatAndCollect_rec ( Gia_Man_t * p,
int iObj,
Vec_Int_t * vObjsUsed,
Vec_Int_t * vCiVars )

Function*************************************************************

Synopsis [Performs SAT-based quantification.]

Description []

SideEffects []

SeeAlso []

Definition at line 1188 of file AbcGlucose.cpp.

1189{
1190 Gia_Obj_t * pObj; int iVar;
1191 if ( (iVar = Gia_ObjCopyArray(p, iObj)) >= 0 )
1192 return iVar;
1193 pObj = Gia_ManObj( p, iObj );
1194 assert( Gia_ObjIsCand(pObj) );
1195 if ( Gia_ObjIsAnd(pObj) )
1196 {
1197 Gia_ManSatAndCollect_rec( p, Gia_ObjFaninId0(pObj, iObj), vObjsUsed, vCiVars );
1198 Gia_ManSatAndCollect_rec( p, Gia_ObjFaninId1(pObj, iObj), vObjsUsed, vCiVars );
1199 }
1200 iVar = Vec_IntSize( vObjsUsed );
1201 Vec_IntPush( vObjsUsed, iObj );
1202 Gia_ObjSetCopyArray( p, iObj, iVar );
1203 if ( vCiVars && Gia_ObjIsCi(pObj) )
1204 Vec_IntPush( vCiVars, iVar );
1205 return iVar;
1206}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Glucose_CheckTwoNodesTest()

void Glucose_CheckTwoNodesTest ( Gia_Man_t * p)

Definition at line 1459 of file AbcGlucose.cpp.

1460{
1461 int n, Res;
1463 for ( n = 0; n < 2; n++ )
1464 {
1466 pSat, p,
1467 Gia_ObjFaninLit0p(p, Gia_ManPo(p, 0)),
1468 Gia_ObjFaninLit0p(p, Gia_ManPo(p, 1)),
1469 n );
1470 bmcg_sat_solver_reset( pSat );
1471 printf( "%s %s.\n", n ? "Equivalence" : "Overlap", Res ? "holds" : "fails" );
1472 }
1473 bmcg_sat_solver_stop( pSat );
1474}
Here is the call graph for this function:

◆ Glucose_GenerateCubes()

Vec_Str_t * Glucose_GenerateCubes ( bmcg_sat_solver * pSat[2],
Vec_Int_t * vCiSatVars,
Vec_Int_t * vVar2Index,
int CubeLimit )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 922 of file AbcGlucose.cpp.

923{
924 int fCreatePrime = 1;
925 int nCubes, nSupp = Vec_IntSize(vCiSatVars);
926 Vec_Str_t * vSop = Vec_StrAlloc( 1000 );
927 Vec_Int_t * vLits = Vec_IntAlloc( nSupp );
928 Vec_Str_t * vCube = Vec_StrAlloc( nSupp + 4 );
929 Vec_StrFill( vCube, nSupp, '-' );
930 Vec_StrPrintF( vCube, " 1\n\0" );
931 for ( nCubes = 0; !CubeLimit || nCubes < CubeLimit; nCubes++ )
932 {
933 int * pFinal, nFinal, iVar, i, k = 0;
934 // generate onset minterm
935 int status = bmcg_sat_solver_solve( pSat[1], NULL, 0 );
936 if ( status == GLUCOSE_UNSAT )
937 break;
938 assert( status == GLUCOSE_SAT );
939 Vec_IntClear( vLits );
940 Vec_IntForEachEntry( vCiSatVars, iVar, i )
941 Vec_IntPush( vLits, Abc_Var2Lit(iVar, !bmcg_sat_solver_read_cex_varvalue(pSat[1], iVar)) );
942 // expand against offset
943 if ( fCreatePrime )
944 {
945 nFinal = bmcg_sat_solver_minimize_assumptions( pSat[0], Vec_IntArray(vLits), Vec_IntSize(vLits), 0 );
946 Vec_IntShrink( vLits, nFinal );
947 pFinal = Vec_IntArray( vLits );
948 for ( i = 0; i < nFinal; i++ )
949 pFinal[i] = Abc_LitNot(pFinal[i]);
950 }
951 else
952 {
953 status = bmcg_sat_solver_solve( pSat[0], Vec_IntArray(vLits), Vec_IntSize(vLits) );
954 assert( status == GLUCOSE_UNSAT );
955 nFinal = bmcg_sat_solver_final( pSat[0], &pFinal );
956 }
957 // print cube
958 Vec_StrFill( vCube, nSupp, '-' );
959 for ( i = 0; i < nFinal; i++ )
960 {
961 int Index = Vec_IntEntry(vVar2Index, Abc_Lit2Var(pFinal[i]));
962 if ( Index == -1 )
963 continue;
964 pFinal[k++] = pFinal[i];
965 assert( Index >= 0 && Index < nSupp );
966 Vec_StrWriteEntry( vCube, Index, (char)('0' + Abc_LitIsCompl(pFinal[i])) );
967 }
968 nFinal = k;
969 Vec_StrAppend( vSop, Vec_StrArray(vCube) );
970 //printf( "%s\n", Vec_StrArray(vCube) );
971 // add blocking clause
972 if ( !bmcg_sat_solver_addclause( pSat[1], pFinal, nFinal ) )
973 break;
974 }
975 Vec_IntFree( vLits );
976 Vec_StrFree( vCube );
977 Vec_StrPush( vSop, '\0' );
978 return vSop;
979}
int bmcg_sat_solver_read_cex_varvalue(bmcg_sat_solver *s, int ivar)
int bmcg_sat_solver_final(bmcg_sat_solver *s, int **ppArray)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ glucose_print_stats()

void glucose_print_stats ( SimpSolver & s,
abctime clk )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 739 of file AbcGlucose.cpp.

740{
741 double cpu_time = (double)(unsigned)clk / CLOCKS_PER_SEC;
742 double mem_used = memUsed();
743 printf("c restarts : %d (%d conflicts on average)\n", (int)s.starts, s.starts > 0 ? (int)(s.conflicts/s.starts) : 0);
744 printf("c blocked restarts : %d (multiple: %d) \n", (int)s.nbstopsrestarts, (int)s.nbstopsrestartssame);
745 printf("c last block at restart : %d\n", (int)s.lastblockatrestart);
746 printf("c nb ReduceDB : %-12d\n", (int)s.nbReduceDB);
747 printf("c nb removed Clauses : %-12d\n", (int)s.nbRemovedClauses);
748 printf("c nb learnts DL2 : %-12d\n", (int)s.nbDL2);
749 printf("c nb learnts size 2 : %-12d\n", (int)s.nbBin);
750 printf("c nb learnts size 1 : %-12d\n", (int)s.nbUn);
751 printf("c conflicts : %-12d (%.0f /sec)\n", (int)s.conflicts, s.conflicts /cpu_time);
752 printf("c decisions : %-12d (%4.2f %% random) (%.0f /sec)\n", (int)s.decisions, (float)s.rnd_decisions*100 / (float)s.decisions, s.decisions /cpu_time);
753 printf("c propagations : %-12d (%.0f /sec)\n", (int)s.propagations, s.propagations/cpu_time);
754 printf("c conflict literals : %-12d (%4.2f %% deleted)\n", (int)s.tot_literals, (s.max_literals - s.tot_literals)*100 / (double)s.max_literals);
755 printf("c nb reduced Clauses : %-12d\n", (int)s.nbReducedClauses);
756 if (mem_used != 0) printf("Memory used : %.2f MB\n", mem_used);
757 //printf("c CPU time : %.2f sec\n", cpu_time);
758}
int64_t rnd_decisions
Definition Solver.h:194
int64_t starts
Definition Solver.h:194
int64_t nbReducedClauses
Definition Solver.h:194
int64_t max_literals
Definition Solver.h:195
int64_t lastblockatrestart
Definition Solver.h:194
int64_t nbReduceDB
Definition Solver.h:194
int64_t nbDL2
Definition Solver.h:194
int64_t propagations
Definition Solver.h:194
int64_t nbstopsrestarts
Definition Solver.h:194
int64_t decisions
Definition Solver.h:194
int64_t nbRemovedClauses
Definition Solver.h:194
int64_t tot_literals
Definition Solver.h:195
int64_t nbBin
Definition Solver.h:194
int64_t conflicts
Definition Solver.h:194
int64_t nbstopsrestartssame
Definition Solver.h:194
int64_t nbUn
Definition Solver.h:194
double memUsed()
Definition System.cpp:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Glucose_QuantifyAigTest()

void Glucose_QuantifyAigTest ( Gia_Man_t * p)

Definition at line 1357 of file AbcGlucose.cpp.

1358{
1360
1361 abctime clk1 = Abc_Clock();
1362 int iRes1 = bmcg_sat_solver_quantify( pSats, p, Gia_ObjFaninLit0p(p, Gia_ManPo(p, 0)), 0, Gia_ManCiIsToKeep, NULL, NULL );
1363 abctime clk1d = Abc_Clock()-clk1;
1364
1365 abctime clk2 = Abc_Clock();
1366 int iRes2 = bmcg_sat_solver_quantify2( p, Gia_ObjFaninLit0p(p, Gia_ManPo(p, 0)), 0, Gia_ManCiIsToKeep, NULL, NULL );
1367 abctime clk2d = Abc_Clock()-clk2;
1368
1369 Abc_PrintTime( 1, "Time1", clk1d );
1370 Abc_PrintTime( 1, "Time2", clk2d );
1371
1372 if ( bmcg_sat_solver_equiv_overlap_check( pSats[2], p, iRes1, iRes2, 1 ) )
1373 printf( "Verification passed.\n" );
1374 else
1375 printf( "Verification FAILED.\n" );
1376
1377 Gia_ManAppendCo( p, iRes1 );
1378 Gia_ManAppendCo( p, iRes2 );
1379
1380 bmcg_sat_solver_stop( pSats[0] );
1381 bmcg_sat_solver_stop( pSats[1] );
1382 bmcg_sat_solver_stop( pSats[2] );
1383}
int bmcg_sat_solver_quantify(bmcg_sat_solver *pSats[], Gia_Man_t *p, int iLit, int fHash, int(*pFuncCiToKeep)(void *, int), void *pData, Vec_Int_t *vDLits)
int Gia_ManCiIsToKeep(void *pData, int i)
Here is the call graph for this function:

◆ Glucose_ReadDimacs()

void Glucose_ReadDimacs ( char * pFileName,
SimpSolver & s )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 771 of file AbcGlucose.cpp.

772{
773 vec<Lit> * lits = &s.user_lits;
774 char * pBuffer = Extra_FileReadContents( pFileName );
775 char * pTemp; int fComp, Var, VarMax = 0;
776 lits->clear();
777 for ( pTemp = pBuffer; *pTemp; pTemp++ )
778 {
779 if ( *pTemp == 'c' || *pTemp == 'p' ) {
780 while ( *pTemp != '\n' )
781 pTemp++;
782 continue;
783 }
784 while ( *pTemp == ' ' || *pTemp == '\t' || *pTemp == '\r' || *pTemp == '\n' )
785 pTemp++;
786 fComp = 0;
787 if ( *pTemp == '-' )
788 fComp = 1, pTemp++;
789 if ( *pTemp == '+' )
790 pTemp++;
791 Var = atoi( pTemp );
792 if ( Var == 0 ) {
793 if ( lits->size() > 0 ) {
794 s.addVar( VarMax );
795 s.addClause(*lits);
796 lits->clear();
797 }
798 }
799 else {
800 Var--;
801 VarMax = Abc_MaxInt( VarMax, Var );
802 lits->push( toLit(Abc_Var2Lit(Var, fComp)) );
803 }
804 while ( *pTemp >= '0' && *pTemp <= '9' )
805 pTemp++;
806 }
807 ABC_FREE( pBuffer );
808}
#define ABC_FREE(obj)
Definition abc_global.h:267
bool addClause(const vec< Lit > &ps)
Definition SimpSolver.h:183
void addVar(Var v)
Definition SimpSolver.h:200
vec< Lit > user_lits
Definition Solver.h:65
int size(void) const
Definition Vec.h:65
char * Extra_FileReadContents(char *pFileName)
int Var
Definition SolverTypes.h:52
Lit toLit(int i)
Definition SolverTypes.h:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Glucose_SolveAig()

int Glucose_SolveAig ( Gia_Man_t * p,
Glucose_Pars * pPars )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1487 of file AbcGlucose.cpp.

1488{
1489 abctime clk = Abc_Clock();
1490
1491 SimpSolver S;
1492 S.verbosity = pPars->verb;
1493 S.verbEveryConflicts = 50000;
1494 S.showModel = false;
1495 //S.verbosity = 2;
1496 S.setConfBudget( pPars->nConfls > 0 ? (int64_t)pPars->nConfls : -1 );
1497
1498 S.parsing = 1;
1499 Vec_Int_t * vCnfIds = Glucose_SolverFromAig(p,S);
1500 S.parsing = 0;
1501
1502 if (pPars->verb)
1503 {
1504 printf("c ============================[ Problem Statistics ]=============================\n");
1505 printf("c | |\n");
1506 printf("c | Number of variables: %12d |\n", S.nVars());
1507 printf("c | Number of clauses: %12d |\n", S.nClauses());
1508 }
1509
1510 if (pPars->pre)
1511 {
1512 S.eliminate(true);
1513 printf( "c Simplification removed %d variables and %d clauses. ", S.eliminated_vars, S.eliminated_clauses );
1514 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1515 }
1516
1517 vec<Lit> dummy;
1518 lbool ret = S.solveLimited(dummy, 0);
1519
1520 if ( pPars->verb ) glucose_print_stats(S, Abc_Clock() - clk);
1521 printf(ret == l_True ? "SATISFIABLE" : ret == l_False ? "UNSATISFIABLE" : "INDETERMINATE");
1522 Abc_PrintTime( 1, " Time", Abc_Clock() - clk );
1523
1524 // port counterexample
1525 if (ret == l_True)
1526 {
1527 Gia_Obj_t * pObj; int i;
1528 p->pCexComb = Abc_CexAlloc(0,Gia_ManCiNum(p),1);
1529 Gia_ManForEachCi( p, pObj, i )
1530 {
1531 assert(Vec_IntEntry(vCnfIds,Gia_ObjId(p, pObj))!=-1);
1532 if (S.model[Vec_IntEntry(vCnfIds,Gia_ObjId(p, pObj))] == l_True)
1533 Abc_InfoSetBit( p->pCexComb->pData, i);
1534 }
1535 }
1536 Vec_IntFree(vCnfIds);
1537 return (ret == l_True ? 10 : ret == l_False ? 20 : 0);
1538}
void glucose_print_stats(SimpSolver &s, abctime clk)
Vec_Int_t * Glucose_SolverFromAig(Gia_Man_t *p, SimpSolver &s)
#define l_True
Definition bmcBmcS.c:35
#define l_False
Definition bmcBmcS.c:36
int verbosity
Definition Solver.h:158
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition utilCex.c:51
Here is the call graph for this function:

◆ Glucose_SolveCnf()

void Glucose_SolveCnf ( char * pFileName,
Glucose_Pars * pPars,
int fDumpCnf )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 821 of file AbcGlucose.cpp.

822{
823 abctime clk = Abc_Clock();
824
825 SimpSolver S;
826 S.verbosity = pPars->verb;
827 S.setConfBudget( pPars->nConfls > 0 ? (int64_t)pPars->nConfls : -1 );
828
829// gzFile in = gzopen(pFilename, "rb");
830// parse_DIMACS(in, S);
831// gzclose(in);
832 Glucose_ReadDimacs( pFileName, S );
833
834 if ( pPars->verb )
835 {
836 printf("c ============================[ Problem Statistics ]=============================\n");
837 printf("c | |\n");
838 printf("c | Number of variables: %12d |\n", S.nVars());
839 printf("c | Number of clauses: %12d |\n", S.nClauses());
840 }
841
842 if ( pPars->pre )
843 {
844 S.eliminate(true);
845 printf( "c Simplification removed %d variables and %d clauses. ", S.eliminated_vars, S.eliminated_clauses );
846 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
847
848 if ( fDumpCnf )
849 {
850 char * pFileCnf = Extra_FileNameGenericAppend( pFileName, "_out.cnf" );
851 S.toDimacs(pFileCnf);
852 printf( "Finished dumping CNF after preprocessing into file \"%s\".\n", pFileCnf );
853 printf( "SAT solving is not performed.\n" );
854 return;
855 }
856 }
857
858 vec<Lit> dummy;
859 lbool ret = S.solveLimited(dummy, 0);
860 if ( pPars->verb ) glucose_print_stats(S, Abc_Clock() - clk);
861 printf(ret == l_True ? "SATISFIABLE" : ret == l_False ? "UNSATISFIABLE" : "INDETERMINATE");
862 Abc_PrintTime( 1, " Time", Abc_Clock() - clk );
863}
void Glucose_ReadDimacs(char *pFileName, SimpSolver &s)
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
Here is the call graph for this function:

◆ glucose_solver_addclause()

int glucose_solver_addclause ( Gluco::SimpSolver * S,
int * plits,
int nlits )

Definition at line 78 of file AbcGlucose.cpp.

79{
80 vec<Lit> lits;
81 for ( int i = 0; i < nlits; i++,plits++)
82 {
83 // note: Glucose uses the same var->lit conventiaon as ABC
84 while ((*plits)/2 >= S->nVars()) S->newVar();
85 assert((*plits)/2 < S->nVars()); // NOTE: since we explicitely use new function bmc_add_var
86 Lit p;
87 p.x = *plits;
88 lits.push(p);
89 }
90 return S->addClause(lits); // returns 0 if the problem is UNSAT
91}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ glucose_solver_addvar()

int glucose_solver_addvar ( Gluco::SimpSolver * S)

Definition at line 113 of file AbcGlucose.cpp.

114{
115 S->newVar();
116 return S->nVars() - 1;
117}
Here is the caller graph for this function:

◆ glucose_solver_read_cex()

int * glucose_solver_read_cex ( Gluco::SimpSolver * S)

Definition at line 119 of file AbcGlucose.cpp.

120{
121 return S->getCex();
122}
Here is the caller graph for this function:

◆ glucose_solver_read_cex_varvalue()

int glucose_solver_read_cex_varvalue ( Gluco::SimpSolver * S,
int ivar )

Definition at line 124 of file AbcGlucose.cpp.

125{
126 return S->model[ivar] == l_True;
127}
Here is the caller graph for this function:

◆ glucose_solver_reset()

void glucose_solver_reset ( Gluco::SimpSolver * S)

Definition at line 73 of file AbcGlucose.cpp.

74{
75 S->reset();
76}
Here is the caller graph for this function:

◆ glucose_solver_setcallback()

void glucose_solver_setcallback ( Gluco::SimpSolver * S,
void * pman,
int(* pfunc )(void *, int, int *) )

Definition at line 93 of file AbcGlucose.cpp.

94{
95 S->pCnfMan = pman;
96 S->pCnfFunc = pfunc;
97 S->nCallConfl = 1000;
98}
Here is the caller graph for this function:

◆ glucose_solver_setstop()

void glucose_solver_setstop ( Gluco::SimpSolver * S,
int * pstop )

Definition at line 129 of file AbcGlucose.cpp.

130{
131 S->pstop = pstop;
132}
Here is the caller graph for this function:

◆ glucose_solver_solve()

int glucose_solver_solve ( Gluco::SimpSolver * S,
int * plits,
int nlits )

Definition at line 100 of file AbcGlucose.cpp.

101{
102 vec<Lit> lits;
103 for (int i=0;i<nlits;i++,plits++)
104 {
105 Lit p;
106 p.x = *plits;
107 lits.push(p);
108 }
109 Gluco::lbool res = S->solveLimited(lits, 0);
110 return (res == l_True ? 1 : res == l_False ? -1 : 0);
111}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ glucose_solver_start()

SimpSolver * glucose_solver_start ( )

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file AbcGlucose.cpp.

62{
63 SimpSolver * S = new SimpSolver;
65 return S;
66}
void setIncrementalMode()
Definition Glucose.cpp:185
Here is the call graph for this function:
Here is the caller graph for this function:

◆ glucose_solver_stop()

void glucose_solver_stop ( Gluco::SimpSolver * S)

Definition at line 68 of file AbcGlucose.cpp.

69{
70 delete S;
71}
Here is the caller graph for this function:

◆ Glucose_SolverFromAig()

Vec_Int_t * Glucose_SolverFromAig ( Gia_Man_t * p,
SimpSolver & s )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 876 of file AbcGlucose.cpp.

877{
878 abctime clk = Abc_Clock();
879 vec<Lit> * lits = &s.user_lits;
880 Cnf_Dat_t * pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( p, 8 /*nLutSize*/, 0 /*fCnfObjIds*/, 1/*fAddOrCla*/, 0, 0/*verbose*/ );
881 for ( int i = 0; i < pCnf->nClauses; i++ )
882 {
883 lits->clear();
884 for ( int * pLit = pCnf->pClauses[i]; pLit < pCnf->pClauses[i+1]; pLit++ )
885 lits->push( toLit(*pLit) ), s.addVar( *pLit >> 1 );
886 s.addClause(*lits);
887 }
888 Vec_Int_t * vCnfIds = Vec_IntAllocArrayCopy(pCnf->pVarNums, Gia_ManObjNum(p));
889 printf( "CNF stats: Vars = %6d. Clauses = %7d. Literals = %8d. ", pCnf->nVars, pCnf->nClauses, pCnf->nLiterals );
890 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
891 Cnf_DataFree(pCnf);
892 return vCnfIds;
893}
int nLiterals
Definition cnf.h:60
int * pVarNums
Definition cnf.h:63
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Glucose_SolverFromAig2()

Vec_Int_t * Glucose_SolverFromAig2 ( Gia_Man_t * p,
SimpSolver & S )

Definition at line 896 of file AbcGlucose.cpp.

897{
898 Cnf_Dat_t * pCnf = (Cnf_Dat_t *)Mf_ManGenerateCnf( p, 8 /*nLutSize*/, 0 /*fCnfObjIds*/, 1/*fAddOrCla*/, 0, 0/*verbose*/ );
899 for ( int i = 0; i < pCnf->nClauses; i++ )
900 if ( !glucose_solver_addclause( &S, pCnf->pClauses[i], pCnf->pClauses[i+1]-pCnf->pClauses[i] ) )
901 assert( 0 );
902 Vec_Int_t * vCnfIds = Vec_IntAllocArrayCopy(pCnf->pVarNums, Gia_ManObjNum(p));
903 //printf( "CNF stats: Vars = %6d. Clauses = %7d. Literals = %8d. ", pCnf->nVars, pCnf->nClauses, pCnf->nLiterals );
904 //Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
905 Cnf_DataFree(pCnf);
906 return vCnfIds;
907}
Here is the call graph for this function: