3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-16 07:45:27 +00:00

fix a bug in the lar_solver::m_status update during push/pop

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

progress in gomory cut

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

the first version of Gomory cut, probably broken

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

rename a function

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

gomory cut worked on a toy example

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

track the set of integer variables that are not set to integer values

Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
This commit is contained in:
Lev Nachmanson 2017-07-10 16:34:23 -07:00 committed by Lev Nachmanson
parent 0164ea9abb
commit aba7dcab3e
21 changed files with 682 additions and 455 deletions

View file

@ -25,7 +25,7 @@ struct lar_term {
std::unordered_map<unsigned, mpq> m_coeffs;
mpq m_v;
lar_term() {}
void add_to_map(unsigned j, const mpq& c) {
void add_monoid(const mpq& c, unsigned j) {
auto it = m_coeffs.find(j);
if (it == m_coeffs.end()) {
m_coeffs.emplace(j, c);
@ -49,7 +49,7 @@ struct lar_term {
lar_term(const vector<std::pair<mpq, unsigned>>& coeffs,
const mpq & v) : m_v(v) {
for (const auto & p : coeffs) {
add_to_map(p.second, p.first);
add_monoid(p.first, p.second);
}
}
bool operator==(const lar_term & a) const { return false; } // take care not to create identical terms
@ -71,7 +71,7 @@ struct lar_term {
if (it == m_coeffs.end()) return;
const mpq & b = it->second;
for (unsigned it_j :li.m_index) {
add_to_map(it_j, - b * li.m_data[it_j]);
add_monoid(- b * li.m_data[it_j], it_j);
}
m_coeffs.erase(it);
}
@ -79,5 +79,16 @@ struct lar_term {
bool contains(unsigned j) const {
return m_coeffs.find(j) != m_coeffs.end();
}
void negate() {
for (auto & t : m_coeffs)
t.second.neg();
}
void clear() {
m_coeffs.clear();
m_v = zero_of_type<mpq>();
}
};
}