abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
msatClause.c File Reference
#include "msatInt.h"

Go to the source code of this file.

Data Structures

struct  Msat_Clause_t_
 DECLARATIONS ///. More...
 

Functions

int Msat_ClauseCreate (Msat_Solver_t *p, Msat_IntVec_t *vLits, int fLearned, Msat_Clause_t **pClause_out)
 FUNCTION DEFINITIONS ///. More...
 
void Msat_ClauseFree (Msat_Solver_t *p, Msat_Clause_t *pC, int fRemoveWatched)
 
int Msat_ClauseReadLearned (Msat_Clause_t *pC)
 
int Msat_ClauseReadSize (Msat_Clause_t *pC)
 
int * Msat_ClauseReadLits (Msat_Clause_t *pC)
 
int Msat_ClauseReadMark (Msat_Clause_t *pC)
 
int Msat_ClauseReadNum (Msat_Clause_t *pC)
 
int Msat_ClauseReadTypeA (Msat_Clause_t *pC)
 
void Msat_ClauseSetMark (Msat_Clause_t *pC, int fMark)
 
void Msat_ClauseSetNum (Msat_Clause_t *pC, int Num)
 
void Msat_ClauseSetTypeA (Msat_Clause_t *pC, int fTypeA)
 
int Msat_ClauseIsLocked (Msat_Solver_t *p, Msat_Clause_t *pC)
 
float Msat_ClauseReadActivity (Msat_Clause_t *pC)
 
void Msat_ClauseWriteActivity (Msat_Clause_t *pC, float Num)
 
int Msat_ClausePropagate (Msat_Clause_t *pC, Msat_Lit_t Lit, int *pAssigns, Msat_Lit_t *pLit_out)
 
int Msat_ClauseSimplify (Msat_Clause_t *pC, int *pAssigns)
 
void Msat_ClauseCalcReason (Msat_Solver_t *p, Msat_Clause_t *pC, Msat_Lit_t Lit, Msat_IntVec_t *vLits_out)
 
void Msat_ClauseRemoveWatch (Msat_ClauseVec_t *vClauses, Msat_Clause_t *pC)
 
void Msat_ClausePrint (Msat_Clause_t *pC)
 
void Msat_ClauseWriteDimacs (FILE *pFile, Msat_Clause_t *pC, int fIncrement)
 
void Msat_ClausePrintSymbols (Msat_Clause_t *pC)
 

Function Documentation

void Msat_ClauseCalcReason ( Msat_Solver_t p,
Msat_Clause_t pC,
Msat_Lit_t  Lit,
Msat_IntVec_t vLits_out 
)

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

Synopsis [Computes reason of conflict in the given clause.]

Description [If the literal is unassigned, finds the reason by complementing literals in the given cluase (pC). If the literal is assigned, makes sure that this literal is the first one in the clause and computes the complement of all other literals in the clause. Returns the reason in the given array (vLits_out). If the clause is learned, bumps its activity.]

SideEffects []

SeeAlso []

Definition at line 418 of file msatClause.c.

419 {
420  int i;
421  // clear the reason
422  Msat_IntVecClear( vLits_out );
423  assert( Lit == MSAT_LIT_UNASSIGNED || Lit == pC->pData[0] );
424  for ( i = (Lit != MSAT_LIT_UNASSIGNED); i < (int)pC->nSize; i++ )
425  {
426  assert( Msat_SolverReadAssignsArray(p)[MSAT_LIT2VAR(pC->pData[i])] == MSAT_LITNOT(pC->pData[i]) );
427  Msat_IntVecPush( vLits_out, MSAT_LITNOT(pC->pData[i]) );
428  }
429  if ( pC->fLearned )
431 }
#define MSAT_LIT_UNASSIGNED
Definition: msatInt.h:69
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define MSAT_LIT2VAR(l)
Definition: msat.h:59
void Msat_IntVecClear(Msat_IntVec_t *p)
Definition: msatVec.c:335
#define MSAT_LITNOT(l)
Definition: msat.h:57
void Msat_IntVecPush(Msat_IntVec_t *p, int Entry)
Definition: msatVec.c:351
int * Msat_SolverReadAssignsArray(Msat_Solver_t *p)
Definition: msatSolverApi.c:56
#define assert(ex)
Definition: util_old.h:213
void Msat_SolverClaBumpActivity(Msat_Solver_t *p, Msat_Clause_t *pC)
Definition: msatActivity.c:105
int Msat_ClauseCreate ( Msat_Solver_t p,
Msat_IntVec_t vLits,
int  fLearned,
Msat_Clause_t **  pClause_out 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Creates a new clause.]

Description [Returns FALSE if top-level conflict detected (must be handled); TRUE otherwise. 'pClause_out' may be set to NULL if clause is already satisfied by the top-level assignment.]

SideEffects []

SeeAlso []

Definition at line 58 of file msatClause.c.

59 {
60  int * pAssigns = Msat_SolverReadAssignsArray(p);
61  Msat_ClauseVec_t ** pvWatched;
62  Msat_Clause_t * pC;
63  int * pLits;
64  int nLits, i, j;
65  int nBytes;
67  int Sign;
68 
69  *pClause_out = NULL;
70 
71  nLits = Msat_IntVecReadSize(vLits);
72  pLits = Msat_IntVecReadArray(vLits);
73 
74  if ( !fLearned )
75  {
76  int * pSeen = Msat_SolverReadSeenArray( p );
77  int nSeenId;
79  // sorting literals makes the code trace-equivalent
80  // with to the original C++ solver
81  Msat_IntVecSort( vLits, 0 );
82  // increment the counter of seen twice
83  nSeenId = Msat_SolverIncrementSeenId( p );
84  nSeenId = Msat_SolverIncrementSeenId( p );
85  // nSeenId - 1 stands for negative
86  // nSeenId stands for positive
87  // Remove false literals
88 
89  // there is a bug here!!!!
90  // when the same var in opposite polarities is given, it drops one polarity!!!
91 
92  for ( i = j = 0; i < nLits; i++ ) {
93  // get the corresponding variable
94  Var = MSAT_LIT2VAR(pLits[i]);
95  Sign = MSAT_LITSIGN(pLits[i]); // Sign=0 for positive
96  // check if we already saw this variable in the this clause
97  if ( pSeen[Var] >= nSeenId - 1 )
98  {
99  if ( (pSeen[Var] != nSeenId) == Sign ) // the same lit
100  continue;
101  return 1; // two opposite polarity lits -- don't add the clause
102  }
103  // mark the variable as seen
104  pSeen[Var] = nSeenId - !Sign;
105 
106  // analize the value of this literal
107  if ( pAssigns[Var] != MSAT_VAR_UNASSIGNED )
108  {
109  if ( pAssigns[Var] == pLits[i] )
110  return 1; // the clause is always true -- don't add anything
111  // the literal has no impact - skip it
112  continue;
113  }
114  // otherwise, add this literal to the clause
115  pLits[j++] = pLits[i];
116  }
117  Msat_IntVecShrink( vLits, j );
118  nLits = j;
119 /*
120  // the problem with this code is that performance is very
121  // sensitive to the ordering of adjacency lits
122  // the best ordering requires fanins first, next fanouts
123  // this ordering is more convenient to make from FRAIG
124 
125  // create the adjacency information
126  if ( nLits > 2 )
127  {
128  Msat_Var_t VarI, VarJ;
129  Msat_IntVec_t * pAdjI, * pAdjJ;
130 
131  for ( i = 0; i < nLits; i++ )
132  {
133  VarI = MSAT_LIT2VAR(pLits[i]);
134  pAdjI = (Msat_IntVec_t *)p->vAdjacents->pArray[VarI];
135 
136  for ( j = i+1; j < nLits; j++ )
137  {
138  VarJ = MSAT_LIT2VAR(pLits[j]);
139  pAdjJ = (Msat_IntVec_t *)p->vAdjacents->pArray[VarJ];
140 
141  Msat_IntVecPushUniqueOrder( pAdjI, VarJ, 1 );
142  Msat_IntVecPushUniqueOrder( pAdjJ, VarI, 1 );
143  }
144  }
145  }
146 */
147  }
148  // 'vLits' is now the (possibly) reduced vector of literals.
149  if ( nLits == 0 )
150  return 0;
151  if ( nLits == 1 )
152  return Msat_SolverEnqueue( p, pLits[0], NULL );
153 
154  // Allocate clause:
155 // nBytes = sizeof(unsigned)*(nLits + 1 + (int)fLearned);
156  nBytes = sizeof(unsigned)*(nLits + 2 + (int)fLearned);
157 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
158  pC = (Msat_Clause_t *)ABC_ALLOC( char, nBytes );
159 #else
161 #endif
162  pC->Num = p->nClauses++;
163  pC->fTypeA = 0;
164  pC->fMark = 0;
165  pC->fLearned = fLearned;
166  pC->nSize = nLits;
167  pC->nSizeAlloc = nBytes;
168  memcpy( pC->pData, pLits, sizeof(int)*nLits );
169 
170  // For learnt clauses only:
171  if ( fLearned )
172  {
173  int * pLevel = Msat_SolverReadDecisionLevelArray( p );
174  int iLevelMax, iLevelCur, iLitMax;
175 
176  // Put the second watch on the literal with highest decision level:
177  iLitMax = 1;
178  iLevelMax = pLevel[ MSAT_LIT2VAR(pLits[1]) ];
179  for ( i = 2; i < nLits; i++ )
180  {
181  iLevelCur = pLevel[ MSAT_LIT2VAR(pLits[i]) ];
182  assert( iLevelCur != -1 );
183  if ( iLevelMax < iLevelCur )
184  // this is very strange - shouldn't it be???
185  // if ( iLevelMax > iLevelCur )
186  iLevelMax = iLevelCur, iLitMax = i;
187  }
188  pC->pData[1] = pLits[iLitMax];
189  pC->pData[iLitMax] = pLits[1];
190 
191  // Bumping:
192  // (newly learnt clauses should be considered active)
193  Msat_ClauseWriteActivity( pC, 0.0 );
195 // if ( nLits < 20 )
196  for ( i = 0; i < nLits; i++ )
197  {
198  Msat_SolverVarBumpActivity( p, pLits[i] );
199 // Msat_SolverVarBumpActivity( p, pLits[i] );
200 // p->pFreq[ MSAT_LIT2VAR(pLits[i]) ]++;
201  }
202  }
203 
204  // Store clause:
205  pvWatched = Msat_SolverReadWatchedArray( p );
206  Msat_ClauseVecPush( pvWatched[ MSAT_LITNOT(pC->pData[0]) ], pC );
207  Msat_ClauseVecPush( pvWatched[ MSAT_LITNOT(pC->pData[1]) ], pC );
208  *pClause_out = pC;
209  return 1;
210 }
int Msat_SolverReadDecisionLevel(Msat_Solver_t *p)
Definition: msatSolverApi.c:50
int Msat_Var_t
Definition: msatInt.h:66
#define MSAT_VAR_UNASSIGNED
Definition: msatInt.h:68
int * Msat_SolverReadSeenArray(Msat_Solver_t *p)
Definition: msatSolverApi.c:61
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * Msat_MmStepEntryFetch(Msat_MmStep_t *p, int nBytes)
Definition: msatMem.c:479
#define MSAT_LIT2VAR(l)
Definition: msat.h:59
int Msat_SolverIncrementSeenId(Msat_Solver_t *p)
Definition: msatSolverApi.c:62
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
typedefABC_NAMESPACE_HEADER_START struct Msat_Clause_t_ Msat_Clause_t
INCLUDES ///.
Definition: msatInt.h:57
int Msat_SolverEnqueue(Msat_Solver_t *p, Msat_Lit_t Lit, Msat_Clause_t *pC)
ABC_NAMESPACE_IMPL_START void Msat_SolverVarBumpActivity(Msat_Solver_t *p, Msat_Lit_t Lit)
DECLARATIONS ///.
Definition: msatActivity.c:45
void Msat_ClauseWriteActivity(Msat_Clause_t *pC, float Num)
Definition: msatClause.c:314
int Msat_IntVecReadSize(Msat_IntVec_t *p)
Definition: msatVec.c:233
#define MSAT_LITNOT(l)
Definition: msat.h:57
int * Msat_SolverReadAssignsArray(Msat_Solver_t *p)
Definition: msatSolverApi.c:56
void Msat_ClauseVecPush(Msat_ClauseVec_t *p, Msat_Clause_t *Entry)
Msat_MmStep_t * Msat_SolverReadMem(Msat_Solver_t *p)
Definition: msatSolverApi.c:60
#define MSAT_LITSIGN(l)
Definition: msat.h:58
Msat_ClauseVec_t ** Msat_SolverReadWatchedArray(Msat_Solver_t *p)
Definition: msatSolverApi.c:55
void Msat_IntVecShrink(Msat_IntVec_t *p, int nSizeNew)
Definition: msatVec.c:318
int * Msat_IntVecReadArray(Msat_IntVec_t *p)
Definition: msatVec.c:217
int Var
Definition: SolverTypes.h:42
#define assert(ex)
Definition: util_old.h:213
int * Msat_SolverReadDecisionLevelArray(Msat_Solver_t *p)
Definition: msatSolverApi.c:51
void Msat_IntVecSort(Msat_IntVec_t *p, int fReverse)
Definition: msatVec.c:442
void Msat_SolverClaBumpActivity(Msat_Solver_t *p, Msat_Clause_t *pC)
Definition: msatActivity.c:105
void Msat_ClauseFree ( Msat_Solver_t p,
Msat_Clause_t pC,
int  fRemoveWatched 
)

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

Synopsis [Deallocates the clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 223 of file msatClause.c.

224 {
225  if ( fRemoveWatched )
226  {
227  Msat_Lit_t Lit;
228  Msat_ClauseVec_t ** pvWatched;
229  pvWatched = Msat_SolverReadWatchedArray( p );
230  Lit = MSAT_LITNOT( pC->pData[0] );
231  Msat_ClauseRemoveWatch( pvWatched[Lit], pC );
232  Lit = MSAT_LITNOT( pC->pData[1] );
233  Msat_ClauseRemoveWatch( pvWatched[Lit], pC );
234  }
235 
236 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
237  ABC_FREE( pC );
238 #else
239  Msat_MmStepEntryRecycle( Msat_SolverReadMem(p), (char *)pC, pC->nSizeAlloc );
240 #endif
241 
242 }
void Msat_ClauseRemoveWatch(Msat_ClauseVec_t *vClauses, Msat_Clause_t *pC)
Definition: msatClause.c:444
void Msat_MmStepEntryRecycle(Msat_MmStep_t *p, char *pEntry, int nBytes)
Definition: msatMem.c:503
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Msat_Lit_t
Definition: msatInt.h:65
#define MSAT_LITNOT(l)
Definition: msat.h:57
Msat_MmStep_t * Msat_SolverReadMem(Msat_Solver_t *p)
Definition: msatSolverApi.c:60
Msat_ClauseVec_t ** Msat_SolverReadWatchedArray(Msat_Solver_t *p)
Definition: msatSolverApi.c:55
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Msat_ClauseIsLocked ( Msat_Solver_t p,
Msat_Clause_t pC 
)

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

Synopsis [Checks whether the learned clause is locked.]

Description [The clause may be locked if it is the reason of a recent conflict. Such clause cannot be removed from the database.]

SideEffects []

SeeAlso []

Definition at line 278 of file msatClause.c.

279 {
280  Msat_Clause_t ** pReasons = Msat_SolverReadReasonArray( p );
281  return (int )(pReasons[MSAT_LIT2VAR(pC->pData[0])] == pC);
282 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define MSAT_LIT2VAR(l)
Definition: msat.h:59
typedefABC_NAMESPACE_HEADER_START struct Msat_Clause_t_ Msat_Clause_t
INCLUDES ///.
Definition: msatInt.h:57
Msat_Clause_t ** Msat_SolverReadReasonArray(Msat_Solver_t *p)
Definition: msatSolverApi.c:52
void Msat_ClausePrint ( Msat_Clause_t pC)

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

Synopsis [Prints the given clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 468 of file msatClause.c.

469 {
470  int i;
471  if ( pC == NULL )
472  printf( "NULL pointer" );
473  else
474  {
475  if ( pC->fLearned )
476  printf( "Act = %.4f ", Msat_ClauseReadActivity(pC) );
477  for ( i = 0; i < (int)pC->nSize; i++ )
478  printf( " %s%d", ((pC->pData[i]&1)? "-": ""), pC->pData[i]/2 + 1 );
479  }
480  printf( "\n" );
481 }
float Msat_ClauseReadActivity(Msat_Clause_t *pC)
Definition: msatClause.c:295
void Msat_ClausePrintSymbols ( Msat_Clause_t pC)

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

Synopsis [Prints the given clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 515 of file msatClause.c.

516 {
517  int i;
518  if ( pC == NULL )
519  printf( "NULL pointer" );
520  else
521  {
522 // if ( pC->fLearned )
523 // printf( "Act = %.4f ", Msat_ClauseReadActivity(pC) );
524  for ( i = 0; i < (int)pC->nSize; i++ )
525  printf(" "L_LIT, L_lit(pC->pData[i]));
526  }
527  printf( "\n" );
528 }
#define L_lit(p)
Definition: satSolver.c:43
#define L_LIT
Definition: satSolver.c:42
int Msat_ClausePropagate ( Msat_Clause_t pC,
Msat_Lit_t  Lit,
int *  pAssigns,
Msat_Lit_t pLit_out 
)

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

Synopsis [Propages the assignment.]

Description [The literal that has become true (Lit) is given to this procedure. The array of current variable assignments is given for efficiency. The output literal (pLit_out) can be the second watched literal (if TRUE is returned) or the conflict literal (if FALSE is returned). This messy interface is used to improve performance. This procedure accounts for ~50% of the runtime of the solver.]

SideEffects []

SeeAlso []

Definition at line 335 of file msatClause.c.

336 {
337  // make sure the false literal is pC->pData[1]
338  Msat_Lit_t LitF = MSAT_LITNOT(Lit);
339  if ( pC->pData[0] == LitF )
340  pC->pData[0] = pC->pData[1], pC->pData[1] = LitF;
341  assert( pC->pData[1] == LitF );
342  // if the 0-th watch is true, clause is already satisfied
343  if ( pAssigns[MSAT_LIT2VAR(pC->pData[0])] == pC->pData[0] )
344  return 1;
345  // look for a new watch
346  if ( pC->nSize > 2 )
347  {
348  int i;
349  for ( i = 2; i < (int)pC->nSize; i++ )
350  if ( pAssigns[MSAT_LIT2VAR(pC->pData[i])] != MSAT_LITNOT(pC->pData[i]) )
351  {
352  pC->pData[1] = pC->pData[i], pC->pData[i] = LitF;
353  *pLit_out = MSAT_LITNOT(pC->pData[1]);
354  return 1;
355  }
356  }
357  // clause is unit under assignment
358  *pLit_out = pC->pData[0];
359  return 0;
360 }
#define MSAT_LIT2VAR(l)
Definition: msat.h:59
int Msat_Lit_t
Definition: msatInt.h:65
#define MSAT_LITNOT(l)
Definition: msat.h:57
#define assert(ex)
Definition: util_old.h:213
float Msat_ClauseReadActivity ( Msat_Clause_t pC)

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

Synopsis [Reads the activity of the given clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 295 of file msatClause.c.

296 {
297  float f;
298 
299  memcpy( &f, pC->pData + pC->nSize, sizeof (f));
300  return f;
301 }
char * memcpy()
int Msat_ClauseReadLearned ( Msat_Clause_t pC)

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

Synopsis [Access the data field of the clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 255 of file msatClause.c.

255 { return pC->fLearned; }
int* Msat_ClauseReadLits ( Msat_Clause_t pC)

Definition at line 257 of file msatClause.c.

257 { return pC->pData; }
int Msat_ClauseReadMark ( Msat_Clause_t pC)

Definition at line 258 of file msatClause.c.

258 { return pC->fMark; }
int Msat_ClauseReadNum ( Msat_Clause_t pC)

Definition at line 259 of file msatClause.c.

259 { return pC->Num; }
int Msat_ClauseReadSize ( Msat_Clause_t pC)

Definition at line 256 of file msatClause.c.

256 { return pC->nSize; }
int Msat_ClauseReadTypeA ( Msat_Clause_t pC)

Definition at line 260 of file msatClause.c.

260 { return pC->fTypeA; }
void Msat_ClauseRemoveWatch ( Msat_ClauseVec_t vClauses,
Msat_Clause_t pC 
)

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

Synopsis [Removes the given clause from the watched list.]

Description []

SideEffects []

SeeAlso []

Definition at line 444 of file msatClause.c.

445 {
446  Msat_Clause_t ** pClauses;
447  int nClauses, i;
448  nClauses = Msat_ClauseVecReadSize( vClauses );
449  pClauses = Msat_ClauseVecReadArray( vClauses );
450  for ( i = 0; pClauses[i] != pC; i++ )
451  assert( i < nClauses );
452  for ( ; i < nClauses - 1; i++ )
453  pClauses[i] = pClauses[i+1];
454  Msat_ClauseVecPop( vClauses );
455 }
typedefABC_NAMESPACE_HEADER_START struct Msat_Clause_t_ Msat_Clause_t
INCLUDES ///.
Definition: msatInt.h:57
int Msat_ClauseVecReadSize(Msat_ClauseVec_t *p)
Msat_Clause_t ** Msat_ClauseVecReadArray(Msat_ClauseVec_t *p)
Definition: msatClauseVec.c:85
Msat_Clause_t * Msat_ClauseVecPop(Msat_ClauseVec_t *p)
#define assert(ex)
Definition: util_old.h:213
void Msat_ClauseSetMark ( Msat_Clause_t pC,
int  fMark 
)

Definition at line 262 of file msatClause.c.

262 { pC->fMark = fMark; }
void Msat_ClauseSetNum ( Msat_Clause_t pC,
int  Num 
)

Definition at line 263 of file msatClause.c.

263 { pC->Num = Num; }
void Msat_ClauseSetTypeA ( Msat_Clause_t pC,
int  fTypeA 
)

Definition at line 264 of file msatClause.c.

264 { pC->fTypeA = fTypeA; }
int Msat_ClauseSimplify ( Msat_Clause_t pC,
int *  pAssigns 
)

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

Synopsis [Simplifies the clause.]

Description [Assumes everything has been propagated! (esp. watches in clauses are NOT unsatisfied)]

SideEffects []

SeeAlso []

Definition at line 374 of file msatClause.c.

375 {
376  Msat_Var_t Var;
377  int i, j;
378  for ( i = j = 0; i < (int)pC->nSize; i++ )
379  {
380  Var = MSAT_LIT2VAR(pC->pData[i]);
381  if ( pAssigns[Var] == MSAT_VAR_UNASSIGNED )
382  {
383  pC->pData[j++] = pC->pData[i];
384  continue;
385  }
386  if ( pAssigns[Var] == pC->pData[i] )
387  return 1;
388  // otherwise, the value of the literal is false
389  // make sure, this literal is not watched
390  assert( i >= 2 );
391  }
392  // if the size has changed, update it and move activity
393  if ( j < (int)pC->nSize )
394  {
395  float Activ = Msat_ClauseReadActivity(pC);
396  pC->nSize = j;
397  Msat_ClauseWriteActivity(pC, Activ);
398  }
399  return 0;
400 }
int Msat_Var_t
Definition: msatInt.h:66
#define MSAT_VAR_UNASSIGNED
Definition: msatInt.h:68
#define MSAT_LIT2VAR(l)
Definition: msat.h:59
void Msat_ClauseWriteActivity(Msat_Clause_t *pC, float Num)
Definition: msatClause.c:314
int Var
Definition: SolverTypes.h:42
#define assert(ex)
Definition: util_old.h:213
float Msat_ClauseReadActivity(Msat_Clause_t *pC)
Definition: msatClause.c:295
void Msat_ClauseWriteActivity ( Msat_Clause_t pC,
float  Num 
)

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

Synopsis [Sets the activity of the clause.]

Description []

SideEffects []

SeeAlso []

Definition at line 314 of file msatClause.c.

315 {
316  memcpy( pC->pData + pC->nSize, &Num, sizeof (Num) );
317 }
char * memcpy()
void Msat_ClauseWriteDimacs ( FILE *  pFile,
Msat_Clause_t pC,
int  fIncrement 
)

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

Synopsis [Writes the given clause in a file in DIMACS format.]

Description []

SideEffects []

SeeAlso []

Definition at line 494 of file msatClause.c.

495 {
496  int i;
497  for ( i = 0; i < (int)pC->nSize; i++ )
498  fprintf( pFile, "%s%d ", ((pC->pData[i]&1)? "-": ""), pC->pData[i]/2 + (int)(fIncrement>0) );
499  if ( fIncrement )
500  fprintf( pFile, "0" );
501  fprintf( pFile, "\n" );
502 }