Skip to content

Commit c8d3d13

Browse files
committed
Make Glucose configuration build after solver hardness changes
In #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 a0dbf74 commit c8d3d13

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

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

+1-1
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

+16-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,22 @@ void satcheck_glucose_baset<T>::lcnf(const bvt &bv)
122122
solver->addClause_(c);
123123

124124
with_solver_hardness(
125-
[&bv](solver_hardnesst &hardness) { hardness.register_clause(bv); });
125+
[this, &bv](solver_hardnesst &hardness) {
126+
// To map clauses to lines of program code, track clause indices in the
127+
// dimacs cnf output. Dimacs output is generated after processing
128+
// clauses to remove duplicates and clauses that are trivially true.
129+
// Here, a clause is checked to see if it can be thus eliminated. If
130+
// not, add the clause index to list of clauses in
131+
// solver_hardnesst::register_clause().
132+
static size_t cnf_clause_index = 0;
133+
bvt cnf;
134+
bool clause_removed = process_clause(bv, cnf);
135+
136+
if(!clause_removed)
137+
cnf_clause_index++;
138+
139+
hardness.register_clause(bv, cnf, cnf_clause_index, !clause_removed);
140+
});
126141

127142
clause_counter++;
128143
}

0 commit comments

Comments
 (0)