Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support all currently existing bitwuzla options #355

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions bitwuzla/src/bitwuzla_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,37 @@ const std::unordered_set<std::uint64_t> bvbases({ 2, 10, 16 });

void BzlaSolver::set_opt(const std::string option, const std::string value)
{
// TODO support more options
if (option == "incremental")
{
// Do nothing, Bitwuzla is always incremental.
}
else if (option == "produce-models")
{
options.set(bitwuzla::Option::PRODUCE_MODELS, (value == "true"));
}
else if (option == "produce-unsat-assumptions")
{
options.set(bitwuzla::Option::PRODUCE_UNSAT_ASSUMPTIONS, (value == "true"));
if (value != "true")
{
throw NotImplementedException("Bitwuzla only supports incremental mode");
}
}
else if (option == "produce-unsat-cores")
else if (option == "time-limit")
{
options.set(bitwuzla::Option::PRODUCE_UNSAT_CORES, (value == "true"));
// Bitwuzla expects this in milliseconds, but smt-switch uses seconds.
options.set(bitwuzla::Option::TIME_LIMIT_PER, std::stod(value) * 1000);
}
else if (option == "time-limit")
else if (!options.is_valid(option))
{
options.set(bitwuzla::Option::TIME_LIMIT_PER, std::stoi(value) * 1000);
throw SmtException("Bitwuzla backend does not support option: " + option);
}
else
{
throw SmtException("Bitwuzla backend does not support option: " + option);
try
{
options.set(option, value);
}
catch (const bitwuzla::Exception & exception)
{
std::string detail = exception.what();
// Remove "invalid call to 'bitwuzla::Options::set(...)'" from exception message.
detail.erase(0, detail.find(")"));
detail.erase(0, detail.find(","));
throw IncorrectUsageException("Bitwuzla backend got bad option " + option
+ detail);
}
}
}

Expand Down
Loading