Skip to content

Commit 0887cfe

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-ubuntu-20_04-cmake-gcc GitHub action use Glucose.
1 parent a0dbf74 commit 0887cfe

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
@@ -83,7 +83,7 @@ jobs:
8383
run: |
8484
mkdir build
8585
cd build
86-
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
86+
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -Dsat_impl=glucose
8787
- name: Zero ccache stats and limit in size
8888
run: ccache -z --max-size=500M
8989
- name: Build with Ninja

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)