mirror of
https://github.com/Z3Prover/z3
synced 2025-05-06 23:35:46 +00:00
Polysat: constraint refactor cont'd, deduplicate constraints (#5520)
* Assign boolean variables only to long-lived constraints, and deduplicate constraints when they are created * scoped_signed_constraint * update other classes * fix * Don't use scoped_ptr<constraint> with dedup()
This commit is contained in:
parent
ebaea2159e
commit
0c1e44da77
16 changed files with 365 additions and 298 deletions
|
@ -31,7 +31,7 @@ namespace polysat {
|
|||
|
||||
clause_ref clause_builder::build() {
|
||||
// TODO: here we could set all the levels of the new constraints. so we do not have to compute the max at every use site.
|
||||
clause_ref cl = clause::from_literals(m_level, std::move(m_dep), std::move(m_literals), std::move(m_new_constraints));
|
||||
clause_ref cl = clause::from_literals(m_level, std::move(m_dep), std::move(m_literals));
|
||||
m_level = 0;
|
||||
SASSERT(empty());
|
||||
return cl;
|
||||
|
@ -52,13 +52,12 @@ namespace polysat {
|
|||
m_literals.push_back(lit);
|
||||
}
|
||||
|
||||
void clause_builder::push_new_constraint(constraint_literal_ref c) {
|
||||
// TODO: assert that constraint is new (not 'inserted' into manager yet)
|
||||
void clause_builder::push_new_constraint(scoped_signed_constraint c) {
|
||||
SASSERT(c);
|
||||
if (c.get().is_always_false())
|
||||
if (c.is_always_false())
|
||||
return;
|
||||
m_level = std::max(m_level, c->level());
|
||||
m_literals.push_back(c.literal());
|
||||
m_literals.push_back(c.blit());
|
||||
m_new_constraints.push_back(c.detach());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue