3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 11:25:51 +00:00

work on Gomory cut

Signed-off-by: Lev <levnach@hotmail.com>
This commit is contained in:
Lev 2018-09-18 13:34:05 -07:00
parent 5bbe0508e4
commit ca3ce964ce
6 changed files with 160 additions and 47 deletions

View file

@ -50,11 +50,34 @@ bool contains(const std::unordered_map<A, B> & map, const A& key) {
namespace lp {
inline void throw_exception(std::string && str) {
throw default_exception(std::move(str));
template <typename T>
void print_linear_combination_of_column_indices_only(const T & coeffs, std::ostream & out) {
bool first = true;
for (const auto & it : coeffs) {
auto val = it.coeff();
if (first) {
first = false;
} else {
if (val.is_pos()) {
out << " + ";
} else {
out << " - ";
val = -val;
}
}
if (val == 1)
out << " ";
else
out << T_to_string(val);
out << "x" << it.var();
}
typedef z3_exception exception;
}
inline void throw_exception(std::string && str) {
throw default_exception(std::move(str));
}
typedef z3_exception exception;
#define lp_assert(_x_) { SASSERT(_x_); }
inline void lp_unreachable() { lp_assert(false); }