mirror of
https://github.com/Z3Prover/z3
synced 2025-04-13 12:28:44 +00:00
rm lu
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
bfe73c01a6
commit
6132bf93f7
|
@ -61,7 +61,6 @@ template lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::lp_core_s
|
|||
const vector<lp::numeric_pair<lp::mpq> >&,
|
||||
const vector<lp::numeric_pair<lp::mpq> >&);
|
||||
template bool lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::print_statistics_with_cost_and_check_that_the_time_is_over(lp::numeric_pair<lp::mpq>, std::ostream&);
|
||||
template void lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::snap_xN_to_bounds_and_fill_xB();
|
||||
template void lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::solve_Ax_eq_b();
|
||||
|
||||
template void lp::lp_core_solver_base<lp::mpq, lp::numeric_pair<lp::mpq> >::add_delta_to_entering(unsigned int, const lp::numeric_pair<lp::mpq>&);
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
vector<X> & m_x; // a feasible solution, the fist time set in the constructor
|
||||
vector<T> & m_costs;
|
||||
lp_settings & m_settings;
|
||||
lu<static_matrix<T, X>> * m_factorization = nullptr;
|
||||
|
||||
vector<T> m_y; // the buffer for yB = cb
|
||||
// a device that is able to solve Bx=c, xB=d, and change the basis
|
||||
const column_namer & m_column_names;
|
||||
|
@ -134,7 +134,7 @@ public:
|
|||
void init();
|
||||
|
||||
virtual ~lp_core_solver_base() {
|
||||
delete m_factorization;
|
||||
|
||||
}
|
||||
|
||||
vector<unsigned> & non_basis() {
|
||||
|
@ -413,9 +413,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
void snap_non_basic_x_to_bound_and_free_to_zeroes();
|
||||
void snap_xN_to_bounds_and_fill_xB();
|
||||
|
||||
|
||||
non_basic_column_value_position get_non_basic_column_value_position(unsigned j) const;
|
||||
|
||||
|
|
|
@ -554,54 +554,10 @@ find_error_in_BxB(vector<X>& rs){
|
|||
// recalculates the projection of x to B, such that Ax = b
|
||||
template <typename T, typename X> void lp_core_solver_base<T, X>::
|
||||
solve_Ax_eq_b() {
|
||||
if (numeric_traits<X>::precise()) {
|
||||
vector<X> rs(m_m());
|
||||
rs_minus_Anx(rs);
|
||||
m_factorization->solve_By(rs);
|
||||
copy_rs_to_xB(rs);
|
||||
}
|
||||
else {
|
||||
vector<X> rs(m_m());
|
||||
rs_minus_Anx(rs);
|
||||
vector<X> rrs = rs; // another copy of rs
|
||||
m_factorization->solve_By(rs);
|
||||
copy_rs_to_xB(rs);
|
||||
find_error_in_BxB(rrs);
|
||||
m_factorization->solve_By(rrs);
|
||||
add_delta_to_xB(rrs);
|
||||
}
|
||||
lp_assert(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T, typename X> void lp_core_solver_base<T, X>::
|
||||
snap_non_basic_x_to_bound_and_free_to_zeroes() {
|
||||
for (unsigned j : non_basis()) {
|
||||
lp_assert(j < m_x.size());
|
||||
switch (m_column_types[j]) {
|
||||
case column_type::fixed:
|
||||
case column_type::boxed:
|
||||
case column_type::lower_bound:
|
||||
m_x[j] = m_lower_bounds[j];
|
||||
break;
|
||||
case column_type::upper_bound:
|
||||
m_x[j] = m_upper_bounds[j];
|
||||
break;
|
||||
default:
|
||||
m_x[j] = zero_of_type<X>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
template <typename T, typename X> void lp_core_solver_base<T, X>::
|
||||
snap_xN_to_bounds_and_fill_xB() {
|
||||
snap_non_basic_x_to_bound();
|
||||
solve_Ax_eq_b();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename T, typename X> non_basic_column_value_position lp_core_solver_base<T, X>::
|
||||
get_non_basic_column_value_position(unsigned j) const {
|
||||
switch (m_column_types[j]) {
|
||||
|
|
|
@ -642,11 +642,7 @@ template <typename T, typename X> void lp_primal_core_solver<T, X>::init_run(
|
|||
|
||||
|
||||
template <typename T, typename X> void lp_primal_core_solver<T, X>::calc_working_vector_beta_for_column_norms(){
|
||||
lp_assert(numeric_traits<T>::precise() == false);
|
||||
lp_assert(this->m_ed.is_OK());
|
||||
lp_assert(m_beta.is_OK());
|
||||
m_beta = this->m_ed;
|
||||
this->m_factorization->solve_yB_with_error_check_indexed(m_beta, this->m_basis_heading, this->m_basis, this->m_settings);
|
||||
lp_assert(false);
|
||||
}
|
||||
|
||||
template <typename T, typename X>
|
||||
|
@ -758,10 +754,7 @@ template <typename T, typename X> unsigned lp_primal_core_solver<T, X>::solve()
|
|||
}
|
||||
|
||||
template <typename T, typename X> void lp_primal_core_solver<T, X>::delete_factorization() {
|
||||
if (this->m_factorization != nullptr) {
|
||||
delete this->m_factorization;
|
||||
this->m_factorization = nullptr;
|
||||
}
|
||||
lp_assert(false);
|
||||
}
|
||||
|
||||
// according to Swietanowski, " A new steepest edge approximation for the simplex method for linear programming"
|
||||
|
@ -776,15 +769,7 @@ template <typename T, typename X> void lp_primal_core_solver<T, X>::init_column_
|
|||
|
||||
// debug only
|
||||
template <typename T, typename X> T lp_primal_core_solver<T, X>::calculate_column_norm_exactly(unsigned j) {
|
||||
lp_assert(numeric_traits<T>::precise() == false);
|
||||
indexed_vector<T> w(this->m_m());
|
||||
this->m_A.copy_column_to_vector(j, w);
|
||||
vector<T> d(this->m_m());
|
||||
this->m_factorization->solve_Bd_when_w_is_ready(d, w);
|
||||
T ret = zero_of_type<T>();
|
||||
for (auto v : d)
|
||||
ret += v*v;
|
||||
return ret+1;
|
||||
lp_assert(false);
|
||||
}
|
||||
|
||||
template <typename T, typename X> void lp_primal_core_solver<T, X>::update_or_init_column_norms(unsigned entering, unsigned leaving) {
|
||||
|
|
Loading…
Reference in a new issue