Skip to content

Commit 38daaf7

Browse files
authored
Merge pull request #7372 from tautschnig/bugfixes/external-sat
External SAT back-end: not all variables are required
2 parents 3db352e + 9ff5164 commit 38daaf7

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

src/solvers/sat/external_sat.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ external_satt::resultt external_satt::parse_result(std::string solver_output)
7575
std::string line;
7676
external_satt::resultt result = resultt::P_ERROR;
7777
std::vector<bool> assigned_variables(no_variables(), false);
78-
assignment.insert(assignment.begin(), no_variables(), tvt(false));
78+
assignment.insert(assignment.begin(), no_variables(), tvt::unknown());
7979

8080
while(getline(response_istream, line))
8181
{
@@ -146,16 +146,19 @@ external_satt::resultt external_satt::parse_result(std::string solver_output)
146146

147147
if(result == resultt::P_SATISFIABLE)
148148
{
149-
// We don't need to check zero
150-
for(size_t index = 1; index < no_variables(); index++)
151-
{
152-
if(!assigned_variables[index])
153-
{
154-
log.error() << "No assignment was found for literal: " << index
149+
log.conditional_output(
150+
log.debug(), [this, &assigned_variables](messaget::mstreamt &mstream) {
151+
// We don't need to check zero
152+
for(size_t index = 1; index < no_variables(); index++)
153+
{
154+
// this may happen when a variable does not appear in any clause
155+
if(!assigned_variables[index])
156+
{
157+
mstream << "No assignment was found for literal: " << index
155158
<< messaget::eom;
156-
return resultt::P_ERROR;
157-
}
158-
}
159+
}
160+
}
161+
});
159162
return resultt::P_SATISFIABLE;
160163
}
161164

unit/solvers/sat/external_sat.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ SCENARIO("external_sat", "[core][solvers][sat][external_sat]")
4848
}
4949
}
5050

51-
AND_GIVEN("the output is malformed")
52-
{
53-
auto result = "c too few assignments\ns SATISFIABLE\nv 1 2 3 4";
54-
WHEN("the solver output contains:\n" << result)
55-
{
56-
THEN("the result is set to error")
57-
{
58-
satcheck.set_no_variables(100);
59-
REQUIRE(satcheck.parse_result(result) == propt::resultt::P_ERROR);
60-
}
61-
}
62-
}
63-
6451
AND_GIVEN("SAT instance is unsatisfiable")
6552
{
6653
std::string unsat_result = GENERATE(

0 commit comments

Comments
 (0)