diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2020-02-17 13:29:09 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 13:29:09 -0600 |
commit | 6a761852b93510bf707e7002ad663ca0f36ad720 (patch) | |
tree | a91cbd198e21e78b40ce7d6a943db962ee0c30c1 /src/theory | |
parent | b19c08997e15d2e42f61f1936fd60c5e34081d68 (diff) |
Option to limit the number of rounds of enumerative instantiation (#3760)
Diffstat (limited to 'src/theory')
-rw-r--r-- | src/theory/quantifiers/inst_strategy_enumerative.cpp | 34 | ||||
-rw-r--r-- | src/theory/quantifiers/inst_strategy_enumerative.h | 8 |
2 files changed, 32 insertions, 10 deletions
diff --git a/src/theory/quantifiers/inst_strategy_enumerative.cpp b/src/theory/quantifiers/inst_strategy_enumerative.cpp index 83856dfc4..1e2e34aa2 100644 --- a/src/theory/quantifiers/inst_strategy_enumerative.cpp +++ b/src/theory/quantifiers/inst_strategy_enumerative.cpp @@ -33,12 +33,19 @@ using namespace inst; namespace quantifiers { InstStrategyEnum::InstStrategyEnum(QuantifiersEngine* qe, RelevantDomain* rd) - : QuantifiersModule(qe), d_rd(rd) + : QuantifiersModule(qe), d_rd(rd), d_fullSaturateLimit(-1) { } - +void InstStrategyEnum::presolve() +{ + d_fullSaturateLimit = options::fullSaturateLimit(); +} bool InstStrategyEnum::needsCheck(Theory::Effort e) { + if (d_fullSaturateLimit == 0) + { + return false; + } if (options::fullSaturateInterleave()) { if (d_quantEngine->getInstWhenNeedsCheck(e)) @@ -61,15 +68,18 @@ void InstStrategyEnum::check(Theory::Effort e, QEffort quant_e) { bool doCheck = false; bool fullEffort = false; - if (options::fullSaturateInterleave()) + if (d_fullSaturateLimit != 0) { - // we only add when interleaved with other strategies - doCheck = quant_e == QEFFORT_STANDARD && d_quantEngine->hasAddedLemma(); - } - if (options::fullSaturateQuant() && !doCheck) - { - doCheck = quant_e == QEFFORT_LAST_CALL; - fullEffort = !d_quantEngine->hasAddedLemma(); + if (options::fullSaturateInterleave()) + { + // we only add when interleaved with other strategies + doCheck = quant_e == QEFFORT_STANDARD && d_quantEngine->hasAddedLemma(); + } + if (options::fullSaturateQuant() && !doCheck) + { + doCheck = quant_e == QEFFORT_LAST_CALL; + fullEffort = !d_quantEngine->hasAddedLemma(); + } } if (!doCheck) { @@ -150,6 +160,10 @@ void InstStrategyEnum::check(Theory::Effort e, QEffort quant_e) Trace("fs-engine") << "Finished full saturation engine, time = " << (clSet2 - clSet) << std::endl; } + if (d_fullSaturateLimit > 0) + { + d_fullSaturateLimit--; + } } bool InstStrategyEnum::process(Node f, bool fullEffort, bool isRd) diff --git a/src/theory/quantifiers/inst_strategy_enumerative.h b/src/theory/quantifiers/inst_strategy_enumerative.h index 48285c877..4d98f00ef 100644 --- a/src/theory/quantifiers/inst_strategy_enumerative.h +++ b/src/theory/quantifiers/inst_strategy_enumerative.h @@ -64,6 +64,8 @@ class InstStrategyEnum : public QuantifiersModule public: InstStrategyEnum(QuantifiersEngine* qe, RelevantDomain* rd); ~InstStrategyEnum() {} + /** Presolve */ + void presolve() override; /** Needs check. */ bool needsCheck(Theory::Effort e) override; /** Reset round. */ @@ -101,6 +103,12 @@ class InstStrategyEnum : public QuantifiersModule * term instantiations. */ bool process(Node q, bool fullEffort, bool isRd); + /** + * A limit on the number of rounds to apply this strategy, where a value < 0 + * means no limit. This value is set to the value of fullSaturateLimit() + * during presolve. + */ + int32_t d_fullSaturateLimit; }; /* class InstStrategyEnum */ } /* CVC4::theory::quantifiers namespace */ |