Skip to content

Commit f1be42c

Browse files
committed
Honour --sat-solver with refinement
Refinement should not unconditionally use the default solver despite the user specifying `--sat-solver <solver>` on the command line.
1 parent 6e9834c commit f1be42c

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

src/goto-checker/solver_factory.cpp

+10-21
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ make_satcheck_prop(message_handlert &message_handler, const optionst &options)
222222
static std::unique_ptr<propt>
223223
get_sat_solver(message_handlert &message_handler, const optionst &options)
224224
{
225+
const bool no_simplifier = options.get_bool_option("beautify") ||
226+
!options.get_bool_option("sat-preprocessor") ||
227+
options.get_bool_option("refine") ||
228+
options.get_bool_option("refine-strings");
229+
225230
if(options.is_set("sat-solver"))
226231
{
227232
const std::string &solver_option = options.get_option("sat-solver");
@@ -252,9 +257,7 @@ get_sat_solver(message_handlert &message_handler, const optionst &options)
252257
else if(solver_option == "minisat2")
253258
{
254259
#if defined SATCHECK_MINISAT2
255-
if(
256-
options.get_bool_option("beautify") ||
257-
!options.get_bool_option("sat-preprocessor")) // no simplifier
260+
if(no_simplifier)
258261
{
259262
// simplifier won't work with beautification
260263
return make_satcheck_prop<satcheck_minisat_no_simplifiert>(
@@ -296,9 +299,7 @@ get_sat_solver(message_handlert &message_handler, const optionst &options)
296299
else if(solver_option == "glucose")
297300
{
298301
#if defined SATCHECK_GLUCOSE
299-
if(
300-
options.get_bool_option("beautify") ||
301-
!options.get_bool_option("sat-preprocessor")) // no simplifier
302+
if(no_simplifier)
302303
{
303304
// simplifier won't work with beautification
304305
return make_satcheck_prop<satcheck_glucose_no_simplifiert>(
@@ -331,9 +332,7 @@ get_sat_solver(message_handlert &message_handler, const optionst &options)
331332
}
332333

333334
// default solver
334-
if(
335-
options.get_bool_option("beautify") ||
336-
!options.get_bool_option("sat-preprocessor")) // no simplifier
335+
if(no_simplifier)
337336
{
338337
// simplifier won't work with beautification
339338
return make_satcheck_prop<satcheck_no_simplifiert>(
@@ -396,16 +395,7 @@ std::unique_ptr<solver_factoryt::solvert> solver_factoryt::get_external_sat()
396395

397396
std::unique_ptr<solver_factoryt::solvert> solver_factoryt::get_bv_refinement()
398397
{
399-
std::unique_ptr<propt> prop = [this]() -> std::unique_ptr<propt> {
400-
// We offer the option to disable the SAT preprocessor
401-
if(options.get_bool_option("sat-preprocessor"))
402-
{
403-
no_beautification();
404-
return make_satcheck_prop<satcheckt>(message_handler, options);
405-
}
406-
return make_satcheck_prop<satcheck_no_simplifiert>(
407-
message_handler, options);
408-
}();
398+
std::unique_ptr<propt> prop = get_sat_solver(message_handler, options);
409399

410400
bv_refinementt::infot info;
411401
info.ns = &ns;
@@ -435,8 +425,7 @@ solver_factoryt::get_string_refinement()
435425
{
436426
string_refinementt::infot info;
437427
info.ns = &ns;
438-
auto prop =
439-
make_satcheck_prop<satcheck_no_simplifiert>(message_handler, options);
428+
auto prop = get_sat_solver(message_handler, options);
440429
info.prop = prop.get();
441430
info.refinement_bound = DEFAULT_MAX_NB_REFINEMENT;
442431
info.output_xml = output_xml_in_refinement;

0 commit comments

Comments
 (0)