summaryrefslogtreecommitdiffstats
path: root/src/sat/bsat/satUtil.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2011-12-10 14:45:35 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2011-12-10 14:45:35 -0800
commita2228ee09b76bd6b33156c5bc4ad1fcd5cfe13a6 (patch)
tree87c2e3ed80a478a3eb2169e66037f662e2c50af3 /src/sat/bsat/satUtil.c
parent871171ffa42fe24c27831f05227fb9adfc512448 (diff)
downloadabc-a2228ee09b76bd6b33156c5bc4ad1fcd5cfe13a6.tar.gz
abc-a2228ee09b76bd6b33156c5bc4ad1fcd5cfe13a6.tar.bz2
abc-a2228ee09b76bd6b33156c5bc4ad1fcd5cfe13a6.zip
Implementing rollback in the updated solver.
Diffstat (limited to 'src/sat/bsat/satUtil.c')
-rw-r--r--src/sat/bsat/satUtil.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/sat/bsat/satUtil.c b/src/sat/bsat/satUtil.c
index 99a09081..17a9ba4a 100644
--- a/src/sat/bsat/satUtil.c
+++ b/src/sat/bsat/satUtil.c
@@ -160,6 +160,32 @@ void Sat_SolverPrintStats( FILE * pFile, sat_solver * p )
/**Function*************************************************************
+ Synopsis [Returns the number of bytes used for each variable.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Sat_Solver2GetVarMem( sat_solver2 * s )
+{
+ int Mem = 0;
+ Mem += (sizeof(s->activity[0]) == 4) ? sizeof(unsigned) : sizeof(double); // activity
+ Mem += 2 * sizeof(veci); // wlists
+ Mem += sizeof(int); // vi (variable info)
+ Mem += sizeof(int); // trail
+ Mem += sizeof(int); // orderpos
+ Mem += sizeof(int); // reasons
+ Mem += sizeof(int); // units
+ Mem += sizeof(int); // order
+ Mem += sizeof(int); // model
+ return Mem;
+}
+
+/**Function*************************************************************
+
Synopsis [Writes the given clause in a file in DIMACS format.]
Description []
@@ -177,7 +203,13 @@ void Sat_Solver2PrintStats( FILE * pFile, sat_solver2 * s )
printf( "propagations : %10d\n", (int)s->stats.propagations );
// printf( "inspects : %10d\n", (int)s->stats.inspects );
// printf( "inspects2 : %10d\n", (int)s->stats.inspects2 );
- printf( "memory : %10d\n", veci_size(&s->clauses) );
+ printf( "memory for variables %.1f Mb (free %6.2f %%) and clauses %.1f Mb (free %6.2f %%)\n",
+ 1.0 * Sat_Solver2GetVarMem(s) * s->size / (1<<20),
+ 100.0 * (s->cap - s->size) / s->cap,
+ 4.0 * (s->clauses.cap + s->learnts.cap) / (1<<20),
+ 100.0 * (s->clauses.cap - s->clauses.size +
+ s->learnts.cap - s->learnts.size) /
+ (s->clauses.cap + s->learnts.cap) );
}
/**Function*************************************************************