From: Andrew Reynolds Date: Tue, 10 Mar 2020 17:40:54 +0000 (-0500) Subject: Consolidate options that disable produceModels (#3973) X-Git-Tag: cvc5-1.0.0~3529 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c8e4f878b88df43e3b231f571b32cef5cf8d5004;p=cvc5.git Consolidate options that disable produceModels (#3973) Also adds --sort-inference to this list, fixes #3936. --- diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index 7b0571274..ec16409a7 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -1692,30 +1692,6 @@ void SmtEngine::setDefaults() { Trace("smt") << "setting repeat simplification to " << repeatSimp << endl; options::repeatSimp.set(repeatSimp); } - // Unconstrained simp currently does *not* support model generation - if (options::unconstrainedSimp.wasSetByUser() && options::unconstrainedSimp()) { - if (options::produceModels()) { - if (options::produceModels.wasSetByUser()) { - throw OptionException("Cannot use unconstrained-simp with model generation."); - } - Notice() << "SmtEngine: turning off produce-models to support unconstrainedSimp" << endl; - setOption("produce-models", SExpr("false")); - } - if (options::produceAssignments()) { - if (options::produceAssignments.wasSetByUser()) { - throw OptionException("Cannot use unconstrained-simp with model generation (produce-assignments)."); - } - Notice() << "SmtEngine: turning off produce-assignments to support unconstrainedSimp" << endl; - setOption("produce-assignments", SExpr("false")); - } - if (options::checkModels()) { - if (options::checkModels.wasSetByUser()) { - throw OptionException("Cannot use unconstrained-simp with model generation (check-models)."); - } - Notice() << "SmtEngine: turning off check-models to support unconstrainedSimp" << endl; - setOption("check-models", SExpr("false")); - } - } if (options::boolToBitvector() == options::BoolToBVMode::ALL && !d_logic.isTheoryEnabled(THEORY_BV)) @@ -2239,20 +2215,6 @@ void SmtEngine::setDefaults() { options::minisatUseElim.set( false ); } } - else if (options::minisatUseElim()) { - if (options::produceModels()) { - Notice() << "SmtEngine: turning off produce-models to support minisatUseElim" << endl; - setOption("produce-models", SExpr("false")); - } - if (options::produceAssignments()) { - Notice() << "SmtEngine: turning off produce-assignments to support minisatUseElim" << endl; - setOption("produce-assignments", SExpr("false")); - } - if (options::checkModels()) { - Notice() << "SmtEngine: turning off check-models to support minisatUseElim" << endl; - setOption("check-models", SExpr("false")); - } - } // For now, these array theory optimizations do not support model-building if (options::produceModels() || options::produceAssignments() || options::checkModels()) { @@ -2260,45 +2222,6 @@ void SmtEngine::setDefaults() { options::arraysLazyRIntro1.set(false); } - // Non-linear arithmetic does not support models unless nlExt is enabled - if ((d_logic.isTheoryEnabled(THEORY_ARITH) && !d_logic.isLinear() - && !options::nlExt()) - || options::globalNegate()) - { - std::string reason = - options::globalNegate() ? "--global-negate" : "nonlinear arithmetic"; - if (options::produceModels()) { - if(options::produceModels.wasSetByUser()) { - throw OptionException( - std::string("produce-model not supported with " + reason)); - } - Warning() - << "SmtEngine: turning off produce-models because unsupported for " - << reason << endl; - setOption("produce-models", SExpr("false")); - } - if (options::produceAssignments()) { - if(options::produceAssignments.wasSetByUser()) { - throw OptionException( - std::string("produce-assignments not supported with " + reason)); - } - Warning() << "SmtEngine: turning off produce-assignments because " - "unsupported for " - << reason << endl; - setOption("produce-assignments", SExpr("false")); - } - if (options::checkModels()) { - if(options::checkModels.wasSetByUser()) { - throw OptionException( - std::string("check-models not supported with " + reason)); - } - Warning() - << "SmtEngine: turning off check-models because unsupported for " - << reason << endl; - setOption("check-models", SExpr("false")); - } - } - if (options::proof()) { if (options::incrementalSolving()) @@ -2393,6 +2316,77 @@ void SmtEngine::setDefaults() { << endl; options::stringProcessLoopMode.set(options::ProcessLoopMode::SIMPLE); } + + // !!! All options that require disabling models go here + bool disableModels = false; + std::string sOptNoModel; + if (options::unconstrainedSimp.wasSetByUser() && options::unconstrainedSimp()) + { + disableModels = true; + sOptNoModel = "unconstrained-simp"; + } + else if (options::sortInference()) + { + disableModels = true; + sOptNoModel = "sort-inference"; + } + else if (options::minisatUseElim()) + { + disableModels = true; + sOptNoModel = "minisat-elimination"; + } + else if (d_logic.isTheoryEnabled(THEORY_ARITH) && !d_logic.isLinear() + && !options::nlExt()) + { + disableModels = true; + sOptNoModel = "nonlinear arithmetic without nl-ext"; + } + else if (options::globalNegate()) + { + disableModels = true; + sOptNoModel = "global-negate"; + } + if (disableModels) + { + if (options::produceModels()) + { + if (options::produceModels.wasSetByUser()) + { + std::stringstream ss; + ss << "Cannot use " << sOptNoModel << " with model generation."; + throw OptionException(ss.str()); + } + Notice() << "SmtEngine: turning off produce-models to support " + << sOptNoModel << endl; + setOption("produce-models", SExpr("false")); + } + if (options::produceAssignments()) + { + if (options::produceAssignments.wasSetByUser()) + { + std::stringstream ss; + ss << "Cannot use " << sOptNoModel + << " with model generation (produce-assignments)."; + throw OptionException(ss.str()); + } + Notice() << "SmtEngine: turning off produce-assignments to support " + << sOptNoModel << endl; + setOption("produce-assignments", SExpr("false")); + } + if (options::checkModels()) + { + if (options::checkModels.wasSetByUser()) + { + std::stringstream ss; + ss << "Cannot use " << sOptNoModel + << " with model generation (check-models)."; + throw OptionException(ss.str()); + } + Notice() << "SmtEngine: turning off check-models to support " + << sOptNoModel << endl; + setOption("check-models", SExpr("false")); + } + } } void SmtEngine::setProblemExtended()