3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-23 11:37:54 +00:00

more testing of fixplex

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-05-03 16:31:00 -07:00
parent dc879dc3fb
commit 5791b41133
2 changed files with 92 additions and 16 deletions

View file

@ -5,24 +5,59 @@ namespace polysat {
typedef uint64_ext::numeral numeral;
static void test1() {
struct solver_scope {
reslimit lim;
fixplex<uint64_ext> fp(lim);
var_t x = 0, y = 1, z = 2;
};
struct scoped_fp : public solver_scope, public fixplex<uint64_ext> {
scoped_fp(): fixplex<uint64_ext>(lim) {}
void run() {
std::cout << *this << "\n";
std::cout << make_feasible() << "\n";
std::cout << *this << "\n";
statistics st;
collect_statistics(st);
std::cout << st << "\n";
}
};
static void test1() {
scoped_fp fp;
var_t x = 0, y = 1, z = 2;
var_t ys[3] = { x, y, z };
numeral coeffs[3] = { 2, 1, 4 };
fp.add_row(x, 3, ys, coeffs);
fp.set_bounds(x, 1, 2);
std::cout << fp << "\n";
fp.make_feasible();
std::cout << fp << "\n";
statistics st;
fp.collect_statistics(st);
std::cout << st << "\n";
fp.run();
}
static void test2() {
scoped_fp fp;
var_t x = 0, y = 1, z = 2;
var_t ys[3] = { x, y, z };
numeral coeffs[3] = { 1, 2, 4 };
fp.add_row(x, 3, ys, coeffs);
fp.set_bounds(x, 3, 4);
fp.run();
}
static void test3() {
scoped_fp fp;
var_t x = 0, y = 1, z = 2;
var_t ys[3] = { x, y, z };
numeral coeffs[3] = { 1, 1, 1 };
fp.add_row(x, 3, ys, coeffs);
fp.set_bounds(x, 3, 4);
fp.set_bounds(y, 3, 4);
fp.set_bounds(z, 3, 4);
fp.run();
}
}
void tst_fixplex() {
polysat::test1();
polysat::test2();
polysat::test3();
}