mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 00:05:46 +00:00
add feature to display benchmark in format seen by SAT solver
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
f5db69529a
commit
cab4e4b461
9 changed files with 38 additions and 8 deletions
|
@ -1545,6 +1545,20 @@ void cmd_context::reset_assertions() {
|
|||
}
|
||||
|
||||
|
||||
void cmd_context::display_dimacs() {
|
||||
if (m_solver) {
|
||||
try {
|
||||
gparams::set("sat.dimacs.display", "true");
|
||||
m_solver->check_sat(0, nullptr);
|
||||
}
|
||||
catch (...) {
|
||||
gparams::set("sat.dimacs.display", "false");
|
||||
throw;
|
||||
}
|
||||
gparams::set("sat.dimacs.display", "false");
|
||||
}
|
||||
}
|
||||
|
||||
void cmd_context::display_model(model_ref& mdl) {
|
||||
if (mdl) {
|
||||
model_params p;
|
||||
|
|
|
@ -419,6 +419,7 @@ public:
|
|||
|
||||
void display_assertions();
|
||||
void display_statistics(bool show_total_time = false, double total_time = 0.0);
|
||||
void display_dimacs();
|
||||
void reset(bool finalize = false);
|
||||
void assert_expr(expr * t);
|
||||
void assert_expr(symbol const & name, expr * t);
|
||||
|
|
|
@ -31,7 +31,6 @@ Notes:
|
|||
#include "ast/rewriter/var_subst.h"
|
||||
#include "util/gparams.h"
|
||||
|
||||
#ifndef _EXTERNAL_RELEASE
|
||||
|
||||
BINARY_SYM_CMD(get_quantifier_body_cmd,
|
||||
"dbg-get-qbody",
|
||||
|
@ -343,10 +342,19 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
class print_dimacs_cmd : public cmd {
|
||||
public:
|
||||
print_dimacs_cmd():cmd("display-dimacs") {}
|
||||
virtual char const * get_usage() const { return ""; }
|
||||
virtual char const * get_descr(cmd_context & ctx) const { return "print benchmark in DIMACS format"; }
|
||||
virtual unsigned get_arity() const { return 0; }
|
||||
virtual void prepare(cmd_context & ctx) {}
|
||||
virtual void execute(cmd_context & ctx) { ctx.display_dimacs(); }
|
||||
};
|
||||
|
||||
|
||||
void install_dbg_cmds(cmd_context & ctx) {
|
||||
#ifndef _EXTERNAL_RELEASE
|
||||
ctx.insert(alloc(print_dimacs_cmd));
|
||||
ctx.insert(alloc(get_quantifier_body_cmd));
|
||||
ctx.insert(alloc(set_cmd));
|
||||
ctx.insert(alloc(pp_var_cmd));
|
||||
|
@ -369,5 +377,4 @@ void install_dbg_cmds(cmd_context & ctx) {
|
|||
ctx.insert(alloc(instantiate_cmd));
|
||||
ctx.insert(alloc(instantiate_nested_cmd));
|
||||
ctx.insert(alloc(set_next_id));
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue