mirror of
https://github.com/Z3Prover/z3
synced 2025-06-16 10:56:16 +00:00
further tuning pb
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
478b3160ac
commit
54e3b5ee0d
6 changed files with 74 additions and 35 deletions
|
@ -50,16 +50,21 @@ namespace simplex {
|
|||
typedef typename Ext::eps_manager eps_manager;
|
||||
typedef typename Ext::scoped_numeral scoped_numeral;
|
||||
typedef _scoped_numeral<eps_manager> scoped_eps_numeral;
|
||||
|
||||
typedef typename _scoped_numeral_vector<eps_manager> scoped_eps_numeral_vector;
|
||||
|
||||
typedef sparse_matrix<Ext> matrix;
|
||||
|
||||
struct var_lt {
|
||||
bool operator()(var_t v1, var_t v2) const { return v1 < v2; }
|
||||
};
|
||||
typedef heap<var_lt> var_heap;
|
||||
|
||||
struct stats {
|
||||
unsigned m_num_pivots;
|
||||
stats() { reset(); }
|
||||
void reset() {
|
||||
memset(this, sizeof(*this), 0);
|
||||
}
|
||||
};
|
||||
|
||||
enum pivot_strategy_t {
|
||||
S_BLAND,
|
||||
S_GREATEST_ERROR,
|
||||
|
@ -99,6 +104,7 @@ namespace simplex {
|
|||
uint_set m_left_basis;
|
||||
unsigned m_infeasible_var;
|
||||
unsigned_vector m_base_vars;
|
||||
stats m_stats;
|
||||
|
||||
public:
|
||||
simplex():
|
||||
|
@ -144,6 +150,8 @@ namespace simplex {
|
|||
row_iterator row_begin(row const& r) { return M.row_begin(r); }
|
||||
row_iterator row_end(row const& r) { return M.row_end(r); }
|
||||
|
||||
void collect_statistics(::statistics & st) const;
|
||||
|
||||
private:
|
||||
|
||||
var_t select_var_to_fix();
|
||||
|
|
|
@ -306,6 +306,7 @@ namespace simplex {
|
|||
|
||||
template<typename Ext>
|
||||
void simplex<Ext>::pivot(var_t x_i, var_t x_j, numeral const& a_ij) {
|
||||
++m_stats.m_num_pivots;
|
||||
var_info& x_iI = m_vars[x_i];
|
||||
var_info& x_jI = m_vars[x_j];
|
||||
unsigned r_i = x_iI.m_base2row;
|
||||
|
@ -868,6 +869,13 @@ namespace simplex {
|
|||
return true;
|
||||
}
|
||||
|
||||
template<typename Ext>
|
||||
void simplex<Ext>::collect_statistics(::statistics & st) const {
|
||||
M.collect_statistics(st);
|
||||
st.update("simplex num pivots", m_stats.m_num_pivots);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,7 @@ Notes:
|
|||
#define _SPARSE_MATRIX_H_
|
||||
|
||||
#include "mpq_inf.h"
|
||||
#include "statistics.h"
|
||||
|
||||
namespace simplex {
|
||||
|
||||
|
@ -39,6 +40,14 @@ namespace simplex {
|
|||
|
||||
private:
|
||||
|
||||
struct stats {
|
||||
unsigned m_add_rows;
|
||||
stats() { reset(); }
|
||||
void reset() {
|
||||
memset(this, sizeof(*this), 0);
|
||||
}
|
||||
};
|
||||
|
||||
static const int dead_id = -1;
|
||||
|
||||
/**
|
||||
|
@ -126,6 +135,7 @@ namespace simplex {
|
|||
vector<column> m_columns; // per var
|
||||
svector<int> m_var_pos; // temporary map from variables to positions in row
|
||||
unsigned_vector m_var_pos_idx; // indices in m_var_pos
|
||||
stats m_stats;
|
||||
|
||||
bool well_formed_row(unsigned row_id) const;
|
||||
bool well_formed_column(unsigned column_id) const;
|
||||
|
@ -238,6 +248,7 @@ namespace simplex {
|
|||
void display_row(std::ostream& out, row const& r);
|
||||
bool well_formed() const;
|
||||
|
||||
void collect_statistics(::statistics & st) const;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ namespace simplex {
|
|||
*/
|
||||
template<typename Ext>
|
||||
void sparse_matrix<Ext>::add(row row1, numeral const& n, row row2) {
|
||||
// m_stats.m_add_rows++;
|
||||
m_stats.m_add_rows++;
|
||||
_row & r1 = m_rows[row1.id()];
|
||||
_row & r2 = m_rows[row2.id()];
|
||||
|
||||
|
@ -547,6 +547,15 @@ namespace simplex {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief statistics
|
||||
*/
|
||||
template<typename Ext>
|
||||
void sparse_matrix<Ext>::collect_statistics(::statistics & st) const {
|
||||
st.update("simplex add rows", m_stats.m_add_rows);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief display method
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue