ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
satTrace.c
Go to the documentation of this file.
1
20
21#include "satSolver.h"
22
24
25
26/*
27 The trace of SAT solving contains the original clause of the problem
28 along with the learned clauses derived during SAT solving.
29 The first line of the resulting file contains 3 numbers instead of 2:
30 c <num_vars> <num_all_clauses> <num_root_clauses>
31*/
32
36
37
41
53void Sat_SolverTraceStart( sat_solver * pSat, char * pName )
54{
55 assert( pSat->pFile == NULL );
56 pSat->pFile = fopen( pName, "w" );
57 fprintf( pSat->pFile, " \n" );
58 pSat->nClauses = 0;
59 pSat->nRoots = 0;
60}
61
74{
75 if ( pSat->pFile == NULL )
76 return;
77 rewind( pSat->pFile );
78 fprintf( pSat->pFile, "p %d %d %d", sat_solver_nvars(pSat), pSat->nClauses, pSat->nRoots );
79 fclose( pSat->pFile );
80 pSat->pFile = NULL;
81}
82
83
95void Sat_SolverTraceWrite( sat_solver * pSat, int * pBeg, int * pEnd, int fRoot )
96{
97 if ( pSat->pFile == NULL )
98 return;
99 pSat->nClauses++;
100 pSat->nRoots += fRoot;
101 for ( ; pBeg < pEnd ; pBeg++ )
102 fprintf( pSat->pFile, " %d", lit_print(*pBeg) );
103 fprintf( pSat->pFile, " 0\n" );
104}
105
109
110
112
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define sat_solver
Definition cecSatG2.c:34
int sat_solver_nvars(sat_solver *s)
Definition satSolver.c:2369
ABC_NAMESPACE_IMPL_START void Sat_SolverTraceStart(sat_solver *pSat, char *pName)
DECLARATIONS ///.
Definition satTrace.c:53
void Sat_SolverTraceStop(sat_solver *pSat)
Definition satTrace.c:73
void Sat_SolverTraceWrite(sat_solver *pSat, int *pBeg, int *pEnd, int fRoot)
Definition satTrace.c:95
FILE * pFile
Definition satSolver.h:192
#define assert(ex)
Definition util_old.h:213
VOID_HACK rewind()