Skip to content

Commit 7434d5e

Browse files
committed
Make Glucose support compile
Hardness support was added to minisat2 only.
1 parent e2437a1 commit 7434d5e

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/solvers/sat/satcheck_glucose.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ void satcheck_glucose_baset<T>::lcnf(const bvt &bv)
121121

122122
solver->addClause_(c);
123123

124+
with_solver_hardness(
125+
[&bv](solver_hardnesst &hardness) { hardness.register_clause(bv); });
126+
124127
clause_counter++;
125128
}
126129
catch(Glucose::OutOfMemoryException)

src/solvers/sat/satcheck_glucose.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Author: Daniel Kroening, [email protected]
1212

1313
#include "cnf.h"
1414

15+
#include <solvers/hardness_collector.h>
16+
1517
// Select one: basic solver or with simplification.
1618
// Note that the solver with simplifier isn't really robust
1719
// when used incrementally, as variables may disappear
@@ -23,8 +25,8 @@ class Solver; // NOLINT(readability/identifiers)
2325
class SimpSolver; // NOLINT(readability/identifiers)
2426
}
2527

26-
template<typename T>
27-
class satcheck_glucose_baset:public cnf_solvert
28+
template <typename T>
29+
class satcheck_glucose_baset : public cnf_solvert, public hardness_collectort
2830
{
2931
public:
3032
satcheck_glucose_baset(T *, message_handlert &message_handler);
@@ -51,13 +53,29 @@ class satcheck_glucose_baset:public cnf_solvert
5153
return true;
5254
}
5355

56+
void
57+
with_solver_hardness(std::function<void(solver_hardnesst &)> handler) override
58+
{
59+
if(solver_hardness.has_value())
60+
{
61+
handler(solver_hardness.value());
62+
}
63+
}
64+
65+
void enable_hardness_collection() override
66+
{
67+
solver_hardness = solver_hardnesst{};
68+
}
69+
5470
protected:
5571
resultt do_prop_solve() override;
5672

5773
T *solver;
5874

5975
void add_variables();
6076
bvt assumptions;
77+
78+
optionalt<solver_hardnesst> solver_hardness;
6179
};
6280

6381
class satcheck_glucose_no_simplifiert:

0 commit comments

Comments
 (0)