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

Refactor pivot rules

This commit is contained in:
Anh-Dung Phan 2013-11-21 19:05:17 -08:00
parent 97dfb6d521
commit 3b2dd47cd4
5 changed files with 47 additions and 29 deletions

View file

@ -170,18 +170,21 @@ namespace smt {
// FIXME: should declare pivot as a pivot_rule_impl and refactor
template<typename Ext>
bool network_flow<Ext>::choose_entering_edge(pivot_rule pr) {
if (pr == FIRST_ELIGIBLE) {
first_eligible_pivot pivot(m_graph, m_potentials, m_states, m_enter_id);
return pivot.choose_entering_edge();
pivot_rule_impl * pivot;
switch (pr) {
case FIRST_ELIGIBLE:
pivot = alloc(first_eligible_pivot, m_graph, m_potentials, m_states, m_enter_id);
break;
case BEST_ELIGIBLE:
pivot = alloc(best_eligible_pivot, m_graph, m_potentials, m_states, m_enter_id);
break;
case CANDIDATE_LIST:
pivot = alloc(best_eligible_pivot, m_graph, m_potentials, m_states, m_enter_id);
break;
default:
UNREACHABLE();
}
else if (pr == BEST_ELIGIBLE) {
best_eligible_pivot pivot(m_graph, m_potentials, m_states, m_enter_id);
return pivot.choose_entering_edge();
}
else {
candidate_list_pivot pivot(m_graph, m_potentials, m_states, m_enter_id);
return pivot.choose_entering_edge();
}
return pivot->choose_entering_edge();
}
// Minimize cost flows