You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/math/lp/dioph_eq.cpp
+50-64Lines changed: 50 additions & 64 deletions
Original file line number
Diff line number
Diff line change
@@ -16,17 +16,18 @@
16
16
Data structures are:
17
17
-- term_o: inherits lar_term and differs from it by having a constant, while
18
18
lar_term is just a sum of monomials
19
-
-- entry : has a dependency lar_term, keeping the history of the entry
20
-
updates, the rational constant of the corresponding term_o, and the entry
21
-
status that is in {F,S, FRESH}. The entry status is used for efficiency
22
-
reasons. It allows quickly check if an entry belongs to F, S, or neither.
23
-
dioph_eq::imp main fields are
24
19
-- lra: pointer to lar_solver.
25
20
-- lia: point to int_solver.
26
-
-- m_entries: it keeps all "entry" objects.
21
+
-- m_sum_of_fixed: it keeps the contribution of the fixed variables to the row
27
22
-- m_e_matrix: i-th row of this matrix keeps the term corresponding to
28
-
m_entries[i]. The actual term corresponding to m_entry[i] is the sum of the
29
-
matrix i-th row and the constant m_entry[].m_c.
23
+
-- m_l_matrix: the m_l_matrix[i] produces m_e_matrix[i] by using the terms definitions of lar_solver
24
+
-- m_k2s: when the variable k is substituted in the row s of m_e_matrix, the pair (k,s) is added to m_k2s.
25
+
m_k2s is a one to one mapping.
26
+
-- m_fresh_k2xt_terms: when a fresh definitions is created for a variable k, then the triple
27
+
(k,xt,t) is added to m_fresh_k2xt_terms, where xt is the fresh variable, and xt t it the term defining the substitution: something like k - xt + 5z + 6y = 0.
28
+
The set of pairs (k, xt) is a one to one mapping
29
+
m_fresh_definitions[i]: is the list of all xt that were defined for row m_e_matrix[i]
30
+
30
31
The mapping between the columns of lar_solver and m_e_matrix is controlled by m_var_register.
31
32
local_to_lar_solver(lar_solver_to_local(j)) == j. If local_to_lar_solver(j) == -1
32
33
then j is a fresh variable, that is such that got introduced when normalizing a term like 3x-6y + 5z +11 = 0,
@@ -314,14 +315,8 @@ namespace lp {
314
315
return out;
315
316
}
316
317
317
-
// consider to move m_c to an m_e_matrix column
318
-
structentry {
319
-
mpq m_c; // the constant of the term, the term is taken from the row of
320
-
entry(const mpq & c) : m_c(c) {}
321
-
};
322
-
318
+
std_vector<mpq> m_sum_of_fixed;
323
319
var_register m_var_register;
324
-
std_vector<entry> m_entries;
325
320
// the terms are stored in m_A and m_c
326
321
static_matrix<mpq, mpq> m_e_matrix; // the rows of the matrix are the terms,
327
322
static_matrix<mpq, mpq> m_l_matrix; // the rows of the matrix are the l_terms providing the certificate to the entries modulo the constant part: look an entry_invariant that assures that the each two rows are in sync.
c += j_coeff * lra.get_lower_bound(local_to_lar_solver(j)).x;
1640
-
TRACE("dio_br", tout << "the value of the vixed var is:" << lra.get_lower_bound(local_to_lar_solver(j)).x<<", m_entries[" << ei << "].m_c:" << m_entries[ei].m_c << ", new free coeff c:" << c << std::endl;);
1630
+
TRACE("dio_br", tout << "the value of the vixed var is:" << lra.get_lower_bound(local_to_lar_solver(j)).x<<", m_sum_of_fixed[" << ei << "]:" << m_sum_of_fixed[ei] << ", new free coeff c:" << c << std::endl;);
1641
1631
continue;
1642
1632
}
1643
1633
if (g.is_zero()) {
@@ -2003,7 +1993,7 @@ namespace lp {
2003
1993
// a coefficient equal to j_sign which is +-1
2004
1994
voideliminate_var_in_f(unsigned ei, unsigned j, int j_sign) {
2005
1995
SASSERT(belongs_to_s(ei));
2006
-
constauto & e = m_entries[ei];
1996
+
constauto & e = m_sum_of_fixed[ei];
2007
1997
SASSERT(j_sign_is_correct(ei, j, j_sign));
2008
1998
TRACE("dioph_eq", tout << "eliminate var:" << j << " by using:";
0 commit comments