mirror of
https://github.com/Z3Prover/z3
synced 2025-08-25 20:46:01 +00:00
working on hilbert basis
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
aaf0c16e08
9 changed files with 480 additions and 450 deletions
File diff suppressed because it is too large
Load diff
|
@ -34,11 +34,9 @@ public:
|
|||
typedef rational numeral;
|
||||
typedef vector<numeral> num_vector;
|
||||
private:
|
||||
class rational_heap;
|
||||
class value_index;
|
||||
class index;
|
||||
class passive;
|
||||
class weight_map;
|
||||
struct offset_t {
|
||||
unsigned m_offset;
|
||||
offset_t(unsigned o) : m_offset(o) {}
|
||||
|
@ -59,25 +57,28 @@ private:
|
|||
numeral* m_values;
|
||||
public:
|
||||
values(numeral* v):m_values(v) {}
|
||||
numeral& value() { return m_values[0]; } // value of a*x
|
||||
numeral& weight() { return m_values[0]; } // value of a*x
|
||||
numeral& operator[](unsigned i) { return m_values[i+1]; } // value of x_i
|
||||
numeral const& value() const { return m_values[0]; } // value of a*x
|
||||
numeral const& weight() const { return m_values[0]; } // value of a*x
|
||||
numeral const& operator[](unsigned i) const { return m_values[i+1]; } // value of x_i
|
||||
};
|
||||
|
||||
vector<num_vector> m_ineqs;
|
||||
num_vector m_store;
|
||||
svector<offset_t> m_basis;
|
||||
svector<offset_t> m_free_list;
|
||||
svector<offset_t> m_active;
|
||||
svector<offset_t> m_zero;
|
||||
volatile bool m_cancel;
|
||||
vector<num_vector> m_ineqs; // set of asserted inequalities
|
||||
svector<bool> m_iseq; // inequalities that are equalities
|
||||
num_vector m_store; // store of vectors
|
||||
svector<offset_t> m_basis; // vector of current basis
|
||||
svector<offset_t> m_free_list; // free list of unused storage
|
||||
svector<offset_t> m_active; // active set
|
||||
svector<offset_t> m_zero; // zeros
|
||||
passive* m_passive; // passive set
|
||||
volatile bool m_cancel;
|
||||
stats m_stats;
|
||||
index* m_index;
|
||||
passive* m_passive;
|
||||
index* m_index; // index of generated vectors
|
||||
unsigned_vector m_ints; // indices that can be both positive and negative
|
||||
unsigned m_current_ineq;
|
||||
class iterator {
|
||||
hilbert_basis const& hb;
|
||||
unsigned m_idx;
|
||||
unsigned m_idx;
|
||||
public:
|
||||
iterator(hilbert_basis const& hb, unsigned idx): hb(hb), m_idx(idx) {}
|
||||
offset_t operator*() const { return hb.m_basis[m_idx]; }
|
||||
|
@ -89,10 +90,17 @@ private:
|
|||
|
||||
static offset_t mk_invalid_offset();
|
||||
static bool is_invalid_offset(offset_t offs);
|
||||
lbool saturate(num_vector const& ineq);
|
||||
lbool saturate(num_vector const& ineq, bool is_eq);
|
||||
void init_basis();
|
||||
void select_inequality();
|
||||
unsigned get_num_nonzeros(num_vector const& ineq);
|
||||
unsigned get_ineq_product(num_vector const& ineq);
|
||||
|
||||
void add_unit_vector(unsigned i, numeral const& e);
|
||||
unsigned get_num_vars() const;
|
||||
void set_eval(values& val, num_vector const& ineq) const;
|
||||
numeral get_weight(values& val, num_vector const& ineq) const;
|
||||
bool is_geq(values const& v, values const& w) const;
|
||||
bool is_abs_geq(numeral const& v, numeral const& w) const;
|
||||
bool is_subsumed(offset_t idx);
|
||||
bool is_subsumed(offset_t i, offset_t j) const;
|
||||
void recycle(offset_t idx);
|
||||
|
@ -108,7 +116,7 @@ private:
|
|||
|
||||
void display(std::ostream& out, offset_t o) const;
|
||||
void display(std::ostream& out, values const & v) const;
|
||||
void display_ineq(std::ostream& out, num_vector const& v) const;
|
||||
void display_ineq(std::ostream& out, num_vector const& v, bool is_eq) const;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -131,6 +139,8 @@ public:
|
|||
void add_le(num_vector const& v, numeral const& b);
|
||||
void add_eq(num_vector const& v, numeral const& b);
|
||||
|
||||
void set_is_int(unsigned var_index);
|
||||
|
||||
lbool saturate();
|
||||
|
||||
void set_cancel(bool f) { m_cancel = f; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue