abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
aigPartSat.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [aigPartSat.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [AIG package.]
8 
9  Synopsis [Partitioning for SAT solving.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - April 28, 2007.]
16 
17  Revision [$Id: aigPartSat.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "aig.h"
22 #include "sat/bsat/satSolver.h"
23 #include "sat/cnf/cnf.h"
24 
26 
27 
28 /*
29 
30 The node partitioners defined in this file return array of intergers
31 mapping each AND node's ID into the 0-based number of its partition.
32 The mapping of PIs/POs will be derived automatically in Aig_ManPartSplit().
33 
34 The partitions can be ordered in any way, but the recommended ordering
35 is to first include partitions whose nodes are closer to the outputs.
36 
37 */
38 
39 ////////////////////////////////////////////////////////////////////////
40 /// DECLARATIONS ///
41 ////////////////////////////////////////////////////////////////////////
42 
43 extern Aig_Man_t * Dar_ManRwsat( Aig_Man_t * pAig, int fBalance, int fVerbose );
44 
45 ////////////////////////////////////////////////////////////////////////
46 /// FUNCTION DEFINITIONS ///
47 ////////////////////////////////////////////////////////////////////////
48 
49 /**Function*************************************************************
50 
51  Synopsis [No partitioning.]
52 
53  Description [The partitioner ]
54 
55  SideEffects []
56 
57  SeeAlso []
58 
59 ***********************************************************************/
61 {
62  Vec_Int_t * vId2Part;
63  vId2Part = Vec_IntStart( Aig_ManObjNumMax(p) );
64  return vId2Part;
65 }
66 
67 /**Function*************************************************************
68 
69  Synopsis [Partitioning using levelized order.]
70 
71  Description []
72 
73  SideEffects []
74 
75  SeeAlso []
76 
77 ***********************************************************************/
79 {
80  Vec_Int_t * vId2Part;
81  Vec_Vec_t * vNodes;
82  Aig_Obj_t * pObj;
83  int i, k, Counter = 0;
84  vNodes = Aig_ManLevelize( p );
85  vId2Part = Vec_IntStart( Aig_ManObjNumMax(p) );
86  Vec_VecForEachEntryReverseReverse( Aig_Obj_t *, vNodes, pObj, i, k )
87  Vec_IntWriteEntry( vId2Part, Aig_ObjId(pObj), Counter++/nPartSize );
88  Vec_VecFree( vNodes );
89  return vId2Part;
90 }
91 
92 /**Function*************************************************************
93 
94  Synopsis [Partitioning using DFS order.]
95 
96  Description []
97 
98  SideEffects []
99 
100  SeeAlso []
101 
102 ***********************************************************************/
103 Vec_Int_t * Aig_ManPartitionDfs( Aig_Man_t * p, int nPartSize, int fPreorder )
104 {
105  Vec_Int_t * vId2Part;
106  Vec_Ptr_t * vNodes;
107  Aig_Obj_t * pObj;
108  int i, Counter = 0;
109  vId2Part = Vec_IntStart( Aig_ManObjNumMax(p) );
110  if ( fPreorder )
111  {
112  vNodes = Aig_ManDfsPreorder( p, 1 );
113  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
114  Vec_IntWriteEntry( vId2Part, Aig_ObjId(pObj), Counter++/nPartSize );
115  }
116  else
117  {
118  vNodes = Aig_ManDfs( p, 1 );
119  Vec_PtrForEachEntryReverse( Aig_Obj_t *, vNodes, pObj, i )
120  Vec_IntWriteEntry( vId2Part, Aig_ObjId(pObj), Counter++/nPartSize );
121  }
122  Vec_PtrFree( vNodes );
123  return vId2Part;
124 }
125 
126 /**Function*************************************************************
127 
128  Synopsis [Recursively constructs the partition.]
129 
130  Description []
131 
132  SideEffects []
133 
134  SeeAlso []
135 
136 ***********************************************************************/
137 void Aig_ManPartSplitOne_rec( Aig_Man_t * pNew, Aig_Man_t * p, Aig_Obj_t * pObj, Vec_Int_t * vPio2Id )
138 {
139  if ( !Aig_ObjIsTravIdCurrent( p, pObj ) )
140  { // new PI
141  Aig_ObjSetTravIdCurrent( p, pObj );
142 /*
143  if ( pObj->fMarkA ) // const0
144  pObj->pData = Aig_ManConst0( pNew );
145  else if ( pObj->fMarkB ) // const1
146  pObj->pData = Aig_ManConst1( pNew );
147  else
148 */
149  {
150  pObj->pData = Aig_ObjCreateCi( pNew );
151  if ( pObj->fMarkA ) // const0
152  ((Aig_Obj_t *)pObj->pData)->fMarkA = 1;
153  else if ( pObj->fMarkB ) // const1
154  ((Aig_Obj_t *)pObj->pData)->fMarkB = 1;
155  Vec_IntPush( vPio2Id, Aig_ObjId(pObj) );
156  }
157  return;
158  }
159  if ( pObj->pData )
160  return;
161  Aig_ManPartSplitOne_rec( pNew, p, Aig_ObjFanin0(pObj), vPio2Id );
162  Aig_ManPartSplitOne_rec( pNew, p, Aig_ObjFanin1(pObj), vPio2Id );
163  pObj->pData = Aig_And( pNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
164 }
165 
166 /**Function*************************************************************
167 
168  Synopsis [Carves out one partition of the AIG.]
169 
170  Description []
171 
172  SideEffects []
173 
174  SeeAlso []
175 
176 ***********************************************************************/
178 {
179  Vec_Int_t * vPio2Id;
180  Aig_Man_t * pNew;
181  Aig_Obj_t * pObj;
182  int i;
183  // mark these nodes
185  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
186  {
187  Aig_ObjSetTravIdCurrent( p, pObj );
188  pObj->pData = NULL;
189  }
190  // add these nodes in a DFS order
191  pNew = Aig_ManStart( Vec_PtrSize(vNodes) );
192  vPio2Id = Vec_IntAlloc( 100 );
193  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
194  Aig_ManPartSplitOne_rec( pNew, p, pObj, vPio2Id );
195  // add the POs
196  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
197  if ( Aig_ObjRefs((Aig_Obj_t *)pObj->pData) != Aig_ObjRefs(pObj) )
198  {
199  assert( Aig_ObjRefs((Aig_Obj_t *)pObj->pData) < Aig_ObjRefs(pObj) );
200  Aig_ObjCreateCo( pNew, (Aig_Obj_t *)pObj->pData );
201  Vec_IntPush( vPio2Id, Aig_ObjId(pObj) );
202  }
203  assert( Aig_ManNodeNum(pNew) == Vec_PtrSize(vNodes) );
204  *pvPio2Id = vPio2Id;
205  return pNew;
206 }
207 
208 /**Function*************************************************************
209 
210  Synopsis [Derives AIGs for each partition.]
211 
212  Description [The first argument is a original AIG. The second argument
213  is the array mapping each AND-node's ID into the 0-based number of its
214  partition. The last argument is the array of arrays (one for each new AIG)
215  mapping the index of each terminal in the new AIG (the index of each
216  terminal is derived by ordering PIs followed by POs in their natural order)
217  into the ID of the corresponding node in the original AIG. The returned
218  value is the array of AIGs representing the partitions.]
219 
220  SideEffects []
221 
222  SeeAlso []
223 
224 ***********************************************************************/
225 Vec_Ptr_t * Aig_ManPartSplit( Aig_Man_t * p, Vec_Int_t * vNode2Part, Vec_Ptr_t ** pvPio2Id, Vec_Ptr_t ** pvPart2Pos )
226 {
227  Vec_Vec_t * vGroups, * vPart2Pos;
228  Vec_Ptr_t * vAigs, * vPio2Id, * vNodes;
229  Vec_Int_t * vPio2IdOne;
230  Aig_Man_t * pAig;
231  Aig_Obj_t * pObj, * pDriver;
232  int i, nodePart, nParts;
233  vAigs = Vec_PtrAlloc( 100 );
234  vPio2Id = Vec_PtrAlloc( 100 );
235  // put all nodes into levels according to their partition
236  nParts = Vec_IntFindMax(vNode2Part) + 1;
237  assert( nParts > 0 );
238  vGroups = Vec_VecAlloc( nParts );
239  Vec_IntForEachEntry( vNode2Part, nodePart, i )
240  {
241  pObj = Aig_ManObj( p, i );
242  if ( Aig_ObjIsNode(pObj) )
243  Vec_VecPush( vGroups, nodePart, pObj );
244  }
245 
246  // label PIs that should be restricted to some values
247  Aig_ManForEachCo( p, pObj, i )
248  {
249  pDriver = Aig_ObjFanin0(pObj);
250  if ( Aig_ObjIsCi(pDriver) )
251  {
252  if ( Aig_ObjFaninC0(pObj) )
253  pDriver->fMarkA = 1; // const0 PI
254  else
255  pDriver->fMarkB = 1; // const1 PI
256  }
257  }
258 
259  // create partitions
260  Vec_VecForEachLevel( vGroups, vNodes, i )
261  {
262  if ( Vec_PtrSize(vNodes) == 0 )
263  {
264  printf( "Aig_ManPartSplit(): Skipping partition # %d without nodes (warning).\n", i );
265  continue;
266  }
267  pAig = Aig_ManPartSplitOne( p, vNodes, &vPio2IdOne );
268  Vec_PtrPush( vPio2Id, vPio2IdOne );
269  Vec_PtrPush( vAigs, pAig );
270  }
271  Vec_VecFree( vGroups );
272 
273  // divide POs according to their partitions
274  vPart2Pos = Vec_VecStart( Vec_PtrSize(vAigs) );
275  Aig_ManForEachCo( p, pObj, i )
276  {
277  pDriver = Aig_ObjFanin0(pObj);
278  if ( Aig_ObjIsCi(pDriver) )
279  pDriver->fMarkA = pDriver->fMarkB = 0;
280  else
281  Vec_VecPush( vPart2Pos, Vec_IntEntry(vNode2Part, Aig_ObjFaninId0(pObj)), pObj );
282  }
283 
284  *pvPio2Id = vPio2Id;
285  *pvPart2Pos = (Vec_Ptr_t *)vPart2Pos;
286  return vAigs;
287 }
288 
289 /**Function*************************************************************
290 
291  Synopsis [Resets node polarity to unbias the polarity of CNF variables.]
292 
293  Description []
294 
295  SideEffects []
296 
297  SeeAlso []
298 
299 ***********************************************************************/
301 {
302  Aig_Obj_t * pObj;
303  int i;
304  Aig_ManForEachObj( pPart, pObj, i )
305  pObj->fPhase = 0;
306 }
307 
308 /**Function*************************************************************
309 
310  Synopsis [Sets polarity according to the original nodes.]
311 
312  Description []
313 
314  SideEffects []
315 
316  SeeAlso []
317 
318 ***********************************************************************/
320 {
321  Aig_Obj_t * pObj, * pObjInit;
322  int i;
323  Aig_ManConst1(pPart)->fPhase = 1;
324  Aig_ManForEachCi( pPart, pObj, i )
325  {
326  pObjInit = Aig_ManObj( p, Vec_IntEntry(vPio2Id, i) );
327  pObj->fPhase = pObjInit->fPhase;
328  }
329  Aig_ManForEachNode( pPart, pObj, i )
330  pObj->fPhase = (Aig_ObjFanin0(pObj)->fPhase ^ Aig_ObjFaninC0(pObj)) & (Aig_ObjFanin1(pObj)->fPhase ^ Aig_ObjFaninC1(pObj));
331  Aig_ManForEachCo( pPart, pObj, i )
332  {
333  pObjInit = Aig_ManObj( p, Vec_IntEntry(vPio2Id, Aig_ManCiNum(pPart) + i) );
334  pObj->fPhase = (Aig_ObjFanin0(pObj)->fPhase ^ Aig_ObjFaninC0(pObj));
335  assert( pObj->fPhase == pObjInit->fPhase );
336  }
337 }
338 
339 /**Function*************************************************************
340 
341  Synopsis [Sets polarity according to the original nodes.]
342 
343  Description []
344 
345  SideEffects []
346 
347  SeeAlso []
348 
349 ***********************************************************************/
351 {
352  Vec_Int_t * vPisIds;
353  Aig_Obj_t * pObj;
354  int i;
355  // collect IDs of PI variables
356  // (fanoutless PIs have SAT var 0, which is an unused in the SAT solver -> has value 0)
357  vPisIds = Vec_IntAlloc( Aig_ManCiNum(p) );
358  Aig_ManForEachCi( p, pObj, i )
359  Vec_IntPush( vPisIds, Vec_IntEntry(vNode2Var, Aig_ObjId(pObj)) );
360  // derive the SAT assignment
361  p->pData = Sat_SolverGetModel( pSat, vPisIds->pArray, vPisIds->nSize );
362  Vec_IntFree( vPisIds );
363 }
364 
365 /**Function*************************************************************
366 
367  Synopsis [Derives CNF for the partition (pAig) and adds it to solver.]
368 
369  Description [Array vPio2Id contains mapping of the PI/PO terminal of pAig
370  into the IDs of the corresponding original nodes. Array vNode2Var contains
371  mapping of the original nodes into their SAT variable numbers.]
372 
373  SideEffects []
374 
375  SeeAlso []
376 
377 ***********************************************************************/
378 int Aig_ManAddNewCnfToSolver( sat_solver * pSat, Aig_Man_t * pAig, Vec_Int_t * vNode2Var,
379  Vec_Int_t * vPioIds, Vec_Ptr_t * vPartPos, int fAlignPol )
380 {
381  Cnf_Dat_t * pCnf;
382  Aig_Obj_t * pObj;
383  int * pBeg, * pEnd;
384  int i, Lits[2], iSatVarOld, iNodeIdOld;
385  // derive CNF and express it using new SAT variables
386  pCnf = Cnf_Derive( pAig, Aig_ManCoNum(pAig) );
387  Cnf_DataTranformPolarity( pCnf, 1 );
388  Cnf_DataLift( pCnf, sat_solver_nvars(pSat) );
389  // create new variables in the SAT solver
390  sat_solver_setnvars( pSat, sat_solver_nvars(pSat) + pCnf->nVars );
391  // add clauses for this CNF
392  Cnf_CnfForClause( pCnf, pBeg, pEnd, i )
393  if ( !sat_solver_addclause( pSat, pBeg, pEnd ) )
394  {
395  assert( 0 ); // if it happens, can return 1 (unsatisfiable)
396  return 1;
397  }
398  // derive the connector clauses
399  Aig_ManForEachCi( pAig, pObj, i )
400  {
401  iNodeIdOld = Vec_IntEntry( vPioIds, i );
402  iSatVarOld = Vec_IntEntry( vNode2Var, iNodeIdOld );
403  if ( iSatVarOld == 0 ) // iNodeIdOld in the original AIG has no SAT var
404  {
405  // map the corresponding original AIG node into this SAT var
406  Vec_IntWriteEntry( vNode2Var, iNodeIdOld, pCnf->pVarNums[Aig_ObjId(pObj)] );
407  continue;
408  }
409  // add connector clauses
410  Lits[0] = toLitCond( iSatVarOld, 0 );
411  Lits[1] = toLitCond( pCnf->pVarNums[Aig_ObjId(pObj)], 1 );
412  if ( !sat_solver_addclause( pSat, Lits, Lits+2 ) )
413  assert( 0 );
414  Lits[0] = toLitCond( iSatVarOld, 1 );
415  Lits[1] = toLitCond( pCnf->pVarNums[Aig_ObjId(pObj)], 0 );
416  if ( !sat_solver_addclause( pSat, Lits, Lits+2 ) )
417  assert( 0 );
418  }
419  // derive the connector clauses
420  Aig_ManForEachCo( pAig, pObj, i )
421  {
422  iNodeIdOld = Vec_IntEntry( vPioIds, Aig_ManCiNum(pAig) + i );
423  iSatVarOld = Vec_IntEntry( vNode2Var, iNodeIdOld );
424  if ( iSatVarOld == 0 ) // iNodeIdOld in the original AIG has no SAT var
425  {
426  // map the corresponding original AIG node into this SAT var
427  Vec_IntWriteEntry( vNode2Var, iNodeIdOld, pCnf->pVarNums[Aig_ObjId(pObj)] );
428  continue;
429  }
430  // add connector clauses
431  Lits[0] = toLitCond( iSatVarOld, 0 );
432  Lits[1] = toLitCond( pCnf->pVarNums[Aig_ObjId(pObj)], 1 );
433  if ( !sat_solver_addclause( pSat, Lits, Lits+2 ) )
434  assert( 0 );
435  Lits[0] = toLitCond( iSatVarOld, 1 );
436  Lits[1] = toLitCond( pCnf->pVarNums[Aig_ObjId(pObj)], 0 );
437  if ( !sat_solver_addclause( pSat, Lits, Lits+2 ) )
438  assert( 0 );
439  }
440  // transfer the ID of constant 1 node
441  if ( Vec_IntEntry( vNode2Var, 0 ) == 0 )
442  Vec_IntWriteEntry( vNode2Var, 0, pCnf->pVarNums[0] );
443  // remove the CNF
444  Cnf_DataFree( pCnf );
445  // constrain the solver with the literals corresponding to the original POs
446  Vec_PtrForEachEntry( Aig_Obj_t *, vPartPos, pObj, i )
447  {
448  iNodeIdOld = Aig_ObjFaninId0( pObj );
449  iSatVarOld = Vec_IntEntry( vNode2Var, iNodeIdOld );
450  assert( iSatVarOld != 0 );
451  // assert the original PO to be 1
452  Lits[0] = toLitCond( iSatVarOld, Aig_ObjFaninC0(pObj) );
453  // correct the polarity if polarity alignment is enabled
454  if ( fAlignPol && Aig_ObjFanin0(pObj)->fPhase )
455  Lits[0] = lit_neg( Lits[0] );
456  if ( !sat_solver_addclause( pSat, Lits, Lits+1 ) )
457  {
458  assert( 0 ); // if it happens, can return 1 (unsatisfiable)
459  return 1;
460  }
461  }
462  // constrain some the primary inputs to constant values
463  Aig_ManForEachCi( pAig, pObj, i )
464  {
465  if ( !pObj->fMarkA && !pObj->fMarkB )
466  continue;
467  iNodeIdOld = Vec_IntEntry( vPioIds, i );
468  iSatVarOld = Vec_IntEntry( vNode2Var, iNodeIdOld );
469  Lits[0] = toLitCond( iSatVarOld, pObj->fMarkA );
470  if ( !sat_solver_addclause( pSat, Lits, Lits+1 ) )
471  {
472  assert( 0 ); // if it happens, can return 1 (unsatisfiable)
473  return 1;
474  }
475  pObj->fMarkA = pObj->fMarkB = 0;
476  }
477  return 0;
478 }
479 
480 /**Function*************************************************************
481 
482  Synopsis [Performs partitioned SAT solving.]
483 
484  Description []
485 
486  SideEffects []
487 
488  SeeAlso []
489 
490 ***********************************************************************/
491 int Aig_ManPartitionedSat( Aig_Man_t * p, int nAlgo, int nPartSize,
492  int nConfPart, int nConfTotal, int fAlignPol, int fSynthesize, int fVerbose )
493 {
494  sat_solver * pSat;
495  Vec_Ptr_t * vAigs;
496  Vec_Vec_t * vPio2Id, * vPart2Pos;
497  Aig_Man_t * pAig, * pTemp;
498  Vec_Int_t * vNode2Part, * vNode2Var;
499  int nConfRemaining = nConfTotal, nNodes = 0;
500  int i, status, RetValue = -1;
501  abctime clk;
502 
503  // perform partitioning according to the selected algorithm
504  clk = Abc_Clock();
505  switch ( nAlgo )
506  {
507  case 0:
508  vNode2Part = Aig_ManPartitionMonolithic( p );
509  break;
510  case 1:
511  vNode2Part = Aig_ManPartitionLevelized( p, nPartSize );
512  break;
513  case 2:
514  vNode2Part = Aig_ManPartitionDfs( p, nPartSize, 0 );
515  break;
516  case 3:
517  vNode2Part = Aig_ManPartitionDfs( p, nPartSize, 1 );
518  break;
519  default:
520  printf( "Unknown partitioning algorithm.\n" );
521  return -1;
522  }
523 
524  if ( fVerbose )
525  {
526  printf( "Partitioning derived %d partitions. ", Vec_IntFindMax(vNode2Part) + 1 );
527  ABC_PRT( "Time", Abc_Clock() - clk );
528  }
529 
530  // split the original AIG into partition AIGs (vAigs)
531  // also, derives mapping of PIs/POs of partition AIGs into original nodes
532  // also, derives mapping of POs of the original AIG into partitions
533  vAigs = Aig_ManPartSplit( p, vNode2Part, (Vec_Ptr_t **)&vPio2Id, (Vec_Ptr_t **)&vPart2Pos );
534  Vec_IntFree( vNode2Part );
535 
536  if ( fVerbose )
537  {
538  printf( "Partions were transformed into AIGs. " );
539  ABC_PRT( "Time", Abc_Clock() - clk );
540  }
541 
542  // synthesize partitions
543  if ( fSynthesize )
544  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig, i )
545  {
546  pAig = Dar_ManRwsat( pTemp = pAig, 0, 0 );
547  Vec_PtrWriteEntry( vAigs, i, pAig );
548  Aig_ManStop( pTemp );
549  }
550 
551  // start the SAT solver
552  pSat = sat_solver_new();
553 // pSat->verbosity = fVerbose;
554  // start mapping of the original AIG IDs into their SAT variable numbers
555  vNode2Var = Vec_IntStart( Aig_ManObjNumMax(p) );
556 
557  // add partitions, one at a time, and run the SAT solver
558  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pAig, i )
559  {
560 clk = Abc_Clock();
561  // transform polarity of the AIG
562  if ( fAlignPol )
563  Aig_ManPartSetNodePolarity( p, pAig, Vec_VecEntryInt(vPio2Id,i) );
564  else
566  // add CNF of this partition to the SAT solver
567  if ( Aig_ManAddNewCnfToSolver( pSat, pAig, vNode2Var,
568  Vec_VecEntryInt(vPio2Id,i), Vec_VecEntry(vPart2Pos,i), fAlignPol ) )
569  {
570  RetValue = 1;
571  break;
572  }
573  // call the SAT solver
574  status = sat_solver_solve( pSat, NULL, NULL, (ABC_INT64_T)nConfRemaining, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
575  if ( fVerbose )
576  {
577  printf( "%4d : Aig = %6d. Vs = %7d. RootCs = %7d. LearnCs = %6d. ",
578  i, nNodes += Aig_ManNodeNum(pAig), sat_solver_nvars(pSat),
579  (int)pSat->stats.clauses, (int)pSat->stats.learnts );
580 ABC_PRT( "Time", Abc_Clock() - clk );
581  }
582  // analize the result
583  if ( status == l_False )
584  {
585  RetValue = 1;
586  break;
587  }
588  else if ( status == l_True )
589  RetValue = 0;
590  else
591  RetValue = -1;
592  nConfRemaining -= pSat->stats.conflicts;
593  if ( nConfRemaining <= 0 )
594  {
595  printf( "Exceeded the limit on the total number of conflicts (%d).\n", nConfTotal );
596  break;
597  }
598  }
599  if ( RetValue == 0 )
600  Aig_ManDeriveCounterExample( p, vNode2Var, pSat );
601  // cleanup
602  sat_solver_delete( pSat );
603  Vec_PtrForEachEntry( Aig_Man_t *, vAigs, pTemp, i )
604  Aig_ManStop( pTemp );
605  Vec_PtrFree( vAigs );
606  Vec_VecFree( vPio2Id );
607  Vec_VecFree( vPart2Pos );
608  Vec_IntFree( vNode2Var );
609  return RetValue;
610 }
611 
612 ////////////////////////////////////////////////////////////////////////
613 /// END OF FILE ///
614 ////////////////////////////////////////////////////////////////////////
615 
616 
618 
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
void Aig_ManDeriveCounterExample(Aig_Man_t *p, Vec_Int_t *vNode2Var, sat_solver *pSat)
Definition: aigPartSat.c:350
#define Vec_VecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition: vecVec.h:55
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
static Vec_Vec_t * Vec_VecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecVec.h:145
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition: cnfCore.c:165
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
Definition: vecPtr.h:63
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
unsigned int fMarkB
Definition: aig.h:80
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
void * pData
Definition: aig.h:87
int nVars
Definition: cnf.h:59
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
int * pVarNums
Definition: cnf.h:63
void Cnf_DataTranformPolarity(Cnf_Dat_t *pCnf, int fTransformPos)
Definition: cnfMan.c:652
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
unsigned int fMarkA
Definition: aig.h:79
#define l_True
Definition: SolverTypes.h:84
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
static abctime Abc_Clock()
Definition: abc_global.h:279
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
stats_t stats
Definition: satSolver.h:156
Definition: cnf.h:56
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
ABC_NAMESPACE_IMPL_START Aig_Man_t * Dar_ManRwsat(Aig_Man_t *pAig, int fBalance, int fVerbose)
DECLARATIONS ///.
Definition: darScript.c:71
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static lit lit_neg(lit l)
Definition: satVec.h:144
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Vec_Int_t * Aig_ManPartitionDfs(Aig_Man_t *p, int nPartSize, int fPreorder)
Definition: aigPartSat.c:103
static lit toLitCond(int v, int c)
Definition: satVec.h:143
void sat_solver_setnvars(sat_solver *s, int n)
Definition: satSolver.c:1072
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Vec_IntFindMax(Vec_Int_t *p)
Definition: vecInt.h:996
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
int sat_solver_nvars(sat_solver *s)
Definition: satSolver.c:1896
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
Vec_Ptr_t * Aig_ManDfsPreorder(Aig_Man_t *p, int fNodesOnly)
Definition: aigDfs.c:271
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Vec_Vec_t * Aig_ManLevelize(Aig_Man_t *p)
Definition: aigDfs.c:307
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
Definition: aigDfs.c:145
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
Aig_Man_t * Aig_ManPartSplitOne(Aig_Man_t *p, Vec_Ptr_t *vNodes, Vec_Int_t **pvPio2Id)
Definition: aigPartSat.c:177
static int Counter
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static Vec_Vec_t * Vec_VecStart(int nSize)
Definition: vecVec.h:168
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
void Cnf_DataLift(Cnf_Dat_t *p, int nVarsPlus)
Definition: cnfMan.c:205
int Aig_ManPartitionedSat(Aig_Man_t *p, int nAlgo, int nPartSize, int nConfPart, int nConfTotal, int fAlignPol, int fSynthesize, int fVerbose)
Definition: aigPartSat.c:491
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Vec_Int_t * Vec_VecEntryInt(Vec_Vec_t *p, int i)
Definition: vecVec.h:276
void Aig_ManPartResetNodePolarity(Aig_Man_t *pPart)
Definition: aigPartSat.c:300
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
void Aig_ManPartSetNodePolarity(Aig_Man_t *p, Aig_Man_t *pPart, Vec_Int_t *vPio2Id)
Definition: aigPartSat.c:319
unsigned learnts
Definition: satVec.h:153
ABC_INT64_T conflicts
Definition: satVec.h:154
sat_solver * sat_solver_new(void)
Definition: satSolver.c:1001
unsigned int fPhase
Definition: aig.h:78
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
unsigned clauses
Definition: satVec.h:153
int Aig_ManAddNewCnfToSolver(sat_solver *pSat, Aig_Man_t *pAig, Vec_Int_t *vNode2Var, Vec_Int_t *vPioIds, Vec_Ptr_t *vPartPos, int fAlignPol)
Definition: aigPartSat.c:378
void Aig_ManPartSplitOne_rec(Aig_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Int_t *vPio2Id)
Definition: aigPartSat.c:137
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define l_False
Definition: SolverTypes.h:85
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
#define Cnf_CnfForClause(p, pBeg, pEnd, i)
MACRO DEFINITIONS ///.
Definition: cnf.h:117
Vec_Ptr_t * Aig_ManPartSplit(Aig_Man_t *p, Vec_Int_t *vNode2Part, Vec_Ptr_t **pvPio2Id, Vec_Ptr_t **pvPart2Pos)
Definition: aigPartSat.c:225
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
Definition: vecVec.h:271
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
Vec_Int_t * Aig_ManPartitionLevelized(Aig_Man_t *p, int nPartSize)
Definition: aigPartSat.c:78
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t * Aig_ManPartitionMonolithic(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigPartSat.c:60
int * Sat_SolverGetModel(sat_solver *p, int *pVars, int nVars)
Definition: satUtil.c:266
#define Vec_VecForEachEntryReverseReverse(Type, vGlob, pEntry, i, k)
Definition: vecVec.h:101
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223