sat: catch cases where nbclause > INT_MAX and report them
* src/misc/satsolver.hh (clause_counter): New class. * src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc: Use it.
This commit is contained in:
parent
ba5bddec78
commit
1f3b7e8002
3 changed files with 76 additions and 16 deletions
|
|
@ -22,11 +22,49 @@
|
|||
|
||||
#include "common.hh"
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class printable;
|
||||
|
||||
class clause_counter
|
||||
{
|
||||
private:
|
||||
int count_;
|
||||
|
||||
public:
|
||||
clause_counter()
|
||||
: count_(0)
|
||||
{
|
||||
}
|
||||
|
||||
void check() const
|
||||
{
|
||||
if (count_ < 0)
|
||||
throw std::runtime_error("too many SAT clauses (more than INT_MAX)");
|
||||
}
|
||||
|
||||
clause_counter& operator++()
|
||||
{
|
||||
++count_;
|
||||
check();
|
||||
return *this;
|
||||
}
|
||||
|
||||
clause_counter& operator+=(int n)
|
||||
{
|
||||
count_ += n;
|
||||
check();
|
||||
return *this;
|
||||
}
|
||||
|
||||
int nb_clauses() const
|
||||
{
|
||||
return count_;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Run a SAT solver.
|
||||
///
|
||||
/// Run a SAT solver using the input in file \a input,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue