mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 19:05:51 +00:00
extract gomory cut functionality in one method
Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work in hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work in hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work in hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work in hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> prepare calculate U in hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> naive algorithm for HNF and m <= n Signed-off-by: Lev Nachmanson <levnach@hotmail.com> naive algorithm for HNF Signed-off-by: Lev Nachmanson <levnach@hotmail.com> introduces reverse matrix into Hermite Normal Form calculation Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on more efficient hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> use smarter templates in lu.h Signed-off-by: Lev Nachmanson <levnach@hotmail.com> the new lu scheme compiles Signed-off-by: Lev Nachmanson <levnach@hotmail.com> simple test passes with the modified lu Signed-off-by: Lev Nachmanson <levnach@hotmail.com> fix the build on windows Signed-off-by: Lev Nachmanson <levnach@hotmail.com> playing with the example from cutting the mix Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf, add extended_gcd_minimal_uv() Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on extended_gcd_minimal_uv Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf, add extended_gcd_minimal_uv() Signed-off-by: Lev Nachmanson <levnach@hotmail.com> more tests and bug fixes in hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf modulo version Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf modulo version, more tests pass Signed-off-by: Lev Nachmanson <levnach@hotmail.com> a rough version of hnf passed the tests Signed-off-by: Lev Nachmanson <levnach@hotmail.com> fix build in release Signed-off-by: Lev Nachmanson <levnach@hotmail.com> fixes in determinant calculations Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> work on hnf Signed-off-by: Lev Nachmanson <levnach@hotmail.com> create a stub for hnf_cuts Signed-off-by: Lev Nachmanson <levnach@hotmail.com> create a stub for hnf_cuts Signed-off-by: Lev Nachmanson <levnach@hotmail.com> create a stub for hnf_cuts Signed-off-by: Lev Nachmanson <levnach@hotmail.com> general_matrix etc. Signed-off-by: Lev Nachmanson <levnach@hotmail.com> general_matrix etc. Signed-off-by: Lev Nachmanson <levnach@hotmail.com> rename cut_solver to chase_cut_solver Signed-off-by: Lev Nachmanson <levnach@hotmail.com> rename cut_solver to chase_cut_solver Signed-off-by: Lev Nachmanson <levnach@hotmail.com> hnf_cutter Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
c04bcb411d
commit
3b5337823a
35 changed files with 2178 additions and 760 deletions
|
@ -8,7 +8,12 @@ Module Name:
|
|||
Abstract:
|
||||
|
||||
<abstract>
|
||||
|
||||
for matrix B we have
|
||||
t0*...*tn-1*B = Q*U*R
|
||||
here ti are matrices corresponding to pivot operations,
|
||||
including columns and rows swaps,
|
||||
or a multiplication matrix row by a number
|
||||
Q, R - permutations and U is an upper triangular matrix
|
||||
Author:
|
||||
|
||||
Lev Nachmanson (levnach)
|
||||
|
@ -24,7 +29,7 @@ Revision History:
|
|||
#include "util/debug.h"
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include "util/lp/sparse_matrix.h"
|
||||
#include "util/lp/square_sparse_matrix.h"
|
||||
#include "util/lp/static_matrix.h"
|
||||
#include <string>
|
||||
#include "util/lp/numeric_pair.h"
|
||||
|
@ -36,13 +41,11 @@ Revision History:
|
|||
namespace lp {
|
||||
#ifdef Z3DEBUG
|
||||
template <typename T, typename X> // print the nr x nc submatrix at the top left corner
|
||||
void print_submatrix(sparse_matrix<T, X> & m, unsigned mr, unsigned nc);
|
||||
void print_submatrix(square_sparse_matrix<T, X> & m, unsigned mr, unsigned nc);
|
||||
|
||||
template<typename T, typename X>
|
||||
void print_matrix(static_matrix<T, X> &m, std::ostream & out);
|
||||
template <typename M>
|
||||
void print_matrix(M &m, std::ostream & out);
|
||||
|
||||
template <typename T, typename X>
|
||||
void print_matrix(sparse_matrix<T, X>& m, std::ostream & out);
|
||||
#endif
|
||||
|
||||
template <typename T, typename X>
|
||||
|
@ -123,17 +126,20 @@ enum class LU_status { OK, Degenerated};
|
|||
|
||||
// This class supports updates of the columns of B, and solves systems Bx=b,and yB=c
|
||||
// Using Suhl-Suhl method described in the dissertation of Achim Koberstein, Chapter 5
|
||||
template <typename T, typename X>
|
||||
template <typename M>
|
||||
class lu {
|
||||
LU_status m_status;
|
||||
public:
|
||||
typedef typename M::coefftype T;
|
||||
typedef typename M::argtype X;
|
||||
|
||||
// the fields
|
||||
unsigned m_dim;
|
||||
static_matrix<T, X> const &m_A;
|
||||
const M & m_A;
|
||||
permutation_matrix<T, X> m_Q;
|
||||
permutation_matrix<T, X> m_R;
|
||||
permutation_matrix<T, X> m_r_wave;
|
||||
sparse_matrix<T, X> m_U;
|
||||
square_sparse_matrix<T, X> m_U;
|
||||
square_dense_submatrix<T, X>* m_dense_LU;
|
||||
|
||||
vector<tail_matrix<T, X> *> m_tail;
|
||||
|
@ -147,10 +153,11 @@ public:
|
|||
// constructor
|
||||
// if A is an m by n matrix then basis has length m and values in [0,n); the values are all different
|
||||
// they represent the set of m columns
|
||||
lu(static_matrix<T, X> const & A,
|
||||
lu(const M & A,
|
||||
vector<unsigned>& basis,
|
||||
lp_settings & settings);
|
||||
void debug_test_of_basis(static_matrix<T, X> const & A, vector<unsigned> & basis);
|
||||
lu(const M & A, lp_settings&);
|
||||
void debug_test_of_basis(const M & A, vector<unsigned> & basis);
|
||||
void solve_Bd_when_w_is_ready(vector<T> & d, indexed_vector<T>& w );
|
||||
void solve_By(indexed_vector<X> & y);
|
||||
|
||||
|
@ -222,7 +229,7 @@ public:
|
|||
|
||||
eta_matrix<T, X> * get_eta_matrix_for_pivot(unsigned j);
|
||||
// we're processing the column j now
|
||||
eta_matrix<T, X> * get_eta_matrix_for_pivot(unsigned j, sparse_matrix<T, X>& copy_of_U);
|
||||
eta_matrix<T, X> * get_eta_matrix_for_pivot(unsigned j, square_sparse_matrix<T, X>& copy_of_U);
|
||||
|
||||
// see page 407 of Chvatal
|
||||
unsigned transform_U_to_V_by_replacing_column(indexed_vector<T> & w, unsigned leaving_column_of_U);
|
||||
|
@ -245,7 +252,7 @@ public:
|
|||
}
|
||||
|
||||
T B_(unsigned i, unsigned j, const vector<unsigned>& basis) {
|
||||
return m_A.get_elem(i, basis[j]);
|
||||
return m_A[i][basis[j]];
|
||||
}
|
||||
|
||||
unsigned dimension() { return m_dim; }
|
||||
|
@ -261,11 +268,13 @@ public:
|
|||
void process_column(int j);
|
||||
|
||||
bool is_correct(const vector<unsigned>& basis);
|
||||
bool is_correct();
|
||||
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
dense_matrix<T, X> tail_product();
|
||||
dense_matrix<T, X> get_left_side(const vector<unsigned>& basis);
|
||||
dense_matrix<T, X> get_left_side();
|
||||
|
||||
dense_matrix<T, X> get_right_side();
|
||||
#endif
|
||||
|
@ -364,11 +373,14 @@ public:
|
|||
|
||||
}; // end of lu
|
||||
|
||||
template <typename T, typename X>
|
||||
void init_factorization(lu<T, X>* & factorization, static_matrix<T, X> & m_A, vector<unsigned> & m_basis, lp_settings &m_settings);
|
||||
template <typename M>
|
||||
void init_factorization(lu<M>* & factorization, M & m_A, vector<unsigned> & m_basis, lp_settings &m_settings);
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
template <typename T, typename X>
|
||||
dense_matrix<T, X> get_B(lu<T, X>& f, const vector<unsigned>& basis);
|
||||
template <typename T, typename X, typename M>
|
||||
dense_matrix<T, X> get_B(lu<M>& f, const vector<unsigned>& basis);
|
||||
|
||||
template <typename T, typename X, typename M>
|
||||
dense_matrix<T, X> get_B(lu<M>& f);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue