3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 11:55:51 +00:00
z3/src/util/lp/column_namer.h
Lev Nachmanson c04bcb411d no calling cut_solver when there are bounded columns
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

use special bounds inf find_cube for x+y, x-y

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

bug fixes in column patching, add stats to patching, restructure int_solver

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

comment out m_old_values from int_solver

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

avoid calling pivot_fixed_vars_from_basis() in int_solver

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

fix the return value from path_nbasic_columns

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

fix the return value from path_nbasic_columns

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

work in patch_columns

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

work on int_solver check()

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

exit from find_free_interval() when l >= u

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

experiment with branching on nbasic columns

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

remove m_old_values

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

add rounding to patch_columns

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

qflia

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

patch all columns, round non-patched, branch or basic columns

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

refactor int_solver::check()

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

restore  move_non_basic_columns_to_bounds() after a failure in find_cube()

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

optimize gomory cuts search

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

produce gomory cuts without moving columns to bounds

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

call find_feasible_solution() after moving columns

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

alway move colums to bounds before gomory cut

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

merge from best branch

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
2018-06-27 11:38:40 -07:00

109 lines
2.9 KiB
C++

#pragma once
/*++
Copyright (c) 2017 Microsoft Corporation
Module Name:
<name>
Abstract:
<abstract>
Author:
Lev Nachmanson (levnach)
Revision History:
--*/
#include <string>
#include "util/lp/static_matrix.h"
namespace lp {
class column_namer {
public:
virtual std::string get_column_name(unsigned j) const = 0;
template <typename T>
void print_row(const row_strip<T> & row, std::ostream & out) const {
vector<std::pair<T, unsigned>> coeff;
for (auto & p : row) {
coeff.push_back(std::make_pair(p.coeff(), p.var()));
}
print_linear_combination_of_column_indices(coeff, out);
}
template <typename T>
void print_linear_combination_of_column_indices_only(const vector<std::pair<T, unsigned>> & coeffs, std::ostream & out) const {
bool first = true;
for (const auto & it : coeffs) {
auto val = it.first;
if (first) {
first = false;
} else {
if (numeric_traits<T>::is_pos(val)) {
out << " + ";
} else {
out << " - ";
val = -val;
}
}
if (val == -numeric_traits<T>::one())
out << " - ";
else if (val != numeric_traits<T>::one())
out << T_to_string(val);
out << "v" << it.second;
}
}
template <typename T>
void print_linear_combination_of_column_indices_std(const vector<std::pair<T, unsigned>> & coeffs, std::ostream & out) const {
bool first = true;
for (const auto & it : coeffs) {
auto val = it.first;
if (first) {
first = false;
} else {
if (numeric_traits<T>::is_pos(val)) {
out << " + ";
} else {
out << " - ";
val = -val;
}
}
if (val == -numeric_traits<T>::one())
out << " - ";
else if (val != numeric_traits<T>::one())
out << val;
out << get_column_name(it.second);
}
}
template <typename T>
void print_linear_combination_of_column_indices(const vector<std::pair<T, unsigned>> & coeffs, std::ostream & out) const {
bool first = true;
for (const auto & it : coeffs) {
auto val = it.first;
if (first) {
first = false;
} else {
if (numeric_traits<T>::is_pos(val)) {
out << " + ";
} else {
out << " - ";
val = -val;
}
}
if (val == -numeric_traits<T>::one())
out << " - ";
else if (val != numeric_traits<T>::one())
out << val;
out << get_column_name(it.second);
}
}
};
}