3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-07 19:51:22 +00:00

Tabs, formatting.

This commit is contained in:
Christoph M. Wintersteiger 2017-09-17 14:29:32 +01:00
parent 8871cb120a
commit 00651f8f21
63 changed files with 715 additions and 717 deletions

View file

@ -201,7 +201,7 @@ public:
m_todo.push_back(d);
unsigned qhead = 0;
while (qhead < m_todo.size()) {
d = m_todo[qhead];
d = m_todo[qhead];
qhead++;
if (d->is_leaf()) {
vs.push_back(to_leaf(d)->m_value);

View file

@ -236,7 +236,7 @@ template<typename T>
struct ptr_hash {
typedef T * data;
unsigned operator()(T * ptr) const {
return get_ptr_hash(ptr);
return get_ptr_hash(ptr);
}
};

View file

@ -119,12 +119,12 @@ class inf_eps_rational {
bool is_rational() const { return m_infty.is_zero() && m_r.is_rational(); }
int64 get_int64() const {
SASSERT(is_int64());
SASSERT(is_int64());
return m_r.get_int64();
}
uint64 get_uint64() const {
SASSERT(is_uint64());
SASSERT(is_uint64());
return m_r.get_uint64();
}
@ -168,45 +168,45 @@ class inf_eps_rational {
inf_eps_rational & operator=(const inf_eps_rational & r) {
m_infty = r.m_infty;
m_r = r.m_r;
return *this;
return *this;
}
inf_eps_rational & operator=(const Numeral & r) {
m_infty.reset();
m_r = r;
return *this;
return *this;
}
inf_eps_rational & operator+=(const inf_eps_rational & r) {
m_infty += r.m_infty;
m_r += r.m_r;
return *this;
return *this;
}
inf_eps_rational & operator-=(const inf_eps_rational & r) {
m_infty -= r.m_infty;
m_r -= r.m_r;
return *this;
return *this;
}
inf_eps_rational & operator-=(const inf_rational & r) {
m_r -= r;
return *this;
return *this;
}
inf_eps_rational & operator+=(const inf_rational & r) {
m_r += r;
return *this;
return *this;
}
inf_eps_rational & operator+=(const rational & r) {
m_r += r;
return *this;
return *this;
}
inf_eps_rational & operator-=(const rational & r) {
m_r -= r;
return *this;
return *this;
}
inf_eps_rational & operator*=(const rational & r1) {

View file

@ -110,12 +110,12 @@ class inf_int_rational {
bool is_rational() const { return m_second == 0; }
int64 get_int64() const {
SASSERT(is_int64());
SASSERT(is_int64());
return m_first.get_int64();
}
uint64 get_uint64() const {
SASSERT(is_uint64());
SASSERT(is_uint64());
return m_first.get_uint64();
}
@ -132,7 +132,7 @@ class inf_int_rational {
inf_int_rational & operator=(const inf_int_rational & r) {
m_first = r.m_first;
m_second = r.m_second;
return *this;
return *this;
}
inf_int_rational & operator=(const rational & r) {
@ -154,7 +154,7 @@ class inf_int_rational {
inf_int_rational & operator+=(const inf_int_rational & r) {
m_first += r.m_first;
m_second += r.m_second;
return *this;
return *this;
}
inf_int_rational & operator*=(const rational & r) {
@ -163,7 +163,7 @@ class inf_int_rational {
}
m_first *= r;
m_second *= r.get_int32();
return *this;
return *this;
}
@ -171,17 +171,17 @@ class inf_int_rational {
inf_int_rational & operator-=(const inf_int_rational & r) {
m_first -= r.m_first;
m_second -= r.m_second;
return *this;
return *this;
}
inf_int_rational & operator+=(const rational & r) {
m_first += r;
return *this;
return *this;
}
inf_int_rational & operator-=(const rational & r) {
m_first -= r;
return *this;
return *this;
}
inf_int_rational & operator++() {

View file

@ -123,12 +123,12 @@ class inf_rational {
bool is_rational() const { return m_second.is_zero(); }
int64 get_int64() const {
SASSERT(is_int64());
SASSERT(is_int64());
return m_first.get_int64();
}
uint64 get_uint64() const {
SASSERT(is_uint64());
SASSERT(is_uint64());
return m_first.get_uint64();
}
@ -145,7 +145,7 @@ class inf_rational {
inf_rational & operator=(const inf_rational & r) {
m_first = r.m_first;
m_second = r.m_second;
return *this;
return *this;
}
inf_rational & operator=(const rational & r) {
@ -167,23 +167,23 @@ class inf_rational {
inf_rational & operator+=(const inf_rational & r) {
m_first += r.m_first;
m_second += r.m_second;
return *this;
return *this;
}
inf_rational & operator-=(const inf_rational & r) {
m_first -= r.m_first;
m_second -= r.m_second;
return *this;
return *this;
}
inf_rational & operator+=(const rational & r) {
m_first += r;
return *this;
return *this;
}
inf_rational & operator-=(const rational & r) {
m_first -= r;
return *this;
return *this;
}
inf_rational & operator*=(const rational & r1) {

View file

@ -67,7 +67,7 @@ class inf_s_integer {
inf_s_integer & operator=(const inf_s_integer & r) {
m_first = r.m_first;
m_second = r.m_second;
return *this;
return *this;
}
inf_s_integer & operator=(const rational & r) {
m_first = static_cast<int>(r.get_int64());
@ -90,20 +90,20 @@ class inf_s_integer {
inf_s_integer & operator+=(const inf_s_integer & r) {
m_first += r.m_first;
m_second += r.m_second;
return *this;
return *this;
}
inf_s_integer & operator-=(const inf_s_integer & r) {
m_first -= r.m_first;
m_second -= r.m_second;
return *this;
return *this;
}
inf_s_integer & operator+=(const s_integer & r) {
m_first += r.get_int();
return *this;
return *this;
}
inf_s_integer & operator-=(const s_integer & r) {
m_first -= r.get_int();
return *this;
return *this;
}
inf_s_integer & operator*=(const s_integer & r1) {
m_first *= r1.get_int();

View file

@ -114,22 +114,22 @@ public :
}
return a * lb(j).x;
}
mpq monoid_max(const mpq & a, unsigned j, bool & strict) const {
if (is_pos(a)) {
strict = !is_zero(ub(j).y);
return a * ub(j).x;
}
strict = !is_zero(lb(j).y);
return a * lb(j).x;
}
const mpq & monoid_min_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
if (!a_is_pos) {
strict = !is_zero(ub(j).y);
return ub(j).x;
}
strict = !is_zero(lb(j).y);
return lb(j).x;
}
mpq monoid_max(const mpq & a, unsigned j, bool & strict) const {
if (is_pos(a)) {
strict = !is_zero(ub(j).y);
return a * ub(j).x;
}
strict = !is_zero(lb(j).y);
return a * lb(j).x;
}
const mpq & monoid_min_no_mult(bool a_is_pos, unsigned j, bool & strict) const {
if (!a_is_pos) {
strict = !is_zero(ub(j).y);
return ub(j).x;
}
strict = !is_zero(lb(j).y);
return lb(j).x;
}
mpq monoid_min(const mpq & a, unsigned j, bool& strict) const {
if (is_neg(a)) {
@ -166,7 +166,7 @@ public :
m_it.reset();
while (m_it.next(a, j)) {
bool str;
bool a_is_pos = is_pos(a);
bool a_is_pos = is_pos(a);
mpq bound = total / a + monoid_min_no_mult(a_is_pos, j, str);
if (a_is_pos) {
limit_j(j, bound, true, false, strict - static_cast<int>(str) > 0);
@ -192,8 +192,8 @@ public :
m_it.reset();
while (m_it.next(a, j)) {
bool str;
bool a_is_pos = is_pos(a);
mpq bound = total / a + monoid_max_no_mult(a_is_pos, j, str);
bool a_is_pos = is_pos(a);
mpq bound = total / a + monoid_max_no_mult(a_is_pos, j, str);
bool astrict = strict - static_cast<int>(str) > 0;
if (a_is_pos) {
limit_j(j, bound, true, true, astrict);

View file

@ -123,7 +123,7 @@ void add_row_for_term(const lar_term * term, unsigned term_ext_index) {
void add_row_from_term_no_constraint(const lar_term * term, unsigned term_ext_index) {
register_new_ext_var_index(term_ext_index);
// j will be a new variable
unsigned j = A_r().column_count();
unsigned j = A_r().column_count();
ul_pair ul(j);
m_vars_to_ul_pairs.push_back(ul);
add_basic_var_to_core_fields();
@ -152,7 +152,7 @@ void add_basic_var_to_core_fields() {
}
constraint_index add_var_bound(var_index j, lconstraint_kind kind, const mpq & right_side) {
constraint_index ci = m_constraints.size();
constraint_index ci = m_constraints.size();
if (!is_term(j)) { // j is a var
auto vc = new lar_var_constraint(j, kind, right_side);
m_constraints.push_back(vc);
@ -212,8 +212,8 @@ void add_constraint_from_term_and_create_new_column_row(unsigned term_j, const l
}
void decide_on_strategy_and_adjust_initial_state() {
lean_assert(strategy_is_undecided());
if (m_vars_to_ul_pairs.size() > m_settings.column_number_threshold_for_using_lu_in_lar_solver) {
lean_assert(strategy_is_undecided());
if (m_vars_to_ul_pairs.size() > m_settings.column_number_threshold_for_using_lu_in_lar_solver) {
m_settings.simplex_strategy() = simplex_strategy_enum::lu;
} else {
m_settings.simplex_strategy() = simplex_strategy_enum::tableau_rows; // todo: when to switch to tableau_costs?
@ -239,14 +239,14 @@ void adjust_initial_state() {
void adjust_initial_state_for_lu() {
copy_from_mpq_matrix(A_d());
unsigned n = A_d().column_count();
m_mpq_lar_core_solver.m_d_x.resize(n);
m_mpq_lar_core_solver.m_d_low_bounds.resize(n);
m_mpq_lar_core_solver.m_d_upper_bounds.resize(n);
m_mpq_lar_core_solver.m_d_heading = m_mpq_lar_core_solver.m_r_heading;
m_mpq_lar_core_solver.m_d_basis = m_mpq_lar_core_solver.m_r_basis;
unsigned n = A_d().column_count();
m_mpq_lar_core_solver.m_d_x.resize(n);
m_mpq_lar_core_solver.m_d_low_bounds.resize(n);
m_mpq_lar_core_solver.m_d_upper_bounds.resize(n);
m_mpq_lar_core_solver.m_d_heading = m_mpq_lar_core_solver.m_r_heading;
m_mpq_lar_core_solver.m_d_basis = m_mpq_lar_core_solver.m_r_basis;
/*
/*
unsigned j = A_d().column_count();
A_d().add_column();
lean_assert(m_mpq_lar_core_solver.m_d_x.size() == j);

View file

@ -550,7 +550,7 @@ public:
lean_assert(m_r_solver.m_basis_heading[leaving] >= 0);
m_r_solver.change_basis_unconditionally(entering, leaving);
if(!m_r_solver.pivot_column_tableau(entering, m_r_solver.m_basis_heading[entering])) {
// unroll the last step
// unroll the last step
m_r_solver.change_basis_unconditionally(leaving, entering);
#ifdef LEAN_DEBUG
bool t =

View file

@ -380,8 +380,8 @@ public:
bool term_is_used_as_row(unsigned term) const {
lean_assert(is_term(term));
return contains(m_ext_vars_to_columns, term);
lean_assert(is_term(term));
return contains(m_ext_vars_to_columns, term);
}
void propagate_bounds_on_terms(lp_bound_propagator & bp) {
@ -484,16 +484,16 @@ public:
void pop(unsigned k) {
int n_was = static_cast<int>(m_ext_vars_to_columns.size());
m_status.pop(k);
m_infeasible_column_index.pop(k);
m_status.pop(k);
m_infeasible_column_index.pop(k);
unsigned n = m_vars_to_ul_pairs.peek_size(k);
for (unsigned j = n_was; j-- > n;)
m_ext_vars_to_columns.erase(m_columns_to_ext_vars_or_term_indices[j]);
m_columns_to_ext_vars_or_term_indices.resize(n);
if (m_settings.use_tableau()) {
for (unsigned j = n_was; j-- > n;)
m_ext_vars_to_columns.erase(m_columns_to_ext_vars_or_term_indices[j]);
m_columns_to_ext_vars_or_term_indices.resize(n);
if (m_settings.use_tableau()) {
pop_tableau();
}
m_vars_to_ul_pairs.pop(k);
m_vars_to_ul_pairs.pop(k);
m_mpq_lar_core_solver.pop(k);
clean_large_elements_after_pop(n, m_columns_with_changed_bound);
@ -501,7 +501,7 @@ public:
clean_large_elements_after_pop(m, m_rows_with_changed_bounds);
clean_inf_set_of_r_solver_after_pop();
lean_assert(m_settings.simplex_strategy() == simplex_strategy_enum::undecided ||
(!use_tableau()) || m_mpq_lar_core_solver.m_r_solver.reduced_costs_are_correct_tableau());
(!use_tableau()) || m_mpq_lar_core_solver.m_r_solver.reduced_costs_are_correct_tableau());
lean_assert(ax_is_correct());
@ -518,9 +518,9 @@ public:
}
m_terms.resize(m_term_count);
m_orig_terms.resize(m_term_count);
m_simplex_strategy.pop(k);
m_settings.simplex_strategy() = m_simplex_strategy;
lean_assert(sizes_are_correct());
m_simplex_strategy.pop(k);
m_settings.simplex_strategy() = m_simplex_strategy;
lean_assert(sizes_are_correct());
lean_assert((!m_settings.use_tableau()) || m_mpq_lar_core_solver.m_r_solver.reduced_costs_are_correct_tableau());
}
@ -967,8 +967,8 @@ public:
template <typename U, typename V>
void copy_from_mpq_matrix(static_matrix<U, V> & matr) {
matr.m_rows.resize(A_r().row_count());
matr.m_columns.resize(A_r().column_count());
matr.m_rows.resize(A_r().row_count());
matr.m_columns.resize(A_r().column_count());
for (unsigned i = 0; i < matr.row_count(); i++) {
for (auto & it : A_r().m_rows[i]) {
matr.set(i, it.m_j, convert_struct<U, mpq>::convert(it.get_val()));

View file

@ -17,11 +17,11 @@ const impq & lp_bound_propagator::get_upper_bound(unsigned j) const {
}
void lp_bound_propagator::try_add_bound(const mpq & v, unsigned j, bool is_low, bool coeff_before_j_is_pos, unsigned row_or_term_index, bool strict) {
unsigned term_j = m_lar_solver.adjust_column_index_to_term_index(j);
mpq w = v;
if (term_j != j) {
j = term_j;
w += m_lar_solver.get_term(term_j).m_v; // when terms are turned into the columns they "lose" the right side, at this moment they aquire it back
}
mpq w = v;
if (term_j != j) {
j = term_j;
w += m_lar_solver.get_term(term_j).m_v; // when terms are turned into the columns they "lose" the right side, at this moment they aquire it back
}
lconstraint_kind kind = is_low? GE : LE;
if (strict)
kind = static_cast<lconstraint_kind>(kind / 2);

View file

@ -278,13 +278,13 @@ public:
return m_simplex_strategy;
}
bool use_lu() const {
return m_simplex_strategy == simplex_strategy_enum::lu;
}
bool use_lu() const {
return m_simplex_strategy == simplex_strategy_enum::lu;
}
bool use_tableau() const {
return m_simplex_strategy == simplex_strategy_enum::tableau_rows ||
m_simplex_strategy == simplex_strategy_enum::tableau_costs;
return m_simplex_strategy == simplex_strategy_enum::tableau_rows ||
m_simplex_strategy == simplex_strategy_enum::tableau_costs;
}
bool use_tableau_rows() const {

View file

@ -18,7 +18,7 @@ bool try_get_val(const std::unordered_map<A,B> & map, const A& key, B & val) {
template <typename A, typename B>
bool contains(const std::unordered_map<A, B> & map, const A& key) {
return map.find(key) != map.end();
return map.find(key) != map.end();
}
#ifdef lp_for_z3

View file

@ -51,10 +51,10 @@ public:
private:
void emplace_replace(unsigned i,const B & b) {
if (m_vector[i] != b) {
m_changes.push_back(std::make_pair(i, m_vector[i]));
m_vector[i] = b;
}
if (m_vector[i] != b) {
m_changes.push_back(std::make_pair(i, m_vector[i]));
m_vector[i] = b;
}
}
public:
@ -87,14 +87,14 @@ public:
}
template <typename T>
void pop_tail(vector<T> & v, unsigned k) {
lean_assert(v.size() >= k);
v.resize(v.size() - k);
}
void pop_tail(vector<T> & v, unsigned k) {
lean_assert(v.size() >= k);
v.resize(v.size() - k);
}
template <typename T>
void resize(vector<T> & v, unsigned new_size) {
v.resize(new_size);
v.resize(new_size);
}
void pop(unsigned k) {
@ -156,10 +156,10 @@ public:
m_vector.resize(m_vector.size() + 1);
}
unsigned peek_size(unsigned k) const {
lean_assert(k > 0 && k <= m_stack_of_vector_sizes.size());
return m_stack_of_vector_sizes[m_stack_of_vector_sizes.size() - k];
}
unsigned peek_size(unsigned k) const {
lean_assert(k > 0 && k <= m_stack_of_vector_sizes.size());
return m_stack_of_vector_sizes[m_stack_of_vector_sizes.size() - k];
}
const vector<B>& operator()() const { return m_vector; }
};

View file

@ -47,7 +47,7 @@ class static_matrix
dim(unsigned m, unsigned n) :m_m(m), m_n(n) {}
};
std::stack<dim> m_stack;
vector<unsigned> m_became_zeros; // the row indices that became zeroes during the pivoting
vector<unsigned> m_became_zeros; // the row indices that became zeroes during the pivoting
public:
typedef vector<row_cell<T>> row_strip;
typedef vector<column_cell> column_strip;

View file

@ -49,8 +49,8 @@ public:
&& m_upper_bound_witness == p.m_upper_bound_witness &&
m_i == p.m_i;
}
// empty constructor
ul_pair() :
// empty constructor
ul_pair() :
m_low_bound_witness(static_cast<constraint_index>(-1)),
m_upper_bound_witness(static_cast<constraint_index>(-1)),
m_i(static_cast<row_index>(-1))

View file

@ -135,7 +135,7 @@ public:
value const& get(key const& k, value const& default_value) const {
entry* e = find_core(k);
if (e) {
return e->get_data().m_value;
return e->get_data().m_value;
}
else {
return default_value;

View file

@ -92,7 +92,7 @@ public:
m_next.reserve(std::max(src, dst) + 1);
m_next.reserve(std::max(negate(src), negate(dst)) + 1);
m_next[src].push_back(dst);
m_next[dst].push_back(src);
m_next[dst].push_back(src);
}
void cliques(unsigned_vector const& ps, vector<unsigned_vector>& cliques) {
@ -104,7 +104,7 @@ public:
max = std::max(max, std::max(np, p) + 1);
}
m_next.reserve(max);
m_tc.reserve(m_next.size());
m_tc.reserve(m_next.size());
unsigned_vector clique;
uint_set vars;
for (unsigned i = 0; i < num_ps; ++i) {

View file

@ -422,7 +422,7 @@ inline bool operator>(rational const & r1, rational const & r2) {
}
inline bool operator<(rational const & r1, int r2) {
return r1 < rational(r2);
return r1 < rational(r2);
}
inline bool operator<=(rational const & r1, rational const & r2) {
@ -450,11 +450,11 @@ inline rational operator+(rational const & r1, rational const & r2) {
}
inline rational operator+(int r1, rational const & r2) {
return rational(r1) + r2;
return rational(r1) + r2;
}
inline rational operator+(rational const & r1, int r2) {
return r1 + rational(r2);
return r1 + rational(r2);
}
@ -463,11 +463,11 @@ inline rational operator-(rational const & r1, rational const & r2) {
}
inline rational operator-(rational const & r1, int r2) {
return r1 - rational(r2);
return r1 - rational(r2);
}
inline rational operator-(int r1, rational const & r2) {
return rational(r1) - r2;
return rational(r1) - r2;
}
inline rational operator-(rational const & r) {
@ -492,11 +492,11 @@ inline rational operator/(rational const & r1, rational const & r2) {
}
inline rational operator/(rational const & r1, int r2) {
return r1 / rational(r2);
return r1 / rational(r2);
}
inline rational operator/(int r1, rational const & r2) {
return rational(r1) / r2;
inline rational operator/(int r1, rational const & r2) {
return rational(r1) / r2;
}
inline rational power(rational const & r, unsigned p) {

View file

@ -110,7 +110,7 @@ public:
mach_timespec_t _stop;
clock_get_time(m_host_clock, &_stop);
m_time += (_stop.tv_sec - m_start.tv_sec) * 1000000000ull;
m_time += (_stop.tv_nsec - m_start.tv_nsec);
m_time += (_stop.tv_nsec - m_start.tv_nsec);
m_running = false;
}
}
@ -163,8 +163,8 @@ public:
struct timespec _stop;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &_stop);
m_time += (_stop.tv_sec - m_start.tv_sec) * 1000000000ull;
if (m_time != 0 || _stop.tv_nsec >= m_start.tv_nsec)
m_time += (_stop.tv_nsec - m_start.tv_nsec);
if (m_time != 0 || _stop.tv_nsec >= m_start.tv_nsec)
m_time += (_stop.tv_nsec - m_start.tv_nsec);
m_running = false;
}
}

View file

@ -153,13 +153,13 @@ template<class T, size_t N> char (*ArraySizer(T (&)[N]))[N];
template<typename IT>
void display(std::ostream & out, const IT & begin, const IT & end, const char * sep, bool & first) {
for(IT it = begin; it != end; ++it) {
if (first) {
first = false;
}
else {
out << sep;
}
out << *it;
if (first) {
first = false;
}
else {
out << sep;
}
out << *it;
}
}
@ -172,9 +172,9 @@ void display(std::ostream & out, const IT & begin, const IT & end, const char *
template<typename T>
struct delete_proc {
void operator()(T * ptr) {
if (ptr) {
dealloc(ptr);
}
if (ptr) {
dealloc(ptr);
}
}
};