All Downloads are FREE. Search and download functionalities are using the official Maven repository.

z3-z3-4.13.0.src.math.lp.mon_eq.cpp Maven / Gradle / Ivy

The newest version!
/*
  Copyright (c) 2017 Microsoft Corporation
  Author: Nikolaj Bjorner
*/
#include "math/lp/lar_solver.h"
#include "math/lp/monic.h"
namespace nla {

template 
bool check_assignment(T const& m, variable_map_type & vars) {
    rational r1 = vars[m.var()];
    if (r1.is_zero()) {
        for (auto w : m.vars()) {
            if (vars[w].is_zero())
                return true;
        }
        return false;
    }
    rational r2(1);
    for (auto w : m.vars()) {
        r2 *= vars[w];
    }
    return r1 == r2;
}
template 
bool check_assignments(const K & monomials,
                       const lp::lar_solver& s,
                       variable_map_type & vars) {
    s.get_model(vars);
    for (auto const& m : monomials) {
        if (!check_assignment(m, vars)) return false;
    }
    return true;
}

template bool check_assignments>(const vector&,
                                            const lp::lar_solver& s,
                                            variable_map_type & vars);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy