spot 2.3.1

- Main Page
- Related Pages
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Public Types | Public Member Functions | List of all members
spot::satsolver Class Reference

Interface with a SAT solver. More...

`#include <spot/misc/satsolver.hh>`

Collaboration diagram for spot::satsolver:

## Public Types
typedef std::vector< bool > | solution
typedef std::pair< int, solution > | solution_pair

## Public Member Functions
| satsolver ()
| Construct the sat solver and itinialize 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 ()
| 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 litteral value. Must only be used with distributed picolib. More...
solution_pair | get_solution ()
| Return std::vector<solving_return_code, solution>. More...

## Detailed Description

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.

## Constructor & Destructor Documentation

spot::satsolver::satsolver | ( |  | ) |

Construct the sat solver and itinialize variables. If no satsolver is provided through SPOT_SATSOLVER env var, a distributed version of PicoSAT will be used.

## Member Function Documentation

void spot::satsolver::add | ( | std::initializer_list< int > | values | ) |

Add a list of lit. to the current clause.

void spot::satsolver::add | ( | int | v | ) |

Add a single 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 litteral value. Must only be used with distributed picolib.

template<typename T >

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.

template<typename T , typename... Args>

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().

template<typename T >

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().

template<typename T , typename... Args>

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().

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 | ( |  | ) |

Returns std::pair<nvars, nclauses>;.

The documentation for this class was generated from the following file:

- spot/misc/satsolver.hh

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.