mirror of
https://github.com/Z3Prover/z3
synced 2025-06-06 22:23:22 +00:00
get comments out of the way
This commit is contained in:
parent
be0e6c3267
commit
4efb06c60b
2 changed files with 122 additions and 101 deletions
|
@ -1089,7 +1089,7 @@ namespace polysat {
|
||||||
|
|
||||||
find_t viable::find_viable(pvar v, rational& lo) {
|
find_t viable::find_viable(pvar v, rational& lo) {
|
||||||
rational hi;
|
rational hi;
|
||||||
switch (find_viable2(v, lo, hi)) {
|
switch (find_viable2_new(v, lo, hi)) {
|
||||||
case l_true:
|
case l_true:
|
||||||
if (hi < 0) {
|
if (hi < 0) {
|
||||||
// fallback solver, treat propagations as decisions for now
|
// fallback solver, treat propagations as decisions for now
|
||||||
|
@ -1276,16 +1276,6 @@ namespace polysat {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lbool viable::find_viable2(pvar v, rational& lo, rational& hi) {
|
|
||||||
|
|
||||||
fixed_bits_info fbi;
|
|
||||||
|
|
||||||
if (!collect_bit_information(v, true, fbi))
|
|
||||||
return l_false; // conflict already added
|
|
||||||
|
|
||||||
pvar_vector overlaps;
|
|
||||||
s.m_slicing.collect_simple_overlaps(v, overlaps);
|
|
||||||
std::sort(overlaps.begin(), overlaps.end(), [&](pvar x, pvar y) { return s.size(x) > s.size(y); });
|
|
||||||
|
|
||||||
// TODO: (combining intervals across equivalence classes from slicing)
|
// TODO: (combining intervals across equivalence classes from slicing)
|
||||||
//
|
//
|
||||||
|
@ -1320,7 +1310,7 @@ namespace polysat {
|
||||||
//
|
//
|
||||||
// one could also try starting at the smallest bit-width to detect conflicts faster.
|
// one could also try starting at the smallest bit-width to detect conflicts faster.
|
||||||
// question: how to do recursion "upwards" without exponentially many holes to fill?
|
// question: how to do recursion "upwards" without exponentially many holes to fill?
|
||||||
|
//
|
||||||
// Mapping intervals (by example):
|
// Mapping intervals (by example):
|
||||||
//
|
//
|
||||||
// A) Removing/appending LSB:
|
// A) Removing/appending LSB:
|
||||||
|
@ -1351,20 +1341,19 @@ namespace polysat {
|
||||||
//
|
//
|
||||||
// x[6:0] \not\in [15;30[
|
// x[6:0] \not\in [15;30[
|
||||||
// ==> x[5:0] \not\in \emptyset
|
// ==> x[5:0] \not\in \emptyset
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
// start covering on the highest level.
|
// start covering on the highest level.
|
||||||
// - at first, use a low refinement budget: we do not want to get stuck in a refinement loop if lower-bits intervals may already cover everything.
|
// - at first, use a low refinement budget: we do not want to get stuck in a refinement loop if lower-bits intervals may already cover everything.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// - if we can cover everything except a hole of size < 2^{bits of next layer}
|
// - if we can cover everything except a hole of size < 2^{bits of next layer}
|
||||||
// - recursively try to cover that hole on lower level
|
// - recursively try to cover that hole on lower level
|
||||||
// - otherwise
|
// - otherwise
|
||||||
// - recursively try to cover the whole domain on lower level
|
// - recursively try to cover the whole domain on lower level
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// - if the lower level succeeds, we are done.
|
// - if the lower level succeeds, we are done.
|
||||||
// - if the lower level does not succeed, we can try refinement with a higher budget.
|
// - if the lower level does not succeed, we can try refinement with a higher budget.
|
||||||
//
|
//
|
||||||
|
@ -1376,12 +1365,39 @@ namespace polysat {
|
||||||
// i.e., we have a fixed-bit interval that covers half of the area. then extend that interval based on lower bits.
|
// i.e., we have a fixed-bit interval that covers half of the area. then extend that interval based on lower bits.
|
||||||
// whether this is useful I'm not sure but it could skip some "virtual layers" where we only have a bit but no intervals.
|
// whether this is useful I'm not sure but it could skip some "virtual layers" where we only have a bit but no intervals.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// - how to integrate fallback solver?
|
// - how to integrate fallback solver?
|
||||||
// when lowest level fails, we can try more refinement there.
|
// when lowest level fails, we can try more refinement there.
|
||||||
// in case of refinement loop, try fallback solver with constraints only from lower level.
|
// in case of refinement loop, try fallback solver with constraints only from lower level.
|
||||||
|
lbool viable::find_viable2_new(pvar v, rational& lo, rational& hi) {
|
||||||
|
fixed_bits_info fbi;
|
||||||
|
|
||||||
|
if (!collect_bit_information(v, true, fbi))
|
||||||
|
return l_false; // conflict already added
|
||||||
|
|
||||||
|
pvar_vector overlaps;
|
||||||
|
s.m_slicing.collect_simple_overlaps(v, overlaps);
|
||||||
|
std::sort(overlaps.begin(), overlaps.end(), [&](pvar x, pvar y) { return s.size(x) > s.size(y); });
|
||||||
|
|
||||||
|
LOG("Overlaps with v" << v << ":");
|
||||||
|
for (pvar x : overlaps) {
|
||||||
|
unsigned hi, lo;
|
||||||
|
if (s.m_slicing.is_extract(x, v, hi, lo))
|
||||||
|
LOG(" v" << x << " = v" << v << "[" << hi << ":" << lo << "]");
|
||||||
|
else
|
||||||
|
LOG(" v" << x << " not extracted from v" << v << "; size " << s.size(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
NOT_IMPLEMENTED_YET();
|
||||||
|
return l_undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lbool viable::find_viable2(pvar v, rational& lo, rational& hi) {
|
||||||
|
|
||||||
|
fixed_bits_info fbi;
|
||||||
|
|
||||||
|
if (!collect_bit_information(v, true, fbi))
|
||||||
|
return l_false; // conflict already added
|
||||||
|
|
||||||
// max number of interval refinements before falling back to the univariate solver
|
// max number of interval refinements before falling back to the univariate solver
|
||||||
unsigned const refinement_budget = 1000;
|
unsigned const refinement_budget = 1000;
|
||||||
|
|
|
@ -67,6 +67,7 @@ namespace polysat {
|
||||||
|
|
||||||
struct layer final {
|
struct layer final {
|
||||||
entry* entries = nullptr;
|
entry* entries = nullptr;
|
||||||
|
// TODO: cache longest?
|
||||||
unsigned bit_width = 0;
|
unsigned bit_width = 0;
|
||||||
layer(unsigned bw): bit_width(bw) {}
|
layer(unsigned bw): bit_width(bw) {}
|
||||||
};
|
};
|
||||||
|
@ -197,6 +198,10 @@ namespace polysat {
|
||||||
*/
|
*/
|
||||||
lbool find_viable_fallback(pvar v, rational& out_lo, rational& out_hi);
|
lbool find_viable_fallback(pvar v, rational& out_lo, rational& out_hi);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
lbool find_viable2_new(pvar v, rational& out_lo, rational& out_hi);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
viable(solver& s);
|
viable(solver& s);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue