3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-01-25 19:44:01 +00:00

merge smon with monomial

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-04-22 16:33:58 -07:00
parent e73296fbe5
commit 53cc8048f7
20 changed files with 312 additions and 633 deletions

View file

@ -5,24 +5,25 @@
#include "util/lp/lar_solver.h"
#include "util/lp/monomial.h"
namespace nla {
typedef monomial mon_eq;
bool check_assignment(mon_eq const& m, variable_map_type & vars) {
template <typename T>
bool check_assignment(T const& m, variable_map_type & vars) {
rational r1 = vars[m.var()];
if (r1.is_zero()) {
for (auto w : m) {
for (auto w : m.vars()) {
if (vars[w].is_zero())
return true;
}
return false;
}
rational r2(1);
for (auto w : m) {
for (auto w : m.vars()) {
r2 *= vars[w];
}
return r1 == r2;
}
bool check_assignments(const vector<mon_eq> & monomials,
template <typename K>
bool check_assignments(const K & monomials,
const lp::lar_solver& s,
variable_map_type & vars) {
s.get_model(vars);
@ -32,4 +33,8 @@ bool check_assignments(const vector<mon_eq> & monomials,
return true;
}
template bool check_assignments<vector<mon_eq>>(const vector<mon_eq>&,
const lp::lar_solver& s,
variable_map_type & vars);
}