mirror of
https://github.com/Z3Prover/z3
synced 2025-04-13 12:28:44 +00:00
replace lp_assert(false) with UNREACHABLE
This commit is contained in:
parent
3efe91c3e3
commit
8b0aa22631
|
@ -139,7 +139,7 @@ template <typename T, typename X> void core_solver_pretty_printer<T, X>::adjust_
|
|||
case column_type::free_column:
|
||||
break;
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,9 +114,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void copy_column_to_indexed_vector(unsigned entering, indexed_vector<mpq> &w ) const {
|
||||
lp_assert(false); // not implemented
|
||||
}
|
||||
general_matrix operator*(const general_matrix & m) const {
|
||||
lp_assert(m.row_count() == column_count());
|
||||
general_matrix ret(row_count(), m.column_count());
|
||||
|
@ -172,24 +169,7 @@ public:
|
|||
return r;
|
||||
}
|
||||
|
||||
// bool create_upper_triangle(general_matrix& m, vector<mpq>& x) {
|
||||
// for (unsigned i = 1; i < m.row_count(); i++) {
|
||||
// lp_assert(false); // to be continued
|
||||
// }
|
||||
// }
|
||||
|
||||
// bool solve_A_x_equal_b(const general_matrix& m, vector<mpq>& x, const vector<mpq>& b) const {
|
||||
// auto m_copy = m;
|
||||
// // for square matrices
|
||||
// lp_assert(row_count() == b.size());
|
||||
// lp_assert(x.size() == column_count());
|
||||
// lp_assert(row_count() == column_count());
|
||||
// x = b;
|
||||
// create_upper_triangle(copy_of_m, x);
|
||||
// solve_on_triangle(copy_of_m, x);
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
void transpose_rows(unsigned i, unsigned l) {
|
||||
lp_assert(i != l);
|
||||
m_row_permutation.transpose_from_right(i, l);
|
||||
|
|
|
@ -44,7 +44,7 @@ inline std::string lconstraint_kind_string(lconstraint_kind t) {
|
|||
case EQ: return std::string("=");
|
||||
case NE: return std::string("!=");
|
||||
}
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
return std::string(); // it is unreachable
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ public:
|
|||
case column_type::fixed:
|
||||
return true;
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
case column_type::fixed:
|
||||
return true;
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -466,7 +466,7 @@ namespace lp {
|
|||
|
||||
|
||||
default:
|
||||
lp_unreachable(); // wrong mode
|
||||
UNREACHABLE(); // wrong mode
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -802,7 +802,7 @@ namespace lp {
|
|||
case GT: return left_side_val > constr.rhs();
|
||||
case EQ: return left_side_val == constr.rhs();
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
}
|
||||
return false; // it is unreachable
|
||||
}
|
||||
|
@ -857,7 +857,7 @@ namespace lp {
|
|||
case EQ: lp_assert(rs != zero_of_type<mpq>());
|
||||
break;
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -1816,7 +1816,7 @@ namespace lp {
|
|||
adjust_initial_state_for_tableau_rows();
|
||||
break;
|
||||
case simplex_strategy_enum::tableau_costs:
|
||||
lp_assert(false); // not implemented
|
||||
UNREACHABLE(); // not implemented
|
||||
case simplex_strategy_enum::undecided:
|
||||
adjust_initial_state_for_tableau_rows();
|
||||
break;
|
||||
|
@ -1905,7 +1905,7 @@ namespace lp {
|
|||
}
|
||||
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (m_mpq_lar_core_solver.m_r_upper_bounds[j] == m_mpq_lar_core_solver.m_r_lower_bounds[j]) {
|
||||
m_mpq_lar_core_solver.m_column_types[j] = column_type::fixed;
|
||||
|
@ -1959,7 +1959,7 @@ namespace lp {
|
|||
}
|
||||
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2009,7 +2009,7 @@ namespace lp {
|
|||
}
|
||||
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
void lar_solver::update_bound_with_no_ub_no_lb(var_index j, lconstraint_kind kind, const mpq& right_side, constraint_index ci) {
|
||||
|
@ -2050,7 +2050,7 @@ namespace lp {
|
|||
}
|
||||
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ public:
|
|||
return p.coeff().is_one();
|
||||
}
|
||||
}
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ inline std::string lia_move_to_string(lia_move m) {
|
|||
case lia_move::unsat:
|
||||
return "unsat";
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
};
|
||||
return "strange";
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ template bool lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::prin
|
|||
template bool lp::lp_core_solver_base<lp::mpq, lp::mpq>::basis_heading_is_correct() const ;
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::mpq>::column_is_dual_feasible(unsigned int) const;
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::mpq>::print_statistics_with_iterations_and_nonzeroes_and_cost_and_check_that_the_time_is_over(char const*, std::ostream &);
|
||||
template void lp::lp_core_solver_base<lp::mpq, lp::mpq>::set_non_basic_x_to_correct_bounds();
|
||||
template void lp::lp_core_solver_base<lp::mpq, lp::mpq>::add_delta_to_entering(unsigned int, const lp::mpq&);
|
||||
template void lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::init();
|
||||
template void lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::init_basis_heading_and_non_basic_columns_vector();
|
||||
|
@ -61,7 +60,6 @@ template bool lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::calc
|
|||
template bool lp::lp_core_solver_base<lp::mpq, lp::mpq>::column_is_feasible(unsigned int) const;
|
||||
// template void lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::print_linear_combination_of_column_indices(vector<std::pair<lp::mpq, unsigned int>, std::allocator<std::pair<lp::mpq, unsigned int> > > const&, std::ostream&) const;
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::column_is_feasible(unsigned int) const;
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::snap_non_basic_x_to_bound();
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq>>::pivot_column_tableau(unsigned int, unsigned int);
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::mpq>::pivot_column_tableau(unsigned int, unsigned int);
|
||||
template void lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::transpose_rows_tableau(unsigned int, unsigned int);
|
||||
|
@ -70,6 +68,5 @@ template bool lp::lp_core_solver_base<lp::mpq, lp::mpq>::inf_set_is_correct() co
|
|||
template bool lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::infeasibility_costs_are_correct() const;
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::mpq >::infeasibility_costs_are_correct() const;
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::remove_from_basis(unsigned int);
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::remove_from_basis(unsigned int, lp::numeric_pair<lp::mpq> const&);
|
||||
|
||||
|
||||
|
|
|
@ -173,8 +173,6 @@ public:
|
|||
|
||||
void set_total_iterations(unsigned s) { m_total_iterations = s; }
|
||||
|
||||
void set_non_basic_x_to_correct_bounds();
|
||||
|
||||
bool at_bound(const X &x, const X & bound) const {
|
||||
return !below_bound(x, bound) && !above_bound(x, bound);
|
||||
}
|
||||
|
@ -300,45 +298,6 @@ public:
|
|||
|
||||
std::string column_name(unsigned column) const;
|
||||
|
||||
bool snap_non_basic_x_to_bound() {
|
||||
bool ret = false;
|
||||
for (unsigned j : non_basis())
|
||||
ret = snap_column_to_bound(j) || ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool snap_column_to_bound(unsigned j) {
|
||||
switch (m_column_types[j]) {
|
||||
case column_type::fixed:
|
||||
if (x_is_at_bound(j))
|
||||
break;
|
||||
m_x[j] = m_lower_bounds[j];
|
||||
return true;
|
||||
case column_type::boxed:
|
||||
if (x_is_at_bound(j))
|
||||
break; // we should preserve x if possible
|
||||
// snap randomly
|
||||
if (m_settings.random_next() % 2 == 1)
|
||||
m_x[j] = m_lower_bounds[j];
|
||||
else
|
||||
m_x[j] = m_upper_bounds[j];
|
||||
return true;
|
||||
case column_type::lower_bound:
|
||||
if (x_is_at_lower_bound(j))
|
||||
break;
|
||||
m_x[j] = m_lower_bounds[j];
|
||||
return true;
|
||||
case column_type::upper_bound:
|
||||
if (x_is_at_upper_bound(j))
|
||||
break;
|
||||
m_x[j] = m_upper_bounds[j];
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool make_column_feasible(unsigned j, numeric_pair<mpq> & delta) {
|
||||
bool ret = false;
|
||||
lp_assert(m_basis_heading[j] < 0);
|
||||
|
@ -384,7 +343,6 @@ public:
|
|||
}
|
||||
|
||||
bool remove_from_basis(unsigned j);
|
||||
bool remove_from_basis(unsigned j, const impq&);
|
||||
bool pivot_column_general(unsigned j, unsigned j_basic, indexed_vector<T> & w);
|
||||
void init_basic_part_of_basis_heading() {
|
||||
unsigned m = m_basis.size();
|
||||
|
@ -456,31 +414,6 @@ public:
|
|||
change_basis_unconditionally(leaving, entering);
|
||||
}
|
||||
|
||||
bool non_basic_column_is_set_correctly(unsigned j) const {
|
||||
if (j >= this->m_n())
|
||||
return false;
|
||||
switch (this->m_column_types[j]) {
|
||||
case column_type::fixed:
|
||||
case column_type::boxed:
|
||||
if (!this->x_is_at_bound(j))
|
||||
return false;
|
||||
break;
|
||||
case column_type::lower_bound:
|
||||
if (!this->x_is_at_lower_bound(j))
|
||||
return false;
|
||||
break;
|
||||
case column_type::upper_bound:
|
||||
if (!this->x_is_at_upper_bound(j))
|
||||
return false;
|
||||
break;
|
||||
case column_type::free_column:
|
||||
break;
|
||||
default:
|
||||
lp_assert(false);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool non_basic_columns_are_set_correctly() const {
|
||||
for (unsigned j : this->m_nbasis)
|
||||
if (!column_is_feasible(j)) {
|
||||
|
@ -540,13 +473,11 @@ public:
|
|||
out << "[-oo, oo]";
|
||||
break;
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
}
|
||||
return out << "\n";
|
||||
}
|
||||
|
||||
bool column_is_free(unsigned j) const { return this->m_column_types[j] == column_type::free_column; }
|
||||
|
||||
bool column_is_fixed(unsigned j) const { return this->m_column_types[j] == column_type::fixed; }
|
||||
|
||||
|
||||
|
@ -579,16 +510,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// only check for basic columns
|
||||
bool calc_current_x_is_feasible() const {
|
||||
unsigned i = this->m_m();
|
||||
while (i--) {
|
||||
if (!column_is_feasible(m_basis[i]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void transpose_rows_tableau(unsigned i, unsigned ii);
|
||||
|
||||
void pivot_to_reduced_costs_tableau(unsigned i, unsigned j);
|
||||
|
|
|
@ -166,26 +166,6 @@ print_statistics_with_cost_and_check_that_the_time_is_over(X cost, std::ostream
|
|||
return time_is_over();
|
||||
}
|
||||
|
||||
template <typename T, typename X> void lp_core_solver_base<T, X>::
|
||||
set_non_basic_x_to_correct_bounds() {
|
||||
for (unsigned j : non_basis()) {
|
||||
switch (m_column_types[j]) {
|
||||
case column_type::boxed:
|
||||
m_x[j] = m_d[j] < 0? m_upper_bounds[j]: m_lower_bounds[j];
|
||||
break;
|
||||
case column_type::lower_bound:
|
||||
m_x[j] = m_lower_bounds[j];
|
||||
lp_assert(column_is_dual_feasible(j));
|
||||
break;
|
||||
case column_type::upper_bound:
|
||||
m_x[j] = m_upper_bounds[j];
|
||||
lp_assert(column_is_dual_feasible(j));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
template <typename T, typename X> bool lp_core_solver_base<T, X>::
|
||||
column_is_dual_feasible(unsigned j) const {
|
||||
switch (m_column_types[j]) {
|
||||
|
@ -201,9 +181,9 @@ column_is_dual_feasible(unsigned j) const {
|
|||
case column_type::free_column:
|
||||
return numeric_traits<X>::is_zero(m_d[j]);
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
}
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
template <typename T, typename X> bool lp_core_solver_base<T, X>::
|
||||
|
@ -257,7 +237,7 @@ template <typename T, typename X> bool lp_core_solver_base<T, X>::column_is_feas
|
|||
return true;
|
||||
break;
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
}
|
||||
return false; // it is unreachable
|
||||
}
|
||||
|
@ -453,18 +433,6 @@ template <typename T, typename X> bool lp_core_solver_base<T, X>::remove_from_ba
|
|||
return false;
|
||||
}
|
||||
|
||||
template <typename T, typename X> bool lp_core_solver_base<T, X>::remove_from_basis(unsigned basic_j, const impq& val) {
|
||||
indexed_vector<T> w(m_basis.size()); // the buffer
|
||||
unsigned i = m_basis_heading[basic_j];
|
||||
for (auto &c : m_A.m_rows[i]) {
|
||||
if (c.var() == basic_j)
|
||||
continue;
|
||||
if (pivot_column_general(c.var(), basic_j, w))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename X> bool
|
||||
lp_core_solver_base<T, X>::infeasibility_costs_are_correct() const {
|
||||
|
@ -513,7 +481,7 @@ lp_core_solver_base<T, X>::infeasibility_cost_is_correct_for_column(unsigned j)
|
|||
case column_type::free_column:
|
||||
return is_zero(this->m_costs[j]);
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -53,10 +53,6 @@ void lp_primal_core_solver<T, X>::sort_non_basis() {
|
|||
|
||||
template <typename T, typename X>
|
||||
bool lp_primal_core_solver<T, X>::column_is_benefitial_for_entering_basis(unsigned j) const {
|
||||
return column_is_benefitial_for_entering_basis_precise(j);
|
||||
}
|
||||
template <typename T, typename X>
|
||||
bool lp_primal_core_solver<T, X>::column_is_benefitial_for_entering_basis_precise(unsigned j) const {
|
||||
const T& dj = this->m_d[j];
|
||||
TRACE("lar_solver", tout << "dj=" << dj << "\n";);
|
||||
switch (this->m_column_types[j]) {
|
||||
|
@ -88,56 +84,12 @@ bool lp_primal_core_solver<T, X>::column_is_benefitial_for_entering_basis_precis
|
|||
}
|
||||
break;
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T, typename X>
|
||||
int lp_primal_core_solver<T, X>::choose_entering_column_presize(unsigned number_of_benefitial_columns_to_go_over) { // at this moment m_y = cB * B(-1)
|
||||
if (number_of_benefitial_columns_to_go_over == 0)
|
||||
return -1;
|
||||
if (this->m_basis_sort_counter == 0) {
|
||||
sort_non_basis();
|
||||
this->m_basis_sort_counter = 20;
|
||||
}
|
||||
else {
|
||||
this->m_basis_sort_counter--;
|
||||
}
|
||||
unsigned j_nz = this->m_m() + 1; // this number is greater than the max column size
|
||||
std::list<unsigned>::iterator entering_iter = m_non_basis_list.end();
|
||||
for (auto non_basis_iter = m_non_basis_list.begin(); number_of_benefitial_columns_to_go_over && non_basis_iter != m_non_basis_list.end(); ++non_basis_iter) {
|
||||
unsigned j = *non_basis_iter;
|
||||
if (!column_is_benefitial_for_entering_basis(j))
|
||||
continue;
|
||||
|
||||
// if we are here then j is a candidate to enter the basis
|
||||
unsigned t = this->m_columns_nz[j];
|
||||
if (t < j_nz) {
|
||||
j_nz = t;
|
||||
entering_iter = non_basis_iter;
|
||||
if (number_of_benefitial_columns_to_go_over)
|
||||
number_of_benefitial_columns_to_go_over--;
|
||||
} else if (t == j_nz && this->m_settings.random_next() % 2 == 0) {
|
||||
entering_iter = non_basis_iter;
|
||||
}
|
||||
}// while (number_of_benefitial_columns_to_go_over && initial_offset_in_non_basis != offset_in_nb);
|
||||
if (entering_iter == m_non_basis_list.end())
|
||||
return -1;
|
||||
unsigned entering = *entering_iter;
|
||||
m_sign_of_entering_delta = this->m_d[entering] > 0 ? 1 : -1;
|
||||
m_non_basis_list.erase(entering_iter);
|
||||
m_non_basis_list.push_back(entering);
|
||||
return entering;
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename X>
|
||||
int lp_primal_core_solver<T, X>::choose_entering_column(unsigned number_of_benefitial_columns_to_go_over) { // at this moment m_y = cB * B(-1)
|
||||
return choose_entering_column_presize(number_of_benefitial_columns_to_go_over);
|
||||
}
|
||||
|
||||
template <typename T, typename X> bool lp_primal_core_solver<T, X>::try_jump_to_another_bound_on_entering(unsigned entering,
|
||||
const X & theta,
|
||||
X & t,
|
||||
|
@ -278,24 +230,6 @@ template <typename T, typename X> void lp_primal_core_solver<T, X>::backup_an
|
|||
|
||||
|
||||
|
||||
template <typename T, typename X>
|
||||
void lp_primal_core_solver<T, X>::advance_on_entering_equal_leaving(int entering, X & t) {
|
||||
|
||||
}
|
||||
|
||||
template <typename T, typename X>void lp_primal_core_solver<T, X>::advance_on_entering_and_leaving(int entering, int leaving, X & t) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename X> void lp_primal_core_solver<T, X>::advance_on_entering_precise(int entering) {
|
||||
lp_assert(false);
|
||||
}
|
||||
|
||||
template <typename T, typename X> void lp_primal_core_solver<T, X>::advance_on_entering(int entering) {
|
||||
lp_assert(false);
|
||||
}
|
||||
|
||||
template <typename T, typename X> void lp_primal_core_solver<T, X>::push_forward_offset_in_non_basis(unsigned & offset_in_nb) {
|
||||
if (++offset_in_nb == this->m_nbasis.size())
|
||||
offset_in_nb = 0;
|
||||
|
@ -377,7 +311,7 @@ lp_primal_core_solver<T, X>::get_infeasibility_cost_for_column(unsigned j) const
|
|||
ret = numeric_traits<T>::zero();
|
||||
break;
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
ret = numeric_traits<T>::zero(); // does not matter
|
||||
break;
|
||||
}
|
||||
|
@ -427,7 +361,7 @@ lp_primal_core_solver<T, X>::init_infeasibility_cost_for_column(unsigned j) {
|
|||
this->m_costs[j] = numeric_traits<T>::zero();
|
||||
break;
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -458,7 +392,7 @@ template <typename T, typename X> void lp_primal_core_solver<T, X>::print_column
|
|||
out << "( _" << this->m_x[j] << "_)" << std::endl;
|
||||
break;
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -480,7 +414,7 @@ template <typename T, typename X> void lp_primal_core_solver<T, X>::print_bound_
|
|||
out << "inf, inf" << std::endl;
|
||||
break;
|
||||
default:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ unsigned lp_primal_core_solver<T, X>::solve() {
|
|||
}
|
||||
break;
|
||||
case lp_status::TENTATIVE_UNBOUNDED:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
break;
|
||||
case lp_status::UNBOUNDED:
|
||||
if (this->current_x_is_infeasible()) {
|
||||
|
@ -132,7 +132,7 @@ unsigned lp_primal_core_solver<T, X>::solve() {
|
|||
break;
|
||||
|
||||
case lp_status::UNSTABLE:
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -31,7 +31,7 @@ std::string column_type_to_string(column_type t) {
|
|||
case column_type::lower_bound: return "lower_bound";
|
||||
case column_type::upper_bound: return "upper_bound";
|
||||
case column_type::free_column: return "free_column";
|
||||
default: lp_unreachable();
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
return "unknown"; // it is unreachable
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ const char* lp_status_to_string(lp_status status) {
|
|||
case lp_status::UNSTABLE: return "UNSTABLE";
|
||||
case lp_status::CANCELLED: return "CANCELLED";
|
||||
default:
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
}
|
||||
return "UNKNOWN"; // it is unreachable
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ lp_status lp_status_from_string(std::string status) {
|
|||
if (status == "FEASIBLE") return lp_status::FEASIBLE;
|
||||
if (status == "TIME_EXHAUSTED") return lp_status::TIME_EXHAUSTED;
|
||||
if (status == "EMPTY") return lp_status::EMPTY;
|
||||
lp_unreachable();
|
||||
UNREACHABLE();
|
||||
return lp_status::UNKNOWN; // it is unreachable
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,6 @@ inline void throw_exception(std::string && str) {
|
|||
typedef z3_exception exception;
|
||||
|
||||
#define lp_assert(_x_) { SASSERT(_x_); }
|
||||
inline void lp_unreachable() { lp_assert(false); }
|
||||
template <typename X> inline X zero_of_type() { return numeric_traits<X>::zero(); }
|
||||
template <typename X> inline X one_of_type() { return numeric_traits<X>::one(); }
|
||||
template <typename X> inline bool is_zero(const X & v) { return numeric_traits<X>::is_zero(v); }
|
||||
|
|
|
@ -171,7 +171,7 @@ struct solver::imp {
|
|||
lit = m_nlsat->mk_ineq_literal(nlsat::atom::kind::EQ, 1, ps, is_even);
|
||||
break;
|
||||
default:
|
||||
lp_assert(false); // unreachable
|
||||
UNREACHABLE(); // unreachable
|
||||
}
|
||||
m_nlsat->mk_clause(1, &lit, a);
|
||||
}
|
||||
|
|
|
@ -107,8 +107,8 @@ public:
|
|||
template <typename X, typename Y>
|
||||
struct convert_struct {
|
||||
static X convert(const Y & y){ return X(y);}
|
||||
static bool below_bound_numeric(const X &, const X &, const Y &) { /*lp_unreachable();*/ return false;}
|
||||
static bool above_bound_numeric(const X &, const X &, const Y &) { /*lp_unreachable();*/ return false; }
|
||||
static bool below_bound_numeric(const X &, const X &, const Y &) { /*UNREACHABLE();*/ return false;}
|
||||
static bool above_bound_numeric(const X &, const X &, const Y &) { /*UNREACHABLE();*/ return false; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -190,7 +190,7 @@ struct numeric_pair {
|
|||
}
|
||||
|
||||
numeric_pair operator/(const numeric_pair &) const {
|
||||
// lp_unreachable();
|
||||
// UNREACHABLE();
|
||||
}
|
||||
|
||||
|
||||
|
@ -199,7 +199,7 @@ struct numeric_pair {
|
|||
}
|
||||
|
||||
numeric_pair operator*(const numeric_pair & /*a*/) const {
|
||||
// lp_unreachable();
|
||||
// UNREACHABLE();
|
||||
}
|
||||
|
||||
numeric_pair& operator+=(const numeric_pair & a) {
|
||||
|
@ -275,14 +275,14 @@ numeric_pair<T> operator/(const numeric_pair<T> & r, const X & a) {
|
|||
return numeric_pair<T>(r.x / a, r.y / a);
|
||||
}
|
||||
|
||||
template <typename T> double get_double(const lp::numeric_pair<T> & ) { /* lp_unreachable(); */ return 0;}
|
||||
template <typename T> double get_double(const lp::numeric_pair<T> & ) { /* UNREACHABLE(); */ return 0;}
|
||||
template <typename T>
|
||||
class numeric_traits<lp::numeric_pair<T>> {
|
||||
public:
|
||||
static lp::numeric_pair<T> zero() { return lp::numeric_pair<T>(numeric_traits<T>::zero(), numeric_traits<T>::zero()); }
|
||||
static bool is_zero(const lp::numeric_pair<T> & v) { return numeric_traits<T>::is_zero(v.x) && numeric_traits<T>::is_zero(v.y); }
|
||||
static double get_double(const lp::numeric_pair<T> & v){ return numeric_traits<T>::get_double(v.x); } // just return the double of the first coordinate
|
||||
static double one() { /*lp_unreachable();*/ return 0;}
|
||||
static double one() { /*UNREACHABLE();*/ return 0;}
|
||||
static bool is_pos(const numeric_pair<T> &p) {
|
||||
return numeric_traits<T>::is_pos(p.x) ||
|
||||
(numeric_traits<T>::is_zero(p.x) && numeric_traits<T>::is_pos(p.y));
|
||||
|
|
|
@ -31,7 +31,6 @@ template std::set<std::pair<unsigned, unsigned>> lp::static_matrix<lp::mpq, lp::
|
|||
template void static_matrix<mpq, mpq>::add_column_to_vector(mpq const&, unsigned int, mpq*) const;
|
||||
template void static_matrix<mpq, mpq>::add_columns_at_the_end(unsigned int);
|
||||
template bool static_matrix<mpq, mpq>::is_correct() const;
|
||||
template void static_matrix<mpq, mpq>::copy_column_to_indexed_vector(unsigned int, indexed_vector<mpq>&) const;
|
||||
|
||||
template mpq static_matrix<mpq, mpq>::get_balance() const;
|
||||
template mpq static_matrix<mpq, mpq>::get_elem(unsigned int, unsigned int) const;
|
||||
|
@ -47,7 +46,6 @@ template static_matrix<mpq, mpq>::static_matrix(unsigned int, unsigned int);
|
|||
#ifdef Z3DEBUG
|
||||
template bool static_matrix<mpq, numeric_pair<mpq> >::is_correct() const;
|
||||
#endif
|
||||
template void static_matrix<mpq, numeric_pair<mpq> >::copy_column_to_indexed_vector(unsigned int, indexed_vector<mpq>&) const;
|
||||
template mpq static_matrix<mpq, numeric_pair<mpq> >::get_elem(unsigned int, unsigned int) const;
|
||||
template void static_matrix<mpq, numeric_pair<mpq> >::init_empty_matrix(unsigned int, unsigned int);
|
||||
template void static_matrix<mpq, numeric_pair<mpq> >::set(unsigned int, unsigned int, mpq const&);
|
||||
|
|
|
@ -168,8 +168,6 @@ public:
|
|||
|
||||
std::set<std::pair<unsigned, unsigned>> get_domain();
|
||||
|
||||
void copy_column_to_indexed_vector(unsigned j, indexed_vector<T> & v) const;
|
||||
|
||||
T get_max_abs_in_row(unsigned row) const;
|
||||
void add_column_to_vector (const T & a, unsigned j, T * v) const {
|
||||
for (const auto & it : m_columns[j]) {
|
||||
|
@ -222,7 +220,7 @@ public:
|
|||
virtual void set_number_of_columns(unsigned /*n*/) { }
|
||||
#endif
|
||||
|
||||
T get_max_val_in_row(unsigned /* i */) const { lp_unreachable(); }
|
||||
T get_max_val_in_row(unsigned /* i */) const { UNREACHABLE(); }
|
||||
|
||||
T get_balance() const;
|
||||
|
||||
|
|
|
@ -174,14 +174,6 @@ std::set<std::pair<unsigned, unsigned>> static_matrix<T, X>::get_domain() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
template <typename T, typename X> void static_matrix<T, X>::copy_column_to_indexed_vector (unsigned j, indexed_vector<T> & v) const {
|
||||
lp_assert(j < m_columns.size());
|
||||
for (auto & it : m_columns[j]) {
|
||||
const T& val = get_val(it);
|
||||
if (!is_zero(val))
|
||||
v.set_value(val, it.var());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename X> T static_matrix<T, X>::get_max_abs_in_row(unsigned row) const {
|
||||
T ret = numeric_traits<T>::zero();
|
||||
|
|
|
@ -130,7 +130,7 @@ struct gomory_test {
|
|||
|
||||
|
||||
void report_conflict_from_gomory_cut(mpq &k) {
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void adjust_term_and_k_for_some_ints_case_gomory(lar_term& t, mpq& k, mpq &lcm_den) {
|
||||
|
|
|
@ -1365,7 +1365,7 @@ void test_gomory_cut_0() {
|
|||
if (j == 2)
|
||||
return zero_of_type<mpq>();
|
||||
if (j == 3) return mpq(3);
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return zero_of_type<mpq>();
|
||||
},
|
||||
[](unsigned j) { // at_low_p
|
||||
|
@ -1375,7 +1375,7 @@ void test_gomory_cut_0() {
|
|||
return true;
|
||||
if (j == 3)
|
||||
return true;
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
},
|
||||
[](unsigned j) { // at_upper
|
||||
|
@ -1385,31 +1385,31 @@ void test_gomory_cut_0() {
|
|||
return true;
|
||||
if (j == 3)
|
||||
return false;
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
},
|
||||
[](unsigned j) { // lower_bound
|
||||
if (j == 1) {
|
||||
lp_assert(false); //unlimited from below
|
||||
UNREACHABLE(); //unlimited from below
|
||||
return impq(0);
|
||||
}
|
||||
if (j == 2)
|
||||
return impq(0);
|
||||
if (j == 3)
|
||||
return impq(3);
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return impq(0);
|
||||
},
|
||||
[](unsigned j) { // upper
|
||||
if (j == 1) {
|
||||
lp_assert(false); //unlimited from above
|
||||
UNREACHABLE(); //unlimited from above
|
||||
return impq(0);
|
||||
}
|
||||
if (j == 2)
|
||||
return impq(0);
|
||||
if (j == 3)
|
||||
return impq(10);
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return impq(0);
|
||||
},
|
||||
[] (unsigned) { return 0; },
|
||||
|
@ -1437,7 +1437,7 @@ void test_gomory_cut_1() {
|
|||
return mpq(4363334, 2730001);
|
||||
if (j == 3)
|
||||
return mpq(1);
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return zero_of_type<mpq>();
|
||||
},
|
||||
[](unsigned j) { // at_low_p
|
||||
|
@ -1447,7 +1447,7 @@ void test_gomory_cut_1() {
|
|||
return false;
|
||||
if (j == 3)
|
||||
return true;
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
},
|
||||
[](unsigned j) { // at_upper
|
||||
|
@ -1457,19 +1457,19 @@ void test_gomory_cut_1() {
|
|||
return false;
|
||||
if (j == 3)
|
||||
return true;
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
},
|
||||
[](unsigned j) { // lower_bound
|
||||
if (j == 1) {
|
||||
lp_assert(false); //unlimited from below
|
||||
UNREACHABLE(); //unlimited from below
|
||||
return impq(0);
|
||||
}
|
||||
if (j == 2)
|
||||
return impq(1);
|
||||
if (j == 3)
|
||||
return impq(1);
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return impq(0);
|
||||
},
|
||||
[](unsigned j) { // upper
|
||||
|
@ -1480,7 +1480,7 @@ void test_gomory_cut_1() {
|
|||
return impq(3333);
|
||||
if (j == 3)
|
||||
return impq(10000);
|
||||
lp_assert(false);
|
||||
UNREACHABLE();
|
||||
return impq(0);
|
||||
},
|
||||
[] (unsigned) { return 0; },
|
||||
|
|
|
@ -272,7 +272,7 @@ namespace lp {
|
|||
} else if (el.m_head == "+") {
|
||||
add_sum(c, el.m_elems);
|
||||
} else {
|
||||
lp_assert(false); // unexpected input
|
||||
UNREACHABLE(); // unexpected input
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue