Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
psco-2019-gp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Heinrichs
psco-2019-gp
Commits
6d3e2e6f
Commit
6d3e2e6f
authored
5 years ago
by
p-hamann
Browse files
Options
Downloads
Patches
Plain Diff
Avoid running lb algos without satisfied requirements
parent
12f721e8
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bnb/bnb.cpp
+16
-23
16 additions, 23 deletions
bnb/bnb.cpp
with
16 additions
and
23 deletions
bnb/bnb.cpp
+
16
−
23
View file @
6d3e2e6f
...
...
@@ -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
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment