spot 2.12.2
|
Interface with a SAT solver. More...
#include <spot/misc/satsolver.hh>
Public Types | |
typedef std::vector< bool > | solution |
typedef std::pair< int, solution > | solution_pair |
Public Member Functions | |
satsolver () | |
Construct the sat solver and initialize variables. If no satsolver is provided through SPOT_SATSOLVER env var, a distributed version of PicoSAT will be used. More... | |
void | adjust_nvars (int nvars) |
Adjust the number of variables used in the cnf formula. More... | |
void | set_nassumptions_vars (int nassumptions_vars) |
Declare the number of vars reserved for assumptions. More... | |
void | add (std::initializer_list< int > values) |
Add a list of lit. to the current clause. More... | |
void | add (int v) |
Add a single lit. to the current clause. More... | |
int | get_nb_clauses () const |
Get the current number of clauses. More... | |
int | get_nb_vars () const |
Get the current number of variables. More... | |
std::pair< int, int > | stats () const |
Returns std::pair<nvars, nclauses>;. More... | |
template<typename T > | |
void | comment_rec (T single) |
Add a comment. It should be used only in debug mode after providing a satsolver. More... | |
template<typename T , typename... Args> | |
void | comment_rec (T first, Args... args) |
Add comments. It should be used only in debug mode after providing a satsolver. More... | |
template<typename T > | |
void | comment (T single) |
Add a comment. It will start with "c ". It should be used only in debug mode after providing a satsolver. More... | |
template<typename T , typename... Args> | |
void | comment (T first, Args... args) |
Add comments. It will start with "c ". It should be used only in debug mode after providing a satsolver. More... | |
void | assume (int lit) |
Assume a literal value. Must only be used with distributed picolib. More... | |
solution_pair | get_solution () |
Return std::vector<solving_return_code, solution>. More... | |
Interface with a SAT solver.
This class provides the necessary functions to add clauses, comments. Depending on SPOT_SATSOLVER, it will use either picosat solver (default) or the given satsolver.
Now that spot is distributed with a satsolver (PicoSAT), it is used by default. But another satsolver can be configured via the SPOT_SATSOLVER
environment variable. It must be set following this: "satsolver [options] %I > %O" where I and O are replaced by input and output files.
spot::satsolver::satsolver | ( | ) |
Construct the sat solver and initialize variables. If no satsolver is provided through SPOT_SATSOLVER env var, a distributed version of PicoSAT will be used.
void spot::satsolver::add | ( | int | v | ) |
Add a single lit. to the current clause.
void spot::satsolver::add | ( | std::initializer_list< int > | values | ) |
Add a list of lit. to the current clause.
void spot::satsolver::adjust_nvars | ( | int | nvars | ) |
Adjust the number of variables used in the cnf formula.
void spot::satsolver::assume | ( | int | lit | ) |
Assume a literal value. Must only be used with distributed picolib.
void spot::satsolver::comment | ( | T | first, |
Args... | args | ||
) |
Add comments. It will start with "c ". It should be used only in debug mode after providing a satsolver.
References comment_rec().
void spot::satsolver::comment | ( | T | single | ) |
Add a comment. It will start with "c ". It should be used only in debug mode after providing a satsolver.
void spot::satsolver::comment_rec | ( | T | first, |
Args... | args | ||
) |
Add comments. It should be used only in debug mode after providing a satsolver.
References comment_rec().
void spot::satsolver::comment_rec | ( | T | single | ) |
Add a comment. It should be used only in debug mode after providing a satsolver.
Referenced by comment(), and comment_rec().
int spot::satsolver::get_nb_clauses | ( | ) | const |
Get the current number of clauses.
int spot::satsolver::get_nb_vars | ( | ) | const |
Get the current number of variables.
solution_pair spot::satsolver::get_solution | ( | ) |
Return std::vector<solving_return_code, solution>.
void spot::satsolver::set_nassumptions_vars | ( | int | nassumptions_vars | ) |
Declare the number of vars reserved for assumptions.
std::pair< int, int > spot::satsolver::stats | ( | ) | const |
Returns std::pair<nvars, nclauses>;.