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
|
|
@ -299,7 +299,7 @@ namespace spot
|
|||
void dtba_to_sat(std::ostream& out, const tgba* ref, dict& d,
|
||||
bool state_based)
|
||||
{
|
||||
int nclauses = 0;
|
||||
clause_counter nclauses;
|
||||
int ref_size = 0;
|
||||
|
||||
scc_map sm(ref);
|
||||
|
|
@ -359,7 +359,7 @@ namespace spot
|
|||
}
|
||||
++j;
|
||||
}
|
||||
if (!nclauses)
|
||||
if (!nclauses.nb_clauses())
|
||||
dout << "(none)\n";
|
||||
|
||||
dout << "(1) the candidate automaton is complete\n";
|
||||
|
|
@ -636,7 +636,7 @@ namespace spot
|
|||
}
|
||||
}
|
||||
out.seekp(0);
|
||||
out << "p cnf " << d.nvars << " " << nclauses;
|
||||
out << "p cnf " << d.nvars << " " << nclauses.nb_clauses();
|
||||
}
|
||||
|
||||
static tgba_explicit_number*
|
||||
|
|
@ -769,11 +769,22 @@ namespace spot
|
|||
current = new dict;
|
||||
current->cand_size = target_state_number;
|
||||
|
||||
cnf = create_tmpfile("dtba-sat-", ".cnf");
|
||||
std::fstream cnfs(cnf->name(),
|
||||
std::ios_base::trunc | std::ios_base::out);
|
||||
dtba_to_sat(cnfs, a, *current, state_based);
|
||||
cnfs.close();
|
||||
try
|
||||
{
|
||||
cnf = create_tmpfile("dtba-sat-", ".cnf");
|
||||
std::fstream cnfs(cnf->name(),
|
||||
std::ios_base::trunc | std::ios_base::out);
|
||||
dtba_to_sat(cnfs, a, *current, state_based);
|
||||
cnfs.close();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (DEBUG)
|
||||
xrename(cnf->name(), "dtba-sat.cnf");
|
||||
delete current;
|
||||
delete cnf;
|
||||
throw;
|
||||
}
|
||||
|
||||
out = create_tmpfile("dtba-sat-", ".out");
|
||||
satsolver(cnf, out);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue