Program Listing for File main.cpp

Return to documentation for file (src/main.cpp)

#include "sysexits.h"

#include <vector>
#include <iostream>
#include "solver.h"

int printInputArgumentDescription();
int main(int argc, char *argv[]) {
  if (argc == 1 || (argc == 2 && strcmp(argv[0], "-h") == 0))
    printInputArgumentDescription();

  Solver theSolver(argc, argv);

  if (theSolver.config().perform_random_sampling_)
    theSolver.sample_models();
  else
    theSolver.solve();

  return EXIT_SUCCESS;
}
int printInputArgumentDescription() {
  std::cout << "Usage: spur [settings]\n"
            << "\t -cnf [cnf_file] Path to the CNF file\n"
            << "\t -s [s] \t Number of models \"s\" to sample uniformly at random\n"
            << "\t -tp    \t Forces two-pass sampling. (Only applicable when s=1)\n"
            << "\t -out [out_file] Path to write the specified samples\n"
            << "\t -no-sample-write Disable writing the final samples to a file.\n"
            << "\t -count-only\t Perform only model counting.  Disable sampling.\n"
            << "\t -q     \t Quiet mode\n"
            << "\t -v     \t Verbose and trace mode\n"
            << "\t -d     \t Debug mode\n"
            << "\t -t [s] \t Set time bound to s seconds\n"
            << "\t -cs [n]\t Set max cache size to n MB\n"
            << std::flush;
  exit(EX_USAGE);
}