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
Julian Scherzer
psco-2019-gp
Commits
1921e455
Commit
1921e455
authored
5 years ago
by
p-hamann
Browse files
Options
Downloads
Patches
Plain Diff
Fix memory leaks
parent
fa1c1706
Branches
Branches containing commit
1 merge request
!7
Incremental bfs
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bnb/bnb.cpp
+4
-7
4 additions, 7 deletions
bnb/bnb.cpp
bnb/main.cpp
+7
-6
7 additions, 6 deletions
bnb/main.cpp
include/gp-bnb/bnb.hpp
+1
-1
1 addition, 1 deletion
include/gp-bnb/bnb.hpp
with
12 additions
and
14 deletions
bnb/bnb.cpp
+
4
−
7
View file @
1921e455
...
...
@@ -25,7 +25,7 @@ void trail_state::pop() {
// solver implementation.
// --------------------------------------------------------------------------------------
solver
::
solver
(
graph
&
g
,
lb
lb_algorithm
)
:
graph_
(
g
),
partition_
(
partition
{
g
}),
lb_algorithm_
(
lb_algorithm
)
{
solver
::
solver
(
graph
&
g
,
lb
lb_algorithm
)
:
graph_
(
g
),
partition_
(
partition
{
g
}),
lb_algorithm_
(
lb_algorithm
)
,
i_bfs_
(
incremental_bfs
(
g
))
{
}
unsigned
int
solver
::
get_lower
(){
...
...
@@ -48,12 +48,9 @@ unsigned int solver::get_lower(){
return
ek
.
get_max_flow
();
}
else
if
(
lb_algorithm_
==
lb
::
ibfs
){
if
(
i_bfs_
==
nullptr
)
{
i_bfs_
=
new
incremental_bfs
(
graph_
);
}
i_bfs_
->
reset
(
sources
,
sinks
);
i_bfs_
->
run
();
return
i_bfs_
->
get_max_flow
();
i_bfs_
.
reset
(
sources
,
sinks
);
i_bfs_
.
run
();
return
i_bfs_
.
get_max_flow
();
}
else
if
(
lb_algorithm_
==
lb
::
pr
){
auto
pr
=
push_relabel
(
graph_
,
sources
,
sinks
);
...
...
This diff is collapsed.
Click to expand it.
bnb/main.cpp
+
7
−
6
View file @
1921e455
...
...
@@ -17,28 +17,29 @@ int main(int argc, char** argv) {
std
::
cerr
<<
"Number of nodes: "
<<
g
.
num_nodes
()
<<
std
::
endl
;
auto
sol
=
gp_bnb
::
solver
(
g
,
gp_bnb
::
lb
::
none
);
std
::
string
current_option
;
gp_bnb
::
lb
lb_algo
=
gp_bnb
::
lb
::
none
;
for
(
int
i
=
2
;
i
<
argc
;
++
i
)
{
if
(
i
%
2
==
0
)
{
current_option
=
args
[
i
];
}
else
{
if
(
current_option
==
"-l"
)
{
if
(
args
[
i
]
==
"ek"
)
{
sol
=
gp_bnb
::
solver
(
g
,
gp_bnb
::
lb
::
ek
)
;
lb_algo
=
gp_bnb
::
lb
::
ek
;
}
else
if
(
args
[
i
]
==
"ibfs"
)
{
sol
=
gp_bnb
::
solver
(
g
,
gp_bnb
::
lb
::
ibfs
)
;
lb_algo
=
gp_bnb
::
lb
::
ibfs
;
}
else
if
(
args
[
i
]
==
"pr"
)
{
sol
=
gp_bnb
::
solver
(
g
,
gp_bnb
::
lb
::
pr
)
;
lb_algo
=
gp_bnb
::
lb
::
pr
;
}
else
if
(
args
[
i
]
==
"gp"
)
{
sol
=
gp_bnb
::
solver
(
g
,
gp_bnb
::
lb
::
gp
)
;
lb_algo
=
gp_bnb
::
lb
::
gp
;
}
}
}
}
auto
sol
=
gp_bnb
::
solver
(
g
,
lb_algo
);
sol
.
solve
();
/*
...
...
This diff is collapsed.
Click to expand it.
include/gp-bnb/bnb.hpp
+
1
−
1
View file @
1921e455
...
...
@@ -88,7 +88,7 @@ private:
trail_state
trail_
;
lb
lb_algorithm_
;
incremental_bfs
*
i_bfs_
=
nullptr
;
incremental_bfs
i_bfs_
;
// Value of best solution seen so far.
std
::
vector
<
subgraph
>
best_solution_
;
...
...
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