Skip to content
Snippets Groups Projects
Commit 6d3e2e6f authored by p-hamann's avatar p-hamann
Browse files

Avoid running lb algos without satisfied requirements

parent 12f721e8
Branches
No related merge requests found
......@@ -29,31 +29,28 @@ solver::solver(graph& g, lb lb_algorithm) : graph_(g), partition_(partition{g}),
}
unsigned int solver::get_lower(){
unsigned int lower_bound;
std::vector<node_id> sources, sinks;
for(node_id node = 1; node <= graph_.num_nodes(); node++){
if(partition_.assigned_subgraph_of(node) == partition::sg_a)
sources.push_back(node);
else if(partition_.assigned_subgraph_of(node) == partition::sg_b)
sinks.push_back(node);
}
if (sources.empty() || sinks.empty()) {
return partition_.current_objective();
}
if(lb_algorithm_ == lb::ek){
std::vector<node_id> sources, sinks;
for(node_id node = 1; node <= graph_.num_nodes(); node++){
if(partition_.assigned_subgraph_of(node) == partition::sg_a)
sources.push_back(node);
else if(partition_.assigned_subgraph_of(node) == partition::sg_b)
sinks.push_back(node);
}
auto ek = edmonds_karp(graph_, sources, sinks);
ek.run();
lower_bound = ek.get_max_flow();
return ek.get_max_flow();
}
else if(lb_algorithm_ == lb::ibfs){
std::vector<node_id> sources, sinks;
for(node_id node = 1; node <= graph_.num_nodes(); node++){
if(partition_.assigned_subgraph_of(node) == partition::sg_a)
sources.push_back(node);
else if(partition_.assigned_subgraph_of(node) == partition::sg_b)
sinks.push_back(node);
}
auto i_bfs = incremental_bfs(graph_, sources, sinks);
i_bfs.run();
lower_bound = i_bfs.get_max_flow();
return i_bfs.get_max_flow();
}
else if(lb_algorithm_ == lb::pr){
......@@ -61,11 +58,7 @@ unsigned int solver::get_lower(){
else if(lb_algorithm_ == lb::gp){
}
else{
lower_bound = partition_.current_objective();
}
return lower_bound;
return partition_.current_objective();
}
void solver::solve() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment