mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 20:05:51 +00:00
replace lean to lp
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
This commit is contained in:
parent
db0a3f4358
commit
d41c65a4f9
72 changed files with 1334 additions and 1213 deletions
|
@ -76,7 +76,7 @@ template <typename T, typename X> void lp_primal_simplex<T, X>::fill_costs_and_x
|
|||
int row,
|
||||
unsigned & slack_var,
|
||||
unsigned & artificial) {
|
||||
SASSERT(row >= 0 && row < this->row_count());
|
||||
lp_assert(row >= 0 && row < this->row_count());
|
||||
auto & constraint = this->m_constraints[this->m_core_solver_rows_to_external_rows[row]];
|
||||
// we need to bring the program to the form Ax = b
|
||||
T rs = this->m_b[row];
|
||||
|
@ -101,7 +101,7 @@ template <typename T, typename X> void lp_primal_simplex<T, X>::fill_costs_and_x
|
|||
(*this->m_A)(row, slack_var) = - numeric_traits<T>::one();
|
||||
|
||||
if (rs > 0) {
|
||||
SASSERT(numeric_traits<T>::is_zero(this->m_x[slack_var]));
|
||||
lp_assert(numeric_traits<T>::is_zero(this->m_x[slack_var]));
|
||||
// adding one artificial
|
||||
this->m_column_types[artificial] = column_type::low_bound;
|
||||
(*this->m_A)(row, artificial) = numeric_traits<T>::one();
|
||||
|
@ -123,7 +123,7 @@ template <typename T, typename X> void lp_primal_simplex<T, X>::fill_costs_and_x
|
|||
|
||||
if (rs < 0) {
|
||||
// adding one artificial
|
||||
SASSERT(numeric_traits<T>::is_zero(this->m_x[slack_var]));
|
||||
lp_assert(numeric_traits<T>::is_zero(this->m_x[slack_var]));
|
||||
this->m_column_types[artificial] = column_type::low_bound;
|
||||
(*this->m_A)(row, artificial) = - numeric_traits<T>::one();
|
||||
this->m_costs[artificial] = artificial_cost;
|
||||
|
@ -172,7 +172,7 @@ template <typename T, typename X> void lp_primal_simplex<T, X>::find_maximal_sol
|
|||
return;
|
||||
}
|
||||
|
||||
this->cleanup();
|
||||
this->clpup();
|
||||
this->fill_matrix_A_and_init_right_side();
|
||||
if (this->m_status == lp_status::INFEASIBLE) {
|
||||
return;
|
||||
|
@ -192,12 +192,12 @@ template <typename T, typename X> void lp_primal_simplex<T, X>::fill_A_x_and_bas
|
|||
}
|
||||
|
||||
template <typename T, typename X> void lp_primal_simplex<T, X>::fill_A_x_and_basis_for_stage_one_total_inf_for_row(unsigned row) {
|
||||
SASSERT(row < this->row_count());
|
||||
lp_assert(row < this->row_count());
|
||||
auto ext_row_it = this->m_core_solver_rows_to_external_rows.find(row);
|
||||
SASSERT(ext_row_it != this->m_core_solver_rows_to_external_rows.end());
|
||||
lp_assert(ext_row_it != this->m_core_solver_rows_to_external_rows.end());
|
||||
unsigned ext_row = ext_row_it->second;
|
||||
auto constr_it = this->m_constraints.find(ext_row);
|
||||
SASSERT(constr_it != this->m_constraints.end());
|
||||
lp_assert(constr_it != this->m_constraints.end());
|
||||
auto & constraint = constr_it->second;
|
||||
unsigned j = this->m_A->column_count(); // j is a slack variable
|
||||
this->m_A->add_column();
|
||||
|
@ -224,7 +224,7 @@ template <typename T, typename X> void lp_primal_simplex<T, X>::fill_A_x_and_bas
|
|||
this->m_upper_bounds[j] = m_low_bounds[j] = zero_of_type<X>();
|
||||
break;
|
||||
default:
|
||||
SASSERT(false);
|
||||
lp_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,10 +296,10 @@ template <typename T, typename X> T lp_primal_simplex<T, X>::get_row_value(unsig
|
|||
T ret = numeric_traits<T>::zero();
|
||||
for (auto & pair : it->second) {
|
||||
auto cit = this->m_map_from_var_index_to_column_info.find(pair.first);
|
||||
SASSERT(cit != this->m_map_from_var_index_to_column_info.end());
|
||||
lp_assert(cit != this->m_map_from_var_index_to_column_info.end());
|
||||
column_info<T> * ci = cit->second;
|
||||
auto sol_it = solution.find(ci->get_name());
|
||||
SASSERT(sol_it != solution.end());
|
||||
lp_assert(sol_it != solution.end());
|
||||
T column_val = sol_it->second;
|
||||
if (out != nullptr) {
|
||||
(*out) << pair.second << "(" << ci->get_name() << "=" << column_val << ") ";
|
||||
|
@ -344,7 +344,7 @@ template <typename T, typename X> bool lp_primal_simplex<T, X>::row_constraint_h
|
|||
}
|
||||
return true;;
|
||||
}
|
||||
SASSERT(false);
|
||||
lp_unreachable();
|
||||
return false; // it is unreachable
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue