From ad34df900d79aad64558b354a866870715bfd007 Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Fri, 10 Dec 2021 09:07:30 -0800 Subject: Add switches to toggle eager and inclusion solvers --- src/options/strings_options.toml | 16 ++++++++++++++++ src/theory/strings/regexp_solver.cpp | 2 +- src/theory/strings/theory_strings.cpp | 19 +++++++++++++++---- src/theory/strings/theory_strings.h | 2 +- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/options/strings_options.toml b/src/options/strings_options.toml index 01b92c1b7..46f53147b 100644 --- a/src/options/strings_options.toml +++ b/src/options/strings_options.toml @@ -207,3 +207,19 @@ name = "Strings Theory" type = "bool" default = "false" help = "use regular expressions for eager length conflicts" + +[[option]] + name = "stringEagerSolver" + category = "regular" + long = "strings-eager-solver" + type = "bool" + default = "true" + help = "use the eager solver" + +[[option]] + name = "stringRegexpInclusion" + category = "regular" + long = "strings-regexp-inclusion" + type = "bool" + default = "true" + help = "use regular expression inclusion" diff --git a/src/theory/strings/regexp_solver.cpp b/src/theory/strings/regexp_solver.cpp index 24ce64842..9a13aeab3 100644 --- a/src/theory/strings/regexp_solver.cpp +++ b/src/theory/strings/regexp_solver.cpp @@ -115,7 +115,7 @@ bool RegExpSolver::checkInclInter( std::vector mems2 = mr.second; Trace("regexp-process") << "Memberships(" << mr.first << ") = " << mr.second << std::endl; - if (!checkEqcInclusion(mems2)) + if (options().strings.stringRegexpInclusion && !checkEqcInclusion(mems2)) { // conflict discovered, return return true; diff --git a/src/theory/strings/theory_strings.cpp b/src/theory/strings/theory_strings.cpp index 4306718be..557dd7783 100644 --- a/src/theory/strings/theory_strings.cpp +++ b/src/theory/strings/theory_strings.cpp @@ -59,7 +59,9 @@ TheoryStrings::TheoryStrings(Env& env, OutputChannel& out, Valuation valuation) d_rewriter(env.getRewriter(), &d_statistics.d_rewrites, d_termReg.getAlphabetCardinality()), - d_eagerSolver(env, d_state, d_termReg), + d_eagerSolver(options().strings.stringEagerSolver + ? new EagerSolver(env, d_state, d_termReg) + : nullptr), d_extTheoryCb(), d_im(env, *this, d_state, d_termReg, d_extTheory, d_statistics), d_extTheory(env, d_extTheoryCb, d_im), @@ -650,7 +652,10 @@ void TheoryStrings::notifyFact(TNode atom, TNode fact, bool isInternal) { - d_eagerSolver.notifyFact(atom, polarity, fact, isInternal); + if (d_eagerSolver) + { + d_eagerSolver->notifyFact(atom, polarity, fact, isInternal); + } // process pending conflicts due to reasoning about endpoints if (!d_state.isInConflict() && d_state.hasPendingConflict()) { @@ -768,7 +773,10 @@ void TheoryStrings::eqNotifyNewClass(TNode t){ ei->d_codeTerm = t[0]; } } - d_eagerSolver.eqNotifyNewClass(t); + if (d_eagerSolver) + { + d_eagerSolver->eqNotifyNewClass(t); + } } void TheoryStrings::eqNotifyMerge(TNode t1, TNode t2) @@ -781,7 +789,10 @@ void TheoryStrings::eqNotifyMerge(TNode t1, TNode t2) // always create it if e2 was non-null EqcInfo* e1 = d_state.getOrMakeEqcInfo(t1); - d_eagerSolver.eqNotifyMerge(e1, t1, e2, t2); + if (d_eagerSolver) + { + d_eagerSolver->eqNotifyMerge(e1, t1, e2, t2); + } // add information from e2 to e1 if (!e2->d_lengthTerm.get().isNull()) diff --git a/src/theory/strings/theory_strings.h b/src/theory/strings/theory_strings.h index 21db7da0c..dd15e08ec 100644 --- a/src/theory/strings/theory_strings.h +++ b/src/theory/strings/theory_strings.h @@ -259,7 +259,7 @@ class TheoryStrings : public Theory { /** The theory rewriter for this theory. */ StringsRewriter d_rewriter; /** The eager solver */ - EagerSolver d_eagerSolver; + std::unique_ptr d_eagerSolver; /** The extended theory callback */ StringsExtfCallback d_extTheoryCb; /** The (custom) output channel of the theory of strings */ -- cgit v1.2.3