mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 13:28:47 +00:00
better diagnostics in lar_solver and more efficient int_set::resize()
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
50db22b2b2
commit
e2538afd32
|
@ -63,11 +63,17 @@ public:
|
|||
|
||||
void resize(unsigned size) {
|
||||
if (size < data_size()) {
|
||||
bool copy = false;
|
||||
unsigned i = 0;
|
||||
for (unsigned j : m_index) {
|
||||
if (j < size) {
|
||||
m_data[j] = i;
|
||||
m_index[i++] = j;
|
||||
if (copy) {
|
||||
m_data[j] = i;
|
||||
m_index[i] = j;
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
copy = true;
|
||||
}
|
||||
}
|
||||
m_index.shrink(i);
|
||||
|
|
|
@ -443,7 +443,6 @@ void lar_solver::set_costs_to_zero(const lar_term& term) {
|
|||
|
||||
void lar_solver::prepare_costs_for_r_solver(const lar_term & term) {
|
||||
TRACE("lar_solver", print_term(term, tout << "prepare: ") << "\n";);
|
||||
m_basic_columns_with_changed_cost.clear();
|
||||
m_basic_columns_with_changed_cost.resize(m_mpq_lar_core_solver.m_r_x.size());
|
||||
if (move_non_basic_columns_to_bounds())
|
||||
find_feasible_solution();
|
||||
|
@ -1198,6 +1197,7 @@ void lar_solver::get_infeasibility_explanation_for_inf_sign(
|
|||
|
||||
// (x, y) != (x', y') => (x + delta*y) != (x' + delta*y')
|
||||
void lar_solver::get_model(std::unordered_map<var_index, mpq> & variable_values) const {
|
||||
lp_assert(get_status() == lp_status::OPTIMAL || get_status() == lp_status::FEASIBLE);
|
||||
lp_assert(m_mpq_lar_core_solver.m_r_solver.calc_current_x_is_feasible_include_non_basis());
|
||||
variable_values.clear();
|
||||
mpq delta = m_mpq_lar_core_solver.find_delta_for_strict_bounds(mpq(1, 2)); // start from 0.5 to have less clashes
|
||||
|
|
Loading…
Reference in a new issue