namespace CVC4 {
namespace options {
+// helper functions
+namespace {
+
+void throwLazyBBUnsupported(theory::bv::SatSolverMode m)
+{
+ std::string sat_solver;
+ if (m == theory::bv::SAT_SOLVER_CADICAL)
+ {
+ sat_solver = "CaDiCaL";
+ }
+ else
+ {
+ Assert(m == theory::bv::SAT_SOLVER_CRYPTOMINISAT);
+ sat_solver = "CryptoMiniSat";
+ }
+ std::string indent(25, ' ');
+ throw OptionException(sat_solver + " does not support lazy bit-blasting.\n"
+ + indent + "Try --bv-sat-solver=minisat");
+}
+
+} // namespace
+
OptionsHandler::OptionsHandler(Options* options) : d_options(options) { }
void OptionsHandler::notifyForceLogic(const std::string& option){
d_options->d_rlimitPerListeners.notify();
}
-unsigned long OptionsHandler::tlimitHandler(std::string option,
- std::string optarg)
-{
- unsigned long ms;
- std::istringstream convert(optarg);
- if (!(convert >> ms)) {
- throw OptionException("option `"+option+"` requires a number as an argument");
- }
- return ms;
-}
-
-unsigned long OptionsHandler::tlimitPerHandler(std::string option,
- std::string optarg)
-{
- unsigned long ms;
-
- std::istringstream convert(optarg);
- if (!(convert >> ms)) {
- throw OptionException("option `"+option+"` requires a number as an argument");
- }
- return ms;
-}
-
-unsigned long OptionsHandler::rlimitHandler(std::string option,
- std::string optarg)
-{
- unsigned long ms;
-
- std::istringstream convert(optarg);
- if (!(convert >> ms)) {
- throw OptionException("option `"+option+"` requires a number as an argument");
- }
- return ms;
-}
-
-unsigned long OptionsHandler::rlimitPerHandler(std::string option,
- std::string optarg)
+unsigned long OptionsHandler::limitHandler(std::string option,
+ std::string optarg)
{
unsigned long ms;
-
std::istringstream convert(optarg);
- if (!(convert >> ms)) {
- throw OptionException("option `"+option+"` requires a number as an argument");
+ if (!(convert >> ms))
+ {
+ throw OptionException("option `" + option
+ + "` requires a number as an argument");
}
-
return ms;
}
-
/* options/base_options_handlers.h */
void OptionsHandler::notifyPrintSuccess(std::string option) {
d_options->d_setPrintSuccessListeners.notify();
if(optarg == "minisat") {
return theory::bv::SAT_SOLVER_MINISAT;
} else if(optarg == "cryptominisat") {
-
if (options::bitblastMode() == theory::bv::BITBLAST_MODE_LAZY &&
options::bitblastMode.wasSetByUser()) {
- throw OptionException(
- std::string("CryptoMiniSat does not support lazy bit-blasting. \n\
- Try --bv-sat-solver=minisat"));
+ throwLazyBBUnsupported(theory::bv::SAT_SOLVER_CRYPTOMINISAT);
}
if (!options::bitvectorToBool.wasSetByUser()) {
options::bitvectorToBool.set(true);
if (options::bitblastMode() == theory::bv::BITBLAST_MODE_LAZY
&& options::bitblastMode.wasSetByUser())
{
- throw OptionException(
- std::string("CaDiCaL does not support lazy bit-blasting. \n\
- Try --bv-sat-solver=minisat"));
+ throwLazyBBUnsupported(theory::bv::SAT_SOLVER_CADICAL);
}
if (!options::bitvectorToBool.wasSetByUser())
{
if (!options::bitvectorAlgebraicSolver.wasSetByUser()) {
options::bitvectorAlgebraicSolver.set(true);
}
+ if (options::bvSatSolver() != theory::bv::SAT_SOLVER_MINISAT)
+ {
+ throwLazyBBUnsupported(options::bvSatSolver());
+ }
return theory::bv::BITBLAST_MODE_LAZY;
} else if(optarg == "eager") {
if (!options::bitvectorToBool.wasSetByUser()) {
category = "common"
long = "tlimit=MS"
type = "unsigned long"
- handler = "tlimitHandler"
+ handler = "limitHandler"
notifies = ["notifyTlimit"]
read_only = true
help = "enable time limiting (give milliseconds)"
category = "common"
long = "tlimit-per=MS"
type = "unsigned long"
- handler = "tlimitPerHandler"
+ handler = "limitHandler"
notifies = ["notifyTlimitPer"]
read_only = true
help = "enable time limiting per query (give milliseconds)"
category = "common"
long = "rlimit=N"
type = "unsigned long"
- handler = "rlimitHandler"
+ handler = "limitHandler"
notifies = ["notifyRlimit"]
read_only = true
help = "enable resource limiting (currently, roughly the number of SAT conflicts)"
category = "common"
long = "rlimit-per=N"
type = "unsigned long"
- handler = "rlimitPerHandler"
+ handler = "limitHandler"
notifies = ["notifyRlimitPer"]
read_only = true
help = "enable resource limiting per query"