Skip to content

Commit a81a346

Browse files
committed
Make Glucose configuration build after solver hardness changes
In diffblue#5480 the solver hardness interface was updated, but changes were only implemented in the Minisat2 interface. Update the Glucose interface to match these changes. To avoid future regressions, make the check-macos-10_15-cmake-clang GitHub action use Glucose.
1 parent 253f39c commit a81a346

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/pull-request-checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
run: |
165165
mkdir build
166166
cd build
167-
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
167+
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -Dsat_impl=glucose
168168
- name: Build with Ninja
169169
run: cd build; ninja -j2
170170
- name: Print ccache stats

src/solvers/sat/satcheck_glucose.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,22 @@ 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); });
124+
with_solver_hardness([this, &bv](solver_hardnesst &hardness) {
125+
// To map clauses to lines of program code, track clause indices in the
126+
// dimacs cnf output. Dimacs output is generated after processing
127+
// clauses to remove duplicates and clauses that are trivially true.
128+
// Here, a clause is checked to see if it can be thus eliminated. If
129+
// not, add the clause index to list of clauses in
130+
// solver_hardnesst::register_clause().
131+
static size_t cnf_clause_index = 0;
132+
bvt cnf;
133+
bool clause_removed = process_clause(bv, cnf);
134+
135+
if(!clause_removed)
136+
cnf_clause_index++;
137+
138+
hardness.register_clause(bv, cnf, cnf_clause_index, !clause_removed);
139+
});
126140

127141
clause_counter++;
128142
}

0 commit comments

Comments
 (0)