Skip to content

Commit

Permalink
implement status flag (see #87)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-fleury committed Feb 2, 2024
1 parent 005ebf4 commit a19417d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Version 2.0.0
-------------

- Added `Dockerfile` to support docker containers.
- Added `--no-status` to skip printing "s SATISFIABLE" or "s
UNSATISFIABLE". This is useful for online proof checking.

Version 1.9.4
-------------
Expand Down
17 changes: 13 additions & 4 deletions src/cadical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ int App::main (int argc, char **argv) {
#ifndef __MINGW32__
const char *time_limit_specified = 0;
#endif
bool witness = true, less = false;
bool witness = true, less = false, status = true;
const char *dimacs_name, *err;

for (int i = 1; i < argc; i++) {
Expand Down Expand Up @@ -449,6 +449,14 @@ int App::main (int argc, char **argv) {
!strcmp (argv[i], "--witness=false") ||
!strcmp (argv[i], "--witness=0"))
witness = false;
else if (!strcmp (argv[i], "--status") ||
!strcmp (argv[i], "--status=true") ||
!strcmp (argv[i], "--status=1"))
status = true;
else if (!strcmp (argv[i], "-n") || !strcmp (argv[i], "--no-status") ||
!strcmp (argv[i], "--status=false") ||
!strcmp (argv[i], "--status=0"))
status = false;
else if (!strcmp (argv[i], "--less")) { // EXPERIMENTAL!
if (less)
APPERR ("multiple '--less' options");
Expand Down Expand Up @@ -876,12 +884,13 @@ int App::main (int argc, char **argv) {
}

if (res == 10) {
fputs ("s SATISFIABLE\n", write_result_file);
if (status)
fputs ("s SATISFIABLE\n", write_result_file);
if (witness)
print_witness (write_result_file);
} else if (res == 20)
} else if (res == 20 && status)
fputs ("s UNSATISFIABLE\n", write_result_file);
else
else if (status)
fputs ("c UNKNOWN\n", write_result_file);
fflush (write_result_file);
if (write_result_path)
Expand Down

0 comments on commit a19417d

Please sign in to comment.