Skip to content

Commit 8a79c9b

Browse files
authored
Merge pull request #5709 from tautschnig/fix-glucose
Make Glucose configuration build after solver hardness changes
2 parents caf309e + 948e75c commit 8a79c9b

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
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-2
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)