-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing the branching tree file #434
Conversation
Codecov Report
@@ Coverage Diff @@
## master #434 +/- ##
==========================================
- Coverage 80.12% 80.07% -0.05%
==========================================
Files 52 52
Lines 4206 4206
==========================================
- Hits 3370 3368 -2
- Misses 836 838 +2
Continue to review full report at Codecov.
|
src/Algorithm/treesearch.jl
Outdated
@@ -206,13 +206,20 @@ function print_node_in_branching_tree_file(algo::TreeSearchAlgorithm, data::Tree | |||
if algo.branchingtreefile !== nothing | |||
pb = getvalue(get_ip_primal_bound(getoptstate(data))) | |||
db = getvalue(get_ip_dual_bound(getoptstate(node))) | |||
write(algo.branchingtreefile, read(algo.branchingtreefile, String)[1:end-1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to remove the last line from the file? Any better way to do this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Only the last character (a closing brace). I pushed a change to use chop() instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to handle the closing brace in another way than copying (almost) the whole file ?
… branching tree file is removed before updating it
Alternative ? io = open("file", "r+")
seekend(io)
truncate(io, position(io)-1) # assert that position(io) >= 1, remove last character (last byte actually)
write!(io, "something")
close(io) |
Even better, you don't need to truncate, you just seek for position seekend(io)
n = position(io)
seek(io, n-1)
write(io, "something") |
…ritting everything
See the attached file as an example of the generated branching tree.
cvrp2.pdf