mirror of
https://github.com/Z3Prover/z3
synced 2025-06-28 17:08:45 +00:00
adding totalizer
This commit is contained in:
parent
fd8ee34564
commit
5afcb489e0
6 changed files with 194 additions and 0 deletions
25
src/test/totalizer.cpp
Normal file
25
src/test/totalizer.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "opt/totalizer.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/reg_decl_plugins.h"
|
||||
#include <iostream>
|
||||
|
||||
void tst_totalizer() {
|
||||
std::cout << "totalizer\n";
|
||||
ast_manager m;
|
||||
reg_decl_plugins(m);
|
||||
expr_ref_vector lits(m);
|
||||
for (unsigned i = 0; i < 5; ++i)
|
||||
lits.push_back(m.mk_fresh_const("a", m.mk_bool_sort()));
|
||||
opt::totalizer tot(lits);
|
||||
|
||||
for (unsigned i = 0; i <= 6; ++i) {
|
||||
std::cout << "at least " << i << " ";
|
||||
expr* am = tot.at_least(i);
|
||||
std::cout << mk_pp(am, m) << "\n";
|
||||
}
|
||||
for (auto& clause : tot.clauses()) {
|
||||
for (auto * l : clause)
|
||||
std::cout << mk_pp(l, m) << " ";
|
||||
std::cout << "\n";
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue