mirror of
https://github.com/Z3Prover/z3
synced 2025-08-11 21:50:52 +00:00
merge with master
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
c513f3ca09
883 changed files with 13979 additions and 16480 deletions
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
unsigned get_column_width(unsigned column);
|
||||
|
||||
unsigned regular_cell_width(unsigned row, unsigned column, std::string name) {
|
||||
unsigned regular_cell_width(unsigned row, unsigned column, const std::string & name) {
|
||||
return regular_cell_string(row, column, name).size();
|
||||
}
|
||||
|
||||
|
|
|
@ -79,13 +79,14 @@ public:
|
|||
|
||||
void apply_from_left_to_X(vector<X> & w, lp_settings & );
|
||||
|
||||
virtual void set_number_of_rows(unsigned /*m*/) {}
|
||||
virtual void set_number_of_columns(unsigned /*n*/) { }
|
||||
void set_number_of_rows(unsigned /*m*/) override {}
|
||||
void set_number_of_columns(unsigned /*n*/) override {}
|
||||
#ifdef Z3DEBUG
|
||||
T get_elem(unsigned i, unsigned j) const override { return m_values[i * m_n + j]; }
|
||||
#endif
|
||||
|
||||
T get_elem(unsigned i, unsigned j) const { return m_values[i * m_n + j]; }
|
||||
|
||||
unsigned row_count() const { return m_m; }
|
||||
unsigned column_count() const { return m_n; }
|
||||
unsigned row_count() const override { return m_m; }
|
||||
unsigned column_count() const override { return m_n; }
|
||||
|
||||
void set_elem(unsigned i, unsigned j, const T& val) { m_values[i * m_n + j] = val; }
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
#endif
|
||||
m_column_index(column_index) {}
|
||||
|
||||
bool is_dense() const { return false; }
|
||||
bool is_dense() const override { return false; }
|
||||
|
||||
void print(std::ostream & out) {
|
||||
print_matrix(*this, out);
|
||||
|
@ -65,12 +65,12 @@ public:
|
|||
return m_diagonal_element;
|
||||
}
|
||||
|
||||
void apply_from_left(vector<X> & w, lp_settings & );
|
||||
void apply_from_left(vector<X> & w, lp_settings & ) override;
|
||||
|
||||
template <typename L>
|
||||
void apply_from_left_local(indexed_vector<L> & w, lp_settings & settings);
|
||||
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings) {
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings) override {
|
||||
apply_from_left_local(w, settings);
|
||||
}
|
||||
|
||||
|
@ -80,15 +80,15 @@ public:
|
|||
m_column_vector.push_back(row_index, val);
|
||||
}
|
||||
|
||||
void apply_from_right(vector<T> & w);
|
||||
void apply_from_right(indexed_vector<T> & w);
|
||||
void apply_from_right(vector<T> & w) override;
|
||||
void apply_from_right(indexed_vector<T> & w) override;
|
||||
|
||||
T get_elem(unsigned i, unsigned j) const;
|
||||
#ifdef Z3DEBUG
|
||||
unsigned row_count() const { return m_length; }
|
||||
unsigned column_count() const { return m_length; }
|
||||
void set_number_of_rows(unsigned m) { m_length = m; }
|
||||
void set_number_of_columns(unsigned n) { m_length = n; }
|
||||
T get_elem(unsigned i, unsigned j) const override;
|
||||
unsigned row_count() const override { return m_length; }
|
||||
unsigned column_count() const override { return m_length; }
|
||||
void set_number_of_rows(unsigned m) override { m_length = m; }
|
||||
void set_number_of_columns(unsigned n) override { m_length = n; }
|
||||
#endif
|
||||
void divide_by_diagonal_element() {
|
||||
m_column_vector.divide(m_diagonal_element);
|
||||
|
|
|
@ -27,14 +27,14 @@ struct iterator_on_column:linear_combination_iterator<T> {
|
|||
const vector<column_cell>& m_column; // the offset in term coeffs
|
||||
const static_matrix<T, X> & m_A;
|
||||
int m_i; // the initial offset in the column
|
||||
unsigned size() const { return m_column.size(); }
|
||||
unsigned size() const override { return m_column.size(); }
|
||||
iterator_on_column(const vector<column_cell>& column, const static_matrix<T,X> & A) // the offset in term coeffs
|
||||
:
|
||||
m_column(column),
|
||||
m_A(A),
|
||||
m_i(-1) {}
|
||||
|
||||
bool next(mpq & a, unsigned & i) {
|
||||
bool next(mpq & a, unsigned & i) override {
|
||||
if (++m_i >= static_cast<int>(m_column.size()))
|
||||
return false;
|
||||
|
||||
|
@ -44,7 +44,7 @@ struct iterator_on_column:linear_combination_iterator<T> {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool next(unsigned & i) {
|
||||
bool next(unsigned & i) override {
|
||||
if (++m_i >= static_cast<int>(m_column.size()))
|
||||
return false;
|
||||
|
||||
|
@ -53,11 +53,11 @@ struct iterator_on_column:linear_combination_iterator<T> {
|
|||
return true;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
void reset() override {
|
||||
m_i = -1;
|
||||
}
|
||||
|
||||
linear_combination_iterator<mpq> * clone() {
|
||||
linear_combination_iterator<mpq> * clone() override {
|
||||
iterator_on_column * r = new iterator_on_column(m_column, m_A);
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ struct iterator_on_indexed_vector:linear_combination_iterator<T> {
|
|||
m_v(v),
|
||||
m_offset(0)
|
||||
{}
|
||||
unsigned size() const { return m_v.m_index.size(); }
|
||||
bool next(T & a, unsigned & i) {
|
||||
unsigned size() const override { return m_v.m_index.size(); }
|
||||
bool next(T & a, unsigned & i) override {
|
||||
if (m_offset >= m_v.m_index.size())
|
||||
return false;
|
||||
i = m_v.m_index[m_offset++];
|
||||
|
@ -37,16 +37,16 @@ struct iterator_on_indexed_vector:linear_combination_iterator<T> {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool next(unsigned & i) {
|
||||
bool next(unsigned & i) override {
|
||||
if (m_offset >= m_v.m_index.size())
|
||||
return false;
|
||||
i = m_v.m_index[m_offset++];
|
||||
return true;
|
||||
}
|
||||
void reset() {
|
||||
void reset() override {
|
||||
m_offset = 0;
|
||||
}
|
||||
linear_combination_iterator<T>* clone() {
|
||||
linear_combination_iterator<T>* clone() override {
|
||||
return new iterator_on_indexed_vector(m_v);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -26,11 +26,11 @@ struct iterator_on_pivot_row:linear_combination_iterator<T> {
|
|||
const indexed_vector<T> & m_v;
|
||||
unsigned m_basis_j;
|
||||
iterator_on_indexed_vector<T> m_it;
|
||||
unsigned size() const { return m_it.size(); }
|
||||
unsigned size() const override { return m_it.size(); }
|
||||
iterator_on_pivot_row(const indexed_vector<T> & v, unsigned basis_j) :
|
||||
m_basis_returned(false),
|
||||
m_v(v), m_basis_j(basis_j), m_it(v) {}
|
||||
bool next(T & a, unsigned & i) {
|
||||
bool next(T & a, unsigned & i) override {
|
||||
if (m_basis_returned == false) {
|
||||
m_basis_returned = true;
|
||||
a = one_of_type<T>();
|
||||
|
@ -39,7 +39,7 @@ struct iterator_on_pivot_row:linear_combination_iterator<T> {
|
|||
}
|
||||
return m_it.next(a, i);
|
||||
}
|
||||
bool next(unsigned & i) {
|
||||
bool next(unsigned & i) override {
|
||||
if (m_basis_returned == false) {
|
||||
m_basis_returned = true;
|
||||
i = m_basis_j;
|
||||
|
@ -47,11 +47,11 @@ struct iterator_on_pivot_row:linear_combination_iterator<T> {
|
|||
}
|
||||
return m_it.next(i);
|
||||
}
|
||||
void reset() {
|
||||
void reset() override {
|
||||
m_basis_returned = false;
|
||||
m_it.reset();
|
||||
}
|
||||
linear_combination_iterator<T> * clone() {
|
||||
linear_combination_iterator<T> * clone() override {
|
||||
iterator_on_pivot_row * r = new iterator_on_pivot_row(m_v, m_basis_j);
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ struct iterator_on_row:linear_combination_iterator<T> {
|
|||
unsigned m_i; // offset
|
||||
iterator_on_row(const vector<row_cell<T>> & row) : m_row(row), m_i(0)
|
||||
{}
|
||||
unsigned size() const { return m_row.size(); }
|
||||
bool next(T & a, unsigned & i) {
|
||||
unsigned size() const override { return m_row.size(); }
|
||||
bool next(T & a, unsigned & i) override {
|
||||
if (m_i == m_row.size())
|
||||
return false;
|
||||
auto &c = m_row[m_i++];
|
||||
|
@ -35,17 +35,17 @@ struct iterator_on_row:linear_combination_iterator<T> {
|
|||
a = c.get_val();
|
||||
return true;
|
||||
}
|
||||
bool next(unsigned & i) {
|
||||
bool next(unsigned & i) override {
|
||||
if (m_i == m_row.size())
|
||||
return false;
|
||||
auto &c = m_row[m_i++];
|
||||
i = c.m_j;
|
||||
return true;
|
||||
}
|
||||
void reset() {
|
||||
void reset() override {
|
||||
m_i = 0;
|
||||
}
|
||||
linear_combination_iterator<T>* clone() {
|
||||
linear_combination_iterator<T>* clone() override {
|
||||
return new iterator_on_row(m_row);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -27,14 +27,14 @@ struct iterator_on_term_with_basis_var:linear_combination_iterator<mpq> {
|
|||
std::unordered_map<unsigned, mpq>::const_iterator m_i; // the offset in term coeffs
|
||||
bool m_term_j_returned;
|
||||
unsigned m_term_j;
|
||||
unsigned size() const {return static_cast<unsigned>(m_term.m_coeffs.size() + 1);}
|
||||
unsigned size() const override {return static_cast<unsigned>(m_term.m_coeffs.size() + 1);}
|
||||
iterator_on_term_with_basis_var(const lar_term & t, unsigned term_j) :
|
||||
m_term(t),
|
||||
m_i(t.m_coeffs.begin()),
|
||||
m_term_j_returned(false),
|
||||
m_term_j(term_j) {}
|
||||
|
||||
bool next(mpq & a, unsigned & i) {
|
||||
bool next(mpq & a, unsigned & i) override {
|
||||
if (m_term_j_returned == false) {
|
||||
m_term_j_returned = true;
|
||||
a = - one_of_type<mpq>();
|
||||
|
@ -48,7 +48,7 @@ struct iterator_on_term_with_basis_var:linear_combination_iterator<mpq> {
|
|||
m_i++;
|
||||
return true;
|
||||
}
|
||||
bool next(unsigned & i) {
|
||||
bool next(unsigned & i) override {
|
||||
if (m_term_j_returned == false) {
|
||||
m_term_j_returned = true;
|
||||
i = m_term_j;
|
||||
|
@ -60,11 +60,11 @@ struct iterator_on_term_with_basis_var:linear_combination_iterator<mpq> {
|
|||
m_i++;
|
||||
return true;
|
||||
}
|
||||
void reset() {
|
||||
void reset() override {
|
||||
m_term_j_returned = false;
|
||||
m_i = m_term.m_coeffs.begin();
|
||||
}
|
||||
linear_combination_iterator<mpq> * clone() {
|
||||
linear_combination_iterator<mpq> * clone() override {
|
||||
iterator_on_term_with_basis_var * r = new iterator_on_term_with_basis_var(m_term, m_term_j);
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -59,24 +59,24 @@ public:
|
|||
|
||||
struct lar_var_constraint: public lar_base_constraint {
|
||||
unsigned m_j;
|
||||
vector<std::pair<mpq, var_index>> get_left_side_coefficients() const {
|
||||
vector<std::pair<mpq, var_index>> get_left_side_coefficients() const override {
|
||||
vector<std::pair<mpq, var_index>> ret;
|
||||
ret.push_back(std::make_pair(one_of_type<mpq>(), m_j));
|
||||
return ret;
|
||||
}
|
||||
unsigned size() const { return 1;}
|
||||
unsigned size() const override { return 1;}
|
||||
lar_var_constraint(unsigned j, lconstraint_kind kind, const mpq& right_side) : lar_base_constraint(kind, right_side), m_j(j) { }
|
||||
};
|
||||
|
||||
|
||||
struct lar_term_constraint: public lar_base_constraint {
|
||||
const lar_term * m_term;
|
||||
vector<std::pair<mpq, var_index>> get_left_side_coefficients() const {
|
||||
vector<std::pair<mpq, var_index>> get_left_side_coefficients() const override {
|
||||
return m_term->coeffs_as_vector();
|
||||
}
|
||||
unsigned size() const { return m_term->size();}
|
||||
unsigned size() const override { return m_term->size();}
|
||||
lar_term_constraint(const lar_term *t, lconstraint_kind kind, const mpq& right_side) : lar_base_constraint(kind, right_side), m_term(t) { }
|
||||
virtual mpq get_free_coeff_of_left_side() const { return m_term->m_v;}
|
||||
mpq get_free_coeff_of_left_side() const override { return m_term->m_v;}
|
||||
|
||||
};
|
||||
|
||||
|
@ -92,10 +92,10 @@ public:
|
|||
SASSERT(false); // should not be called : todo!
|
||||
}
|
||||
|
||||
unsigned size() const {
|
||||
unsigned size() const override {
|
||||
return static_cast<unsigned>(m_coeffs.size());
|
||||
}
|
||||
|
||||
vector<std::pair<mpq, var_index>> get_left_side_coefficients() const { return m_coeffs; }
|
||||
vector<std::pair<mpq, var_index>> get_left_side_coefficients() const override { return m_coeffs; }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -481,7 +481,7 @@ public:
|
|||
}
|
||||
|
||||
bool no_r_lu() const {
|
||||
return m_r_solver.m_factorization == nullptr || m_r_solver.m_factorization->get_status() == LU_status::Degenerated;
|
||||
return m_r_solver.m_factorization == nullptr || m_r_solver.m_factorization->get_status() == LU_status::Degenerated;
|
||||
}
|
||||
|
||||
void solve_on_signature_tableau(const lar_solution_signature & signature, const vector<unsigned> & changes_of_basis) {
|
||||
|
|
|
@ -1011,7 +1011,7 @@ public:
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::string get_column_name(unsigned j) const {
|
||||
std::string get_column_name(unsigned j) const override {
|
||||
if (j >= m_terms_start_index)
|
||||
return std::string("_t") + T_to_string(j);
|
||||
if (j >= m_columns_to_ext_vars_or_term_indices.size())
|
||||
|
@ -1157,7 +1157,7 @@ public:
|
|||
|
||||
bool explanation_is_correct(const vector<std::pair<mpq, unsigned>>& explanation) const {
|
||||
#ifdef Z3DEBUG
|
||||
lconstraint_kind kind;
|
||||
lconstraint_kind kind = EQ; // initialize it just to avoid a warning
|
||||
SASSERT(the_relations_are_of_same_type(explanation, kind));
|
||||
SASSERT(the_left_sides_sum_to_zero(explanation));
|
||||
mpq rs = sum_of_right_sides_of_explanation(explanation);
|
||||
|
|
|
@ -207,6 +207,6 @@ public:
|
|||
|
||||
void solve();
|
||||
|
||||
bool low_bounds_are_set() const { return true; }
|
||||
bool low_bounds_are_set() const override { return true; }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class lp_dual_simplex: public lp_solver<T, X> {
|
|||
vector<column_type> m_column_types_of_logicals;
|
||||
vector<bool> m_can_enter_basis;
|
||||
public:
|
||||
~lp_dual_simplex() {
|
||||
~lp_dual_simplex() override {
|
||||
if (m_core_solver != nullptr) {
|
||||
delete m_core_solver;
|
||||
}
|
||||
|
@ -84,12 +84,12 @@ public:
|
|||
|
||||
void copy_m_b_aside_and_set_it_to_zeros();
|
||||
|
||||
void find_maximal_solution();
|
||||
void find_maximal_solution() override;
|
||||
|
||||
virtual T get_column_value(unsigned column) const {
|
||||
T get_column_value(unsigned column) const override {
|
||||
return this->get_column_value_with_core_solver(column, m_core_solver);
|
||||
}
|
||||
|
||||
T get_current_cost() const;
|
||||
T get_current_cost() const override;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -770,7 +770,7 @@ public:
|
|||
|
||||
void init_reduced_costs();
|
||||
|
||||
bool low_bounds_are_set() const { return true; }
|
||||
bool low_bounds_are_set() const override { return true; }
|
||||
|
||||
int advance_on_sorted_breakpoints(unsigned entering, X & t);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
void set_core_solver_bounds();
|
||||
|
||||
void find_maximal_solution();
|
||||
void find_maximal_solution() override;
|
||||
|
||||
void fill_A_x_and_basis_for_stage_one_total_inf();
|
||||
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
void solve_with_total_inf();
|
||||
|
||||
|
||||
~lp_primal_simplex();
|
||||
~lp_primal_simplex() override;
|
||||
|
||||
bool bounds_hold(std::unordered_map<std::string, T> const & solution);
|
||||
|
||||
|
@ -96,11 +96,11 @@ public:
|
|||
return bounds_hold(solution) && row_constraints_hold(solution);
|
||||
}
|
||||
|
||||
virtual T get_column_value(unsigned column) const {
|
||||
T get_column_value(unsigned column) const override {
|
||||
return this->get_column_value_with_core_solver(column, m_core_solver);
|
||||
}
|
||||
|
||||
T get_current_cost() const;
|
||||
T get_current_cost() const override;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -109,7 +109,7 @@ private:
|
|||
default_lp_resource_limit(lp_settings& s): m_settings(s) {
|
||||
m_sw.start();
|
||||
}
|
||||
virtual bool get_cancel_flag() {
|
||||
bool get_cancel_flag() override {
|
||||
return (m_sw.get_current_seconds() > m_settings.time_limit);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -34,6 +34,7 @@ template void lp::lp_solver<double, double>::print_statistics_on_A(std::ostream
|
|||
template bool lp::lp_solver<double, double>::problem_is_empty();
|
||||
template void lp::lp_solver<double, double>::scale();
|
||||
template void lp::lp_solver<double, double>::set_scaled_cost(unsigned int);
|
||||
template std::string lp::lp_solver<double, double>::get_column_name(unsigned int) const;
|
||||
template lp::lp_solver<double, double>::~lp_solver();
|
||||
template void lp::lp_solver<lp::mpq, lp::mpq>::add_constraint(lp::lp_relation, lp::mpq, unsigned int);
|
||||
template void lp::lp_solver<lp::mpq, lp::mpq>::cleanup();
|
||||
|
@ -53,3 +54,4 @@ template void lp::lp_solver<lp::mpq, lp::mpq>::scale();
|
|||
template void lp::lp_solver<lp::mpq, lp::mpq>::set_scaled_cost(unsigned int);
|
||||
template lp::lp_solver<lp::mpq, lp::mpq>::~lp_solver();
|
||||
template double lp::lp_solver<double, double>::get_column_value_by_name(std::string) const;
|
||||
template std::string lp::lp_solver<lp::mpq, lp::mpq>::get_column_name(unsigned int) const;
|
||||
|
|
|
@ -67,31 +67,31 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
bool is_dense() const { return false; }
|
||||
bool is_dense() const override { return false; }
|
||||
|
||||
one_elem_on_diag(const one_elem_on_diag & o);
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
unsigned m_m;
|
||||
unsigned m_n;
|
||||
virtual void set_number_of_rows(unsigned m) { m_m = m; m_n = m; }
|
||||
virtual void set_number_of_columns(unsigned n) { m_m = n; m_n = n; }
|
||||
void set_number_of_rows(unsigned m) override { m_m = m; m_n = m; }
|
||||
void set_number_of_columns(unsigned n) override { m_m = n; m_n = n; }
|
||||
T m_one_over_val;
|
||||
|
||||
T get_elem (unsigned i, unsigned j) const;
|
||||
T get_elem (unsigned i, unsigned j) const override;
|
||||
|
||||
unsigned row_count() const { return m_m; } // not defined }
|
||||
unsigned column_count() const { return m_m; } // not defined }
|
||||
unsigned row_count() const override { return m_m; } // not defined }
|
||||
unsigned column_count() const override { return m_m; } // not defined }
|
||||
#endif
|
||||
void apply_from_left(vector<X> & w, lp_settings &) {
|
||||
void apply_from_left(vector<X> & w, lp_settings &) override {
|
||||
w[m_i] /= m_val;
|
||||
}
|
||||
|
||||
void apply_from_right(vector<T> & w) {
|
||||
void apply_from_right(vector<T> & w) override {
|
||||
w[m_i] /= m_val;
|
||||
}
|
||||
|
||||
void apply_from_right(indexed_vector<T> & w) {
|
||||
void apply_from_right(indexed_vector<T> & w) override {
|
||||
if (is_zero(w.m_data[m_i]))
|
||||
return;
|
||||
auto & v = w.m_data[m_i] /= m_val;
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings);
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings) override;
|
||||
|
||||
void conjugate_by_permutation(permutation_matrix<T, X> & p) {
|
||||
// this = p * this * p(-1)
|
||||
|
|
|
@ -95,7 +95,7 @@ inline vector<std::string> string_split(const std::string &source, const char *d
|
|||
return results;
|
||||
}
|
||||
|
||||
inline vector<std::string> split_and_trim(std::string line) {
|
||||
inline vector<std::string> split_and_trim(const std::string &line) {
|
||||
auto split = string_split(line, " \t", false);
|
||||
vector<std::string> ret;
|
||||
for (auto s : split) {
|
||||
|
@ -127,9 +127,9 @@ class mps_reader {
|
|||
std::string m_name;
|
||||
bound * m_bound;
|
||||
unsigned m_index;
|
||||
column(std::string name, unsigned index): m_name(name),
|
||||
m_bound(nullptr),
|
||||
m_index(index) {
|
||||
column(const std::string &name, unsigned index): m_name(name),
|
||||
m_bound(nullptr),
|
||||
m_index(index) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -140,7 +140,7 @@ class mps_reader {
|
|||
unsigned m_index;
|
||||
T m_right_side;
|
||||
T m_range;
|
||||
row(row_type type, std::string name, unsigned index) :
|
||||
row(row_type type, const std::string &name, unsigned index) :
|
||||
m_type(type),
|
||||
m_name(name),
|
||||
m_index(index),
|
||||
|
@ -254,7 +254,7 @@ class mps_reader {
|
|||
} while (m_is_OK);
|
||||
}
|
||||
|
||||
void read_column_by_columns(std::string column_name, std::string column_data) {
|
||||
void read_column_by_columns(const std::string & column_name, std::string column_data) {
|
||||
// uph, let us try to work with columns
|
||||
if (column_data.size() >= 22) {
|
||||
std::string ss = column_data.substr(0, 8);
|
||||
|
@ -283,7 +283,7 @@ class mps_reader {
|
|||
}
|
||||
}
|
||||
|
||||
void read_column(std::string column_name, std::string column_data){
|
||||
void read_column(const std::string & column_name, const std::string & column_data){
|
||||
auto tokens = split_and_trim(column_data);
|
||||
for (unsigned i = 0; i < tokens.size() - 1; i+= 2) {
|
||||
auto row_name = tokens[i];
|
||||
|
@ -421,7 +421,7 @@ class mps_reader {
|
|||
}
|
||||
|
||||
|
||||
void read_bound_by_columns(std::string colstr) {
|
||||
void read_bound_by_columns(const std::string & colstr) {
|
||||
if (colstr.size() < 14) {
|
||||
(*m_message_stream) << "line is too short" << std::endl;
|
||||
(*m_message_stream) << m_line << std::endl;
|
||||
|
@ -763,7 +763,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
mps_reader(std::string file_name):
|
||||
mps_reader(const std::string & file_name):
|
||||
m_is_OK(true),
|
||||
m_file_name(file_name),
|
||||
m_file_stream(file_name),
|
||||
|
|
|
@ -38,10 +38,10 @@ template <typename T> class numeric_traits {};
|
|||
template <> class numeric_traits<unsigned> {
|
||||
public:
|
||||
static bool precise() { return true; }
|
||||
static unsigned const zero() { return 0; }
|
||||
static unsigned const one() { return 1; }
|
||||
static unsigned zero() { return 0; }
|
||||
static unsigned one() { return 1; }
|
||||
static bool is_zero(unsigned v) { return v == 0; }
|
||||
static double const get_double(unsigned const & d) { return d; }
|
||||
static double get_double(unsigned const & d) { return d; }
|
||||
};
|
||||
|
||||
template <> class numeric_traits<double> {
|
||||
|
@ -66,7 +66,7 @@ template <> class numeric_traits<double> {
|
|||
static rational const & zero() { return rational::zero(); }
|
||||
static rational const & one() { return rational::one(); }
|
||||
static bool is_zero(const rational & v) { return v.is_zero(); }
|
||||
static double const get_double(const rational & d) { return d.get_double();}
|
||||
static double get_double(const rational & d) { return d.get_double();}
|
||||
static rational log(rational const& r) { UNREACHABLE(); return r; }
|
||||
static rational from_string(std::string const & str) { return rational(str.c_str()); }
|
||||
static bool is_pos(const rational & d) {return d.is_pos();}
|
||||
|
|
|
@ -64,7 +64,7 @@ class permutation_matrix : public tail_matrix<T, X> {
|
|||
// create a unit permutation of the given length
|
||||
void init(unsigned length);
|
||||
unsigned get_rev(unsigned i) { return m_rev[i]; }
|
||||
bool is_dense() const { return false; }
|
||||
bool is_dense() const override { return false; }
|
||||
#ifdef Z3DEBUG
|
||||
permutation_matrix get_inverse() const {
|
||||
return permutation_matrix(size(), m_rev);
|
||||
|
@ -76,13 +76,13 @@ class permutation_matrix : public tail_matrix<T, X> {
|
|||
|
||||
unsigned operator[](unsigned i) const { return m_permutation[i]; }
|
||||
|
||||
void apply_from_left(vector<X> & w, lp_settings &);
|
||||
void apply_from_left(vector<X> & w, lp_settings &) override;
|
||||
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings);
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings) override;
|
||||
|
||||
void apply_from_right(vector<T> & w);
|
||||
void apply_from_right(vector<T> & w) override;
|
||||
|
||||
void apply_from_right(indexed_vector<T> & w);
|
||||
void apply_from_right(indexed_vector<T> & w) override;
|
||||
|
||||
template <typename L>
|
||||
void copy_aside(vector<L> & t, vector<unsigned> & tmp_index, indexed_vector<L> & w);
|
||||
|
@ -109,13 +109,13 @@ class permutation_matrix : public tail_matrix<T, X> {
|
|||
|
||||
void transpose_from_right(unsigned i, unsigned j);
|
||||
#ifdef Z3DEBUG
|
||||
T get_elem(unsigned i, unsigned j) const{
|
||||
T get_elem(unsigned i, unsigned j) const override {
|
||||
return m_permutation[i] == j? numeric_traits<T>::one() : numeric_traits<T>::zero();
|
||||
}
|
||||
unsigned row_count() const{ return size(); }
|
||||
unsigned column_count() const { return size(); }
|
||||
virtual void set_number_of_rows(unsigned /*m*/) { }
|
||||
virtual void set_number_of_columns(unsigned /*n*/) { }
|
||||
unsigned row_count() const override { return size(); }
|
||||
unsigned column_count() const override { return size(); }
|
||||
void set_number_of_rows(unsigned /*m*/) override { }
|
||||
void set_number_of_columns(unsigned /*n*/) override { }
|
||||
#endif
|
||||
void multiply_by_permutation_from_left(permutation_matrix<T, X> & p);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
m_row_start(row_start), m_row(row) {
|
||||
}
|
||||
|
||||
bool is_dense() const { return false; }
|
||||
bool is_dense() const override { return false; }
|
||||
|
||||
void print(std::ostream & out) {
|
||||
print_matrix(*this, out);
|
||||
|
@ -60,12 +60,12 @@ public:
|
|||
return m_row_vector.m_data[m_row];
|
||||
}
|
||||
|
||||
void apply_from_left(vector<X> & w, lp_settings &);
|
||||
void apply_from_left(vector<X> & w, lp_settings &) override;
|
||||
|
||||
void apply_from_left_local_to_T(indexed_vector<T> & w, lp_settings & settings);
|
||||
void apply_from_left_local_to_X(indexed_vector<X> & w, lp_settings & settings);
|
||||
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings) {
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings) override {
|
||||
apply_from_left_local_to_T(w, settings);
|
||||
}
|
||||
|
||||
|
@ -74,16 +74,16 @@ public:
|
|||
m_row_vector.push_back(row_index, val);
|
||||
}
|
||||
|
||||
void apply_from_right(vector<T> & w);
|
||||
void apply_from_right(indexed_vector<T> & w);
|
||||
void apply_from_right(vector<T> & w) override;
|
||||
void apply_from_right(indexed_vector<T> & w) override;
|
||||
|
||||
void conjugate_by_permutation(permutation_matrix<T, X> & p);
|
||||
#ifdef Z3DEBUG
|
||||
T get_elem(unsigned row, unsigned col) const;
|
||||
unsigned row_count() const { return m_dimension; }
|
||||
unsigned column_count() const { return m_dimension; }
|
||||
void set_number_of_rows(unsigned m) { m_dimension = m; }
|
||||
void set_number_of_columns(unsigned n) { m_dimension = n; }
|
||||
T get_elem(unsigned row, unsigned col) const override;
|
||||
unsigned row_count() const override { return m_dimension; }
|
||||
unsigned column_count() const override { return m_dimension; }
|
||||
void set_number_of_rows(unsigned m) override { m_dimension = m; }
|
||||
void set_number_of_columns(unsigned n) override { m_dimension = n; }
|
||||
#endif
|
||||
}; // end of row_eta_matrix
|
||||
}
|
||||
|
|
|
@ -162,8 +162,8 @@ public:
|
|||
unsigned dimension() const {return static_cast<unsigned>(m_row_permutation.size());}
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
unsigned row_count() const {return dimension();}
|
||||
unsigned column_count() const {return dimension();}
|
||||
unsigned row_count() const override {return dimension();}
|
||||
unsigned column_count() const override {return dimension();}
|
||||
#endif
|
||||
|
||||
void init_row_headers();
|
||||
|
@ -302,11 +302,11 @@ public:
|
|||
void solve_U_y_indexed_only(indexed_vector<L> & y, const lp_settings&, vector<unsigned> & sorted_active_rows );
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
T get_elem(unsigned i, unsigned j) const { return get(i, j); }
|
||||
T get_elem(unsigned i, unsigned j) const override { return get(i, j); }
|
||||
unsigned get_number_of_rows() const { return dimension(); }
|
||||
unsigned get_number_of_columns() const { return dimension(); }
|
||||
virtual void set_number_of_rows(unsigned /*m*/) { }
|
||||
virtual void set_number_of_columns(unsigned /*n*/) { }
|
||||
void set_number_of_rows(unsigned /*m*/) override { }
|
||||
void set_number_of_columns(unsigned /*n*/) override { }
|
||||
#endif
|
||||
template <typename L>
|
||||
L dot_product_with_row (unsigned row, const vector<L> & y) const;
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
void init(sparse_matrix<T, X> *parent_matrix, unsigned index_start);
|
||||
|
||||
bool is_dense() const { return true; }
|
||||
bool is_dense() const override { return true; }
|
||||
|
||||
ref operator[] (unsigned i) {
|
||||
SASSERT(i >= m_index_start);
|
||||
|
@ -137,13 +137,13 @@ public:
|
|||
|
||||
bool is_L_matrix() const;
|
||||
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings) {
|
||||
void apply_from_left_to_T(indexed_vector<T> & w, lp_settings & settings) override {
|
||||
apply_from_left_local(w, settings);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void apply_from_right(indexed_vector<T> & w) {
|
||||
void apply_from_right(indexed_vector<T> & w) override {
|
||||
#if 1==0
|
||||
indexed_vector<T> wcopy = w;
|
||||
apply_from_right(wcopy.m_data);
|
||||
|
@ -207,18 +207,18 @@ public:
|
|||
w = m_work_vector;
|
||||
#endif
|
||||
}
|
||||
void apply_from_left(vector<X> & w, lp_settings & /*settings*/) {
|
||||
void apply_from_left(vector<X> & w, lp_settings & /*settings*/) override {
|
||||
apply_from_left_to_vector(w);// , settings);
|
||||
}
|
||||
|
||||
void apply_from_right(vector<T> & w);
|
||||
void apply_from_right(vector<T> & w) override;
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
T get_elem (unsigned i, unsigned j) const;
|
||||
unsigned row_count() const { return m_parent->row_count();}
|
||||
unsigned column_count() const { return row_count();}
|
||||
void set_number_of_rows(unsigned) {}
|
||||
void set_number_of_columns(unsigned) {};
|
||||
T get_elem (unsigned i, unsigned j) const override;
|
||||
unsigned row_count() const override { return m_parent->row_count();}
|
||||
unsigned column_count() const override { return row_count();}
|
||||
void set_number_of_rows(unsigned) override {}
|
||||
void set_number_of_columns(unsigned) override {}
|
||||
#endif
|
||||
void conjugate_by_permutation(permutation_matrix<T, X> & q);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue