mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 13:28:47 +00:00
hook up nla_intervals
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
453a5d2de1
commit
a4ad71bf33
|
@ -1331,21 +1331,6 @@ lbool core::test_check(
|
||||||
return check(l);
|
return check(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
lp::impq core::get_upper_bound_of_monomial(lpvar j) const {
|
|
||||||
SASSERT(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
lp::impq core::get_lower_bound_of_monomial(lpvar j) const {
|
|
||||||
SASSERT(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core::monomial_has_lower_bound(lpvar j) const {
|
|
||||||
SASSERT(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool core::monomial_has_upper_bound(lpvar j) const {
|
|
||||||
SASSERT(false);
|
|
||||||
}
|
|
||||||
} // end of nla
|
} // end of nla
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -338,10 +338,6 @@ public:
|
||||||
|
|
||||||
lbool test_check(vector<lemma>& l);
|
lbool test_check(vector<lemma>& l);
|
||||||
lpvar map_to_root(lpvar) const;
|
lpvar map_to_root(lpvar) const;
|
||||||
lp::impq get_upper_bound_of_monomial(lpvar j) const;
|
|
||||||
lp::impq get_lower_bound_of_monomial(lpvar j) const;
|
|
||||||
bool monomial_has_lower_bound(lpvar j) const;
|
|
||||||
bool monomial_has_upper_bound(lpvar j) const;
|
|
||||||
}; // end of core
|
}; // end of core
|
||||||
|
|
||||||
struct pp_mon {
|
struct pp_mon {
|
||||||
|
|
|
@ -6,17 +6,17 @@
|
||||||
namespace nla {
|
namespace nla {
|
||||||
|
|
||||||
bool intervals::check() {
|
bool intervals::check() {
|
||||||
m_region.reset();
|
// m_region.reset();
|
||||||
for (auto const& m : c().emons()) {
|
// for (auto const& m : m_core->emons()) {
|
||||||
if (!check(m)) {
|
// if (!check(m)) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
for (auto const& t : m_solver.terms()) {
|
// for (auto const& t : m_solver.terms()) {
|
||||||
if (!check(*t)) {
|
// if (!check(*t)) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,4 +104,27 @@ namespace nla {
|
||||||
// convert term into factors for improved precision
|
// convert term into factors for improved precision
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lp::impq intervals::get_upper_bound_of_monomial(lpvar j) const {
|
||||||
|
SASSERT(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
lp::impq intervals::get_lower_bound_of_monomial(lpvar j) const {
|
||||||
|
SASSERT(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool intervals::product_has_upper_bound(int sign, const svector<lpvar>&) const {
|
||||||
|
interval a;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool intervals::monomial_has_lower_bound(lpvar j) const {
|
||||||
|
const monomial& m = m_core->emons()[j];
|
||||||
|
return product_has_upper_bound(1, m.vars());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool intervals::monomial_has_upper_bound(lpvar j) const {
|
||||||
|
const monomial& m = m_core->emons()[j];
|
||||||
|
return product_has_upper_bound(-1, m.vars());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
namespace nla {
|
namespace nla {
|
||||||
class core;
|
class core;
|
||||||
|
|
||||||
class intervals : common {
|
class intervals {
|
||||||
|
core * m_core;
|
||||||
class ci_value_manager {
|
class ci_value_manager {
|
||||||
public:
|
public:
|
||||||
void inc_ref(lp::constraint_index const & v) {
|
void inc_ref(lp::constraint_index const & v) {
|
||||||
|
@ -138,7 +138,7 @@ namespace nla {
|
||||||
im_config m_config;
|
im_config m_config;
|
||||||
interval_manager<im_config> m_imanager;
|
interval_manager<im_config> m_imanager;
|
||||||
region m_region;
|
region m_region;
|
||||||
lp::lar_solver& m_solver;
|
// lp::lar_solver& m_solver;
|
||||||
|
|
||||||
typedef interval_manager<im_config>::interval interval;
|
typedef interval_manager<im_config>::interval interval;
|
||||||
|
|
||||||
|
@ -151,8 +151,12 @@ namespace nla {
|
||||||
bool check(lp::lar_term const& t);
|
bool check(lp::lar_term const& t);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
intervals(core* c);
|
intervals(core* c) : m_core(c) {}
|
||||||
bool check();
|
bool check();
|
||||||
|
bool monomial_has_lower_bound(lpvar j) const;
|
||||||
|
bool monomial_has_upper_bound(lpvar j) const;
|
||||||
|
bool product_has_upper_bound(int sign, const svector<lpvar>&) const;
|
||||||
|
lp::impq get_upper_bound_of_monomial(lpvar j) const;
|
||||||
|
lp::impq get_lower_bound_of_monomial(lpvar j) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace nla
|
} // end of namespace nla
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "math/lp/var_eqs.h"
|
#include "math/lp/var_eqs.h"
|
||||||
#include "math/lp/factorization.h"
|
#include "math/lp/factorization.h"
|
||||||
#include "math/lp/nla_solver.h"
|
#include "math/lp/nla_solver.h"
|
||||||
|
#include "math/lp/nla_intervals.h"
|
||||||
namespace nla {
|
namespace nla {
|
||||||
|
|
||||||
// returns the monomial index
|
// returns the monomial index
|
||||||
|
@ -54,28 +55,27 @@ void solver::pop(unsigned n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
solver::solver(lp::lar_solver& s) {
|
solver::solver(lp::lar_solver& s): m_core(alloc(core, s)), m_intervals(m_core) {
|
||||||
m_core = alloc(core, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
solver::~solver() {
|
solver::~solver() {
|
||||||
dealloc(m_core);
|
dealloc(m_core);
|
||||||
}
|
}
|
||||||
lp::impq solver::get_upper_bound(lpvar j) const {
|
lp::impq solver::get_upper_bound(lpvar j) const {
|
||||||
SASSERT(is_monomial_var(j) && m_core->monomial_has_upper_bound(j));
|
SASSERT(is_monomial_var(j) && m_intervals.monomial_has_upper_bound(j));
|
||||||
return m_core->get_upper_bound_of_monomial(j);
|
return m_intervals.get_upper_bound_of_monomial(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
lp::impq solver::get_lower_bound(lpvar j) const {
|
lp::impq solver::get_lower_bound(lpvar j) const {
|
||||||
SASSERT(is_monomial_var(j) && m_core->monomial_has_lower_bound(j));
|
SASSERT(is_monomial_var(j) && m_intervals.monomial_has_lower_bound(j));
|
||||||
return m_core->get_lower_bound_of_monomial(j);
|
return m_intervals.get_lower_bound_of_monomial(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool solver::monomial_has_lower_bound(lpvar j) const {
|
bool solver::monomial_has_lower_bound(lpvar j) const {
|
||||||
return m_core->monomial_has_lower_bound(j);
|
return m_intervals.monomial_has_lower_bound(j);
|
||||||
}
|
}
|
||||||
bool solver::monomial_has_upper_bound(lpvar j) const {
|
bool solver::monomial_has_upper_bound(lpvar j) const {
|
||||||
return m_core->monomial_has_upper_bound(j);
|
return m_intervals.monomial_has_upper_bound(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,14 @@ Revision History:
|
||||||
#include "math/lp/lar_solver.h"
|
#include "math/lp/lar_solver.h"
|
||||||
#include "math/lp/monomial.h"
|
#include "math/lp/monomial.h"
|
||||||
#include "math/lp/nla_core.h"
|
#include "math/lp/nla_core.h"
|
||||||
|
#include "math/lp/nla_intervals.h"
|
||||||
|
|
||||||
namespace nla {
|
namespace nla {
|
||||||
|
|
||||||
// nonlinear integer incremental linear solver
|
// nonlinear integer incremental linear solver
|
||||||
class solver {
|
class solver {
|
||||||
core* m_core;
|
core* m_core;
|
||||||
|
intervals m_intervals;
|
||||||
public:
|
public:
|
||||||
void add_monomial(lpvar v, unsigned sz, lpvar const* vs);
|
void add_monomial(lpvar v, unsigned sz, lpvar const* vs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue