3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-07 00:11:55 +00:00
z3/src/util/lp/active_set.h
Lev Nachmanson 2bb94ed4fe remove warnings in scaler and use m_cut_solver_cycle_on_var
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

detect slow propagations

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

fiddle with the stop conditions

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

get rid of constraint->m_predecessors, fix a bug in push/pop with lemmas

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

clean detection of stale lemmas in pop

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

add constraints lazily to cut_solver

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

refactor some of cut_solver classes into include files

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

prepare to index constraint from 0 to to n - 1, where n is the number of constraints

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

prepare for constraint priority

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

use priorities in active_set

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

remove unnecesessary parameters

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

speedup bound propagations

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

restore tactics

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

speedup bound propagation by avoiding some calls to propagate_constraint_only_one_unlim

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

fixes by Nikolaj

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

fix print lp_core_solver

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

work on gomory test, subs terms indices correctly

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

correct const_iterator for lar_term

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

improve static_matrix with iterators

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

make row_strip a struct

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

move row_strip outside of static_matrix

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

add const_iterator to row_strip

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

remove the hierarchy of iterators - use std::iterators

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

adding gcd_test stats and taking care of for iterators

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

restore qflia_tactic.cpp

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

run gcd_test according to settings()

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

experiment with picking a narrow or random branch

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

76 lines
1.8 KiB
C++

/*++
Copyright (c) 2017 Microsoft Corporation
Module Name:
<name>
Abstract:
<abstract>
Author:
Nikolaj Bjorner (nbjorner)
Lev Nachmanson (levnach)
Revision History:
--*/
#pragma once
#include "util/lp/binary_heap_priority_queue.h"
namespace lp {
class active_set {
std::unordered_set<constraint*, constraint_hash, constraint_equal> m_cs;
binary_heap_priority_queue<int> m_q;
std::unordered_map<unsigned, constraint *> m_id_to_constraint;
public:
std::unordered_set<constraint*, constraint_hash, constraint_equal> cs() const { return m_cs;}
bool contains(const constraint* c) const {
return m_id_to_constraint.find(c->id()) != m_id_to_constraint.end();
}
bool is_empty() const { return m_cs.size() == 0; }
// low priority will be dequeued first
void add_constraint(constraint* c, int priority) {
if (contains(c))
return;
m_cs.insert(c);
m_id_to_constraint[c->id()] = c;
m_q.enqueue(c->id(), priority);
}
void clear() {
m_cs.clear();
m_id_to_constraint.clear();
m_q.clear();
}
constraint* remove_constraint() {
if (m_cs.size() == 0)
return nullptr;
unsigned id = m_q.dequeue();
auto it = m_id_to_constraint.find(id);
lp_assert(it != m_id_to_constraint.end());
constraint* c = it->second;
m_cs.erase(c);
m_id_to_constraint.erase(it);
return c;
}
unsigned size() const {
return static_cast<unsigned>(m_cs.size());
}
void remove_constraint(constraint * c) {
if (! contains(c)) return;
m_cs.erase(c);
m_id_to_constraint.erase(c->id());
m_q.remove(c->id());
}
};
}