3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-26 21:16:02 +00:00

#7468 - add option (get-info :parameters) to display solver parameters that were updated globally and distinct from defaults

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2025-02-10 11:57:14 -08:00
parent 62126fd6e2
commit c2b7b58c78
8 changed files with 62 additions and 6 deletions

View file

@ -412,7 +412,7 @@ public:
}
}
std::string get_value(params_ref const & ps, std::string const & p) {
std::string get_value(params_ref const& ps, std::string const& p) {
symbol sp(p.c_str());
std::ostringstream buffer;
ps.display(buffer, sp);
@ -430,6 +430,19 @@ public:
return r;
}
void display_updated_parameters(std::ostream& out, params_ref const& p) {
param_descrs* d = nullptr;
for (auto const& [k, v] : m_module_params) {
if (!get_module_param_descr(k, d))
continue;
params_ref* ps = nullptr;
if (!m_module_params.find(k, ps))
continue;
ps->display_smt2(out, k, *d);
p.display_smt2(out, k, *d);
}
}
std::string get_value(char const * name) {
std::string m, p;
normalize(name, m, p);
@ -691,3 +704,7 @@ std::string& gparams::g_buffer() {
SASSERT(g_imp);
return g_imp->m_buffer;
}
void gparams::display_updated_parameters(std::ostream& out, params_ref const& p) {
g_imp->display_updated_parameters(out, p);
}

View file

@ -118,9 +118,11 @@ public:
// Auxiliary APIs for better command line support
static void display_modules(std::ostream & out);
static void display_updated_parameters(std::ostream& out, params_ref const& p);
static void display_module(std::ostream & out, char const * module_name);
static void display_module_markdown(std::ostream & out, char const * module_name);
static void display_parameter(std::ostream & out, char const * name);
static param_descrs const& get_global_param_descrs();
/**

View file

@ -476,7 +476,8 @@ public:
void display_smt2(std::ostream & out, char const* module, param_descrs& descrs) const {
for (params::entry const& e : m_entries) {
if (!descrs.contains(e.first)) continue;
if (!descrs.contains(e.first))
continue;
out << "(set-option :";
out << module << ".";
out << e.first;
@ -504,6 +505,7 @@ public:
break;
}
out << ")\n";
out << "; " << descrs.get_descr(e.first) << "\n";
}
}