27 #include <sys/resource.h>
36 using namespace Minisat;
51 printf(
"\n"); printf(
"*** INTERRUPTED ***\n");
52 if (
solver->verbosity > 0){
54 printf(
"\n"); printf(
"*** INTERRUPTED ***\n"); }
64 setUsageHelp(
"USAGE: %s [options] <input-file> <result-output-file>\n\n where input may be either in plain or gzipped DIMACS.\n");
67 #if defined(__linux__)
68 fpu_control_t oldcw, newcw;
69 _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
70 printf(
"WARNING: for repeatability, setting FPU to use double precision\n");
74 IntOption verb (
"MAIN",
"verb",
"Verbosity level (0=silent, 1=some, 2=more).", 1,
IntRange(0, 2));
75 BoolOption pre (
"MAIN",
"pre",
"Completely turn on/off any preprocessing.",
true);
76 StringOption dimacs (
"MAIN",
"dimacs",
"If given, stop after preprocessing and write the result to this file.");
84 double initial_time =
cpuTime();
120 printf(
"Reading from standard input... Use '--help' for help.\n");
126 printf(
"ERROR! Could not open file: %s\n", argc == 1 ?
"<stdin>" : argv[1]),
exit(1);
129 printf(
"============================[ Problem Statistics ]=============================\n");
134 FILE* res = (argc >= 3) ? fopen(argv[2],
"wb") : NULL;
137 printf(
"| Number of variables: %12d |\n", S.
nVars());
138 printf(
"| Number of clauses: %12d |\n", S.
nClauses()); }
140 double parsed_time =
cpuTime();
142 printf(
"| Parse time: %12.2f s |\n", parsed_time - initial_time);
150 double simplified_time =
cpuTime();
152 printf(
"| Simplification time: %12.2f s |\n", simplified_time - parsed_time);
156 if (res != NULL) fprintf(res,
"UNSAT\n"), fclose(res);
158 printf(
"===============================================================================\n");
159 printf(
"Solved by simplification\n");
162 printf(
"UNSATISFIABLE\n");
168 printf(
"==============================[ Writing DIMACS ]===============================\n");
181 printf(ret ==
l_True ?
"SATISFIABLE\n" : ret ==
l_False ?
"UNSATISFIABLE\n" :
"INDETERMINATE\n");
184 fprintf(res,
"SAT\n");
185 for (
int i = 0; i < S.
nVars(); i++)
187 fprintf(res,
"%s%s%d", (i==0)?
"":
" ", (S.
model[i]==
l_True)?
"":
"-", i+1);
188 fprintf(res,
" 0\n");
190 fprintf(res,
"UNSAT\n");
192 fprintf(res,
"INDET\n");
202 printf(
"===============================================================================\n");
203 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)
void printStats(Solver &solver)
typedefABC_NAMESPACE_HEADER_START struct solver_t solver
gzFile ZEXPORT gzdopen(int fd, const char *mode)
lbool solveLimited(const vec< Lit > &assumps, bool do_simp=true, bool turn_off_simp=false)
void setUsageHelp(const char *str)
bool eliminate(bool turn_off_elim=false)
void toDimacs(FILE *f, const vec< Lit > &assumps)
static void SIGINT_exit(int signum)
int MainSimp(int argc, char **argv)
gzFile ZEXPORT gzopen(const char *path, const char *mode)
static void parse_DIMACS(gzFile input_stream, Solver &S)
static void SIGINT_interrupt(int signum)