Skip to content

Commit f2449df

Browse files
committed
introduce ul_pair associated_with_row
Signed-off-by: Lev Nachmanson <[email protected]>
1 parent d20259b commit f2449df

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

src/math/lp/lar_solver.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ void lar_solver::pop() {
13651365
}
13661366

13671367
bool lar_solver::column_represents_row_in_tableau(unsigned j) {
1368-
return m_columns_to_ul_pairs()[j].m_i != UINT_MAX;
1368+
return m_columns_to_ul_pairs()[j].associated_with_row();
13691369
}
13701370

13711371
void lar_solver::make_sure_that_the_bottom_right_elem_not_zero_in_tableau(unsigned i, unsigned j) {
@@ -1602,7 +1602,7 @@ var_index lar_solver::add_var(unsigned ext_j, bool is_int) {
16021602
return local_j;
16031603
lp_assert(m_columns_to_ul_pairs.size() == A_r().column_count());
16041604
local_j = A_r().column_count();
1605-
m_columns_to_ul_pairs.push_back(ul_pair(UINT_MAX));
1605+
m_columns_to_ul_pairs.push_back(ul_pair(false)); // not associated with a row
16061606
while (m_usage_in_terms.size() <= ext_j) {
16071607
m_usage_in_terms.push_back(0);
16081608
}
@@ -1628,7 +1628,7 @@ void lar_solver::add_non_basic_var_to_core_fields(unsigned ext_j, bool is_int) {
16281628
register_new_ext_var_index(ext_j, is_int);
16291629
m_mpq_lar_core_solver.m_column_types.push_back(column_type::free_column);
16301630
m_columns_with_changed_bound.increase_size_by_one();
1631-
add_new_var_to_core_fields_for_mpq(false);
1631+
add_new_var_to_core_fields_for_mpq(false); // false for not adding a row
16321632
if (use_lu())
16331633
add_new_var_to_core_fields_for_doubles(false);
16341634
}
@@ -1759,7 +1759,7 @@ void lar_solver::add_row_from_term_no_constraint(const lar_term * term, unsigned
17591759
register_new_ext_var_index(term_ext_index, term_is_int(term));
17601760
// j will be a new variable
17611761
unsigned j = A_r().column_count();
1762-
ul_pair ul(j);
1762+
ul_pair ul(true); // to mark this column as associated_with_row
17631763
m_columns_to_ul_pairs.push_back(ul);
17641764
add_basic_var_to_core_fields();
17651765
if (use_tableau()) {

src/math/lp/ul_pair.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,32 +50,37 @@ inline bool compare(const std::pair<mpq, var_index> & a, const std::pair<mpq, va
5050
class ul_pair {
5151
constraint_index m_lower_bound_witness;
5252
constraint_index m_upper_bound_witness;
53+
bool m_associated_with_row;
5354
public:
5455
constraint_index& lower_bound_witness() {return m_lower_bound_witness;}
5556
constraint_index lower_bound_witness() const {return m_lower_bound_witness;}
5657
constraint_index& upper_bound_witness() { return m_upper_bound_witness;}
5758
constraint_index upper_bound_witness() const {return m_upper_bound_witness;}
58-
row_index m_i;
5959
bool operator!=(const ul_pair & p) const {
6060
return !(*this == p);
6161
}
6262

6363
bool operator==(const ul_pair & p) const {
6464
return m_lower_bound_witness == p.m_lower_bound_witness
6565
&& m_upper_bound_witness == p.m_upper_bound_witness &&
66-
m_i == p.m_i;
66+
m_associated_with_row == p.m_associated_with_row;
6767
}
6868
// empty constructor
6969
ul_pair() :
70-
m_lower_bound_witness(static_cast<constraint_index>(-1)),
71-
m_upper_bound_witness(static_cast<constraint_index>(-1)),
72-
m_i(static_cast<row_index>(-1))
73-
{}
74-
ul_pair(row_index ri) :
75-
m_lower_bound_witness(static_cast<constraint_index>(-1)),
76-
m_upper_bound_witness(static_cast<constraint_index>(-1)),
77-
m_i(ri) {}
78-
ul_pair(const ul_pair & o): m_lower_bound_witness(o.m_lower_bound_witness), m_upper_bound_witness(o.m_upper_bound_witness), m_i(o.m_i) {}
70+
m_lower_bound_witness(UINT_MAX),
71+
m_upper_bound_witness(UINT_MAX),
72+
m_associated_with_row(false) {}
73+
74+
ul_pair(bool associated_with_row) :
75+
m_lower_bound_witness(UINT_MAX),
76+
m_upper_bound_witness(UINT_MAX),
77+
m_associated_with_row(associated_with_row) {}
78+
79+
ul_pair(const ul_pair & o):
80+
m_lower_bound_witness(o.m_lower_bound_witness),
81+
m_upper_bound_witness(o.m_upper_bound_witness),
82+
m_associated_with_row(o.m_associated_with_row) {}
83+
bool associated_with_row() const { return m_associated_with_row; }
7984
};
8085

8186
}

src/smt/params/smt_params_helper.pyg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def_module_params(module_name='smt',
4141
('bv.reflect', BOOL, True, 'create enode for every bit-vector term'),
4242
('bv.enable_int2bv', BOOL, True, 'enable support for int2bv and bv2int operators'),
4343
('arith.random_initial_value', BOOL, False, 'use random initial values in the simplex-based procedure for linear arithmetic'),
44-
('arith.solver', UINT, 2, 'arithmetic solver: 0 - no solver, 1 - bellman-ford based solver (diff. logic only), 2 - simplex based solver, 3 - floyd-warshall based solver (diff. logic only) and no theory combination 4 - utvpi, 5 - infinitary lra, 6 - lra solver'),
44+
('arith.solver', UINT, 6, 'arithmetic solver: 0 - no solver, 1 - bellman-ford based solver (diff. logic only), 2 - simplex based solver, 3 - floyd-warshall based solver (diff. logic only) and no theory combination 4 - utvpi, 5 - infinitary lra, 6 - lra solver'),
4545
('arith.nl', BOOL, True, '(incomplete) nonlinear arithmetic support based on Groebner basis and interval propagation, relevant only if smt.arith.solver=2'),
4646
('arith.nl.gb', BOOL, True, 'groebner Basis computation, this option is ignored when arith.nl=false, relevant only if smt.arith.solver=2'),
4747
('arith.nl.branching', BOOL, True, 'branching on integer variables in non linear clusters, relevant only if smt.arith.solver=2'),

0 commit comments

Comments
 (0)