mirror of
https://github.com/Z3Prover/z3
synced 2025-06-22 05:43:39 +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
2 changed files with 9 additions and 3 deletions
|
@ -63,11 +63,17 @@ public:
|
||||||
|
|
||||||
void resize(unsigned size) {
|
void resize(unsigned size) {
|
||||||
if (size < data_size()) {
|
if (size < data_size()) {
|
||||||
|
bool copy = false;
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
for (unsigned j : m_index) {
|
for (unsigned j : m_index) {
|
||||||
if (j < size) {
|
if (j < size) {
|
||||||
|
if (copy) {
|
||||||
m_data[j] = i;
|
m_data[j] = i;
|
||||||
m_index[i++] = j;
|
m_index[i] = j;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
copy = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_index.shrink(i);
|
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) {
|
void lar_solver::prepare_costs_for_r_solver(const lar_term & term) {
|
||||||
TRACE("lar_solver", print_term(term, tout << "prepare: ") << "\n";);
|
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());
|
m_basic_columns_with_changed_cost.resize(m_mpq_lar_core_solver.m_r_x.size());
|
||||||
if (move_non_basic_columns_to_bounds())
|
if (move_non_basic_columns_to_bounds())
|
||||||
find_feasible_solution();
|
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')
|
// (x, y) != (x', y') => (x + delta*y) != (x' + delta*y')
|
||||||
void lar_solver::get_model(std::unordered_map<var_index, mpq> & variable_values) const {
|
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());
|
lp_assert(m_mpq_lar_core_solver.m_r_solver.calc_current_x_is_feasible_include_non_basis());
|
||||||
variable_values.clear();
|
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
|
mpq delta = m_mpq_lar_core_solver.find_delta_for_strict_bounds(mpq(1, 2)); // start from 0.5 to have less clashes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue