mirror of
https://github.com/Z3Prover/z3
synced 2025-04-22 00:26:38 +00:00
get_watch_level: prefer true literals at lower search index
This commit is contained in:
parent
2a11be5c39
commit
c516d6fe0c
1 changed files with 13 additions and 9 deletions
|
@ -135,18 +135,22 @@ namespace polysat {
|
|||
}
|
||||
|
||||
/**
|
||||
* A literal may be watched if there is no unwatched literal that has been assigned later,
|
||||
* where true and unassigned literals are considered at infinite level.
|
||||
* We prefer true literals to unassigned literals.
|
||||
* Priority for watching literals:
|
||||
* 1. true literal, prefer lower search index to keep clause inactive for as long as possible.
|
||||
* 2. unassigned literal
|
||||
* 3. false literal, prefer higher search index (otherwise we might miss boolean propagations)
|
||||
*/
|
||||
uint64_t bool_var_manager::get_watch_level(sat::literal lit) const {
|
||||
switch (value(lit)) {
|
||||
case l_false:
|
||||
return s.m_search.get_bool_index(lit);
|
||||
case l_true:
|
||||
return std::numeric_limits<uint64_t>::max();
|
||||
case l_undef:
|
||||
return std::numeric_limits<uint64_t>::max() - 1;
|
||||
case l_true:
|
||||
// 0xFFFF'FFFF'****'****
|
||||
return 0xFFFF'FFFF'FFFF'FFFFull - s.m_search.get_bool_index(lit);
|
||||
case l_undef:
|
||||
// 0x0FFF'FFFF'FFFF'FFFF
|
||||
return 0x0FFF'FFFF'FFFF'FFFFull;
|
||||
case l_false:
|
||||
// 0x0000'0000'****'****
|
||||
return s.m_search.get_bool_index(lit);
|
||||
}
|
||||
UNREACHABLE();
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue