mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
Add nlsat.factor option. This is a workaround for the slow factorization procedure.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
8a69e8a283
commit
70baa3c8c9
4 changed files with 25 additions and 15 deletions
|
@ -42,7 +42,8 @@ namespace nlsat {
|
|||
bool m_simplify_cores;
|
||||
bool m_full_dimensional;
|
||||
bool m_minimize_cores;
|
||||
|
||||
bool m_factor;
|
||||
|
||||
struct todo_set {
|
||||
polynomial::cache & m_cache;
|
||||
polynomial_ref_vector m_set;
|
||||
|
@ -568,21 +569,22 @@ namespace nlsat {
|
|||
elim_vanishing(p);
|
||||
if (is_const(p))
|
||||
return;
|
||||
#if 1
|
||||
TRACE("nlsat_explain", tout << "adding factors of\n"; display(tout, p); tout << "\n";);
|
||||
factor(p, m_factors);
|
||||
polynomial_ref f(m_pm);
|
||||
for (unsigned i = 0; i < m_factors.size(); i++) {
|
||||
f = m_factors.get(i);
|
||||
elim_vanishing(f);
|
||||
if (!is_const(f)) {
|
||||
TRACE("nlsat_explain", tout << "adding factor:\n"; display(tout, f); tout << "\n";);
|
||||
m_todo.insert(f);
|
||||
if (m_factor) {
|
||||
TRACE("nlsat_explain", tout << "adding factors of\n"; display(tout, p); tout << "\n";);
|
||||
factor(p, m_factors);
|
||||
polynomial_ref f(m_pm);
|
||||
for (unsigned i = 0; i < m_factors.size(); i++) {
|
||||
f = m_factors.get(i);
|
||||
elim_vanishing(f);
|
||||
if (!is_const(f)) {
|
||||
TRACE("nlsat_explain", tout << "adding factor:\n"; display(tout, f); tout << "\n";);
|
||||
m_todo.insert(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
m_todo.insert(normalize(p));
|
||||
#endif
|
||||
else {
|
||||
m_todo.insert(p);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1344,6 +1346,10 @@ namespace nlsat {
|
|||
m_imp->m_minimize_cores = f;
|
||||
}
|
||||
|
||||
void explain::set_factor(bool f) {
|
||||
m_imp->m_factor = f;
|
||||
}
|
||||
|
||||
void explain::operator()(unsigned n, literal const * ls, scoped_literal_vector & result) {
|
||||
(*m_imp)(n, ls, result);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace nlsat {
|
|||
void set_simplify_cores(bool f);
|
||||
void set_full_dimensional(bool f);
|
||||
void set_minimize_cores(bool f);
|
||||
void set_factor(bool f);
|
||||
|
||||
/**
|
||||
\brief Given a set of literals ls[0], ... ls[n-1] s.t.
|
||||
|
|
|
@ -10,5 +10,7 @@ def_module_params('nlsat',
|
|||
('randomize', BOOL, True, "randomize selection of a witness in nlsat."),
|
||||
('max_conflicts', UINT, UINT_MAX, "maximum number of conflicts."),
|
||||
('shuffle_vars', BOOL, False, "use a random variable order."),
|
||||
('seed', UINT, 0, "random seed.")))
|
||||
('seed', UINT, 0, "random seed."),
|
||||
('factor', BOOL, True, "factor polynomials produced during conflict resolution.")
|
||||
))
|
||||
|
||||
|
|
|
@ -212,6 +212,7 @@ namespace nlsat {
|
|||
m_ism.set_seed(m_random_seed);
|
||||
m_explain.set_simplify_cores(m_simplify_cores);
|
||||
m_explain.set_minimize_cores(min_cores);
|
||||
m_explain.set_factor(p.factor());
|
||||
m_am.updt_params(p.p);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue