#include <errno.h>
#include <signal.h>
#include "misc/zlib/zlib.h"
#include "System.h"
#include "ParseUtils.h"
#include "Options.h"
#include "Dimacs.h"
#include "Solver.h"
Go to the source code of this file.
int MainSat |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 71 of file MainSat.cpp.
74 setUsageHelp(
"USAGE: %s [options] <input-file> <result-output-file>\n\n where input may be either in plain or gzipped DIMACS.\n");
77 #if defined(__linux__)
78 fpu_control_t oldcw, newcw;
79 _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
80 printf(
"WARNING: for repeatability, setting FPU to use double precision\n");
84 IntOption verb (
"MAIN",
"verb",
"Verbosity level (0=silent, 1=some, 2=more).", 1,
IntRange(0, 2));
92 double initial_time =
cpuTime();
126 printf(
"Reading from standard input... Use '--help' for help.\n");
132 printf(
"ERROR! Could not open file: %s\n", argc == 1 ?
"<stdin>" : argv[1]),
exit(1);
135 printf(
"============================[ Problem Statistics ]=============================\n");
140 FILE* res = (argc >= 3) ? fopen(argv[2],
"wb") : NULL;
143 printf(
"| Number of variables: %12d |\n", S.
nVars());
144 printf(
"| Number of clauses: %12d |\n", S.
nClauses()); }
146 double parsed_time =
cpuTime();
148 printf(
"| Parse time: %12.2f s |\n", parsed_time - initial_time);
157 if (res != NULL) fprintf(res,
"UNSAT\n"), fclose(res);
159 printf(
"===============================================================================\n");
160 printf(
"Solved by unit propagation\n");
163 printf(
"UNSATISFIABLE\n");
172 printf(ret ==
l_True ?
"SATISFIABLE\n" : ret ==
l_False ?
"UNSATISFIABLE\n" :
"INDETERMINATE\n");
175 fprintf(res,
"SAT\n");
176 for (
int i = 0; i < S.
nVars(); i++)
178 fprintf(res,
"%s%s%d", (i==0)?
"":
" ", (S.
model[i]==
l_True)?
"":
"-", i+1);
179 fprintf(res,
" 0\n");
181 fprintf(res,
"UNSAT\n");
183 fprintf(res,
"INDET\n");
193 printf(
"===============================================================================\n");
194 printf(
"INDETERMINATE\n");
static double cpuTime(void)
ABC_NAMESPACE_IMPL_START int ZEXPORT gzclose(gzFile file)
int parseOptions(int &argc, char **argv, bool strict=false)
lbool solveLimited(const vec< Lit > &assumps)
typedefABC_NAMESPACE_HEADER_START struct solver_t solver
gzFile ZEXPORT gzdopen(int fd, const char *mode)
void setUsageHelp(const char *str)
void printStats(Solver &solver)
gzFile ZEXPORT gzopen(const char *path, const char *mode)
static void parse_DIMACS(gzFile input_stream, Solver &S)
void printStats |
( |
Solver & |
solver | ) |
|
Definition at line 37 of file MainSat.cpp.
41 printf(
"restarts : %-12.0f\n", (
double)(int64_t)solver.
starts);
42 printf(
"conflicts : %-12.0f (%.0f /sec)\n", (
double)(int64_t)solver.
conflicts, (
double)(int64_t)solver.
conflicts / cpu_time);
43 printf(
"decisions : %-12.0f (%4.2f %% random) (%.0f /sec)\n", (
double)(int64_t)solver.
decisions, (
double)(int64_t)solver.
rnd_decisions*100 / (
double)(int64_t)solver.
decisions, (
double)(int64_t)solver.
decisions / cpu_time);
44 printf(
"propagations : %-12.0f (%.0f /sec)\n", (
double)(int64_t)solver.
propagations, (
double)(int64_t)solver.
propagations / cpu_time);
46 if (mem_used != 0) printf(
"Memory used : %.2f MB\n", mem_used);
47 printf(
"CPU time : %g s\n", cpu_time);
static double cpuTime(void)
static void SIGINT_exit |
( |
int |
signum | ) |
|
|
static |
Definition at line 59 of file MainSat.cpp.
60 printf(
"\n"); printf(
"*** INTERRUPTED ***\n");
61 if (
solver->verbosity > 0){
63 printf(
"\n"); printf(
"*** INTERRUPTED ***\n"); }
typedefABC_NAMESPACE_HEADER_START struct solver_t solver
void printStats(Solver &solver)
static void SIGINT_interrupt |
( |
int |
signum | ) |
|
|
static |
Definition at line 54 of file MainSat.cpp.
typedefABC_NAMESPACE_HEADER_START struct solver_t solver