Skip to content
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

number_of_leaves may return -1 but is used in a log function #242

Closed
guimarqu opened this issue Jan 25, 2020 · 1 comment
Closed

number_of_leaves may return -1 but is used in a log function #242

guimarqu opened this issue Jan 25, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@guimarqu
Copy link
Contributor

Describe the bug
The method number_of_leaves (branchinggroup.jl:74) may return -1 but its output is used in a log function without any checking.

See score = - log(number_of_leaves(parent_delta, deltas)) / log(length(deltas)) (branchinggroup.jl:147)

To Reproduce
See the tests of PR #241

@guimarqu guimarqu added the bug Something isn't working label Jan 25, 2020
guimarqu added a commit that referenced this issue Jan 25, 2020
@rrsadykov
Copy link
Collaborator

Can you change branchinggroup.jl:147 to

numleaves = number_of_leaves(parent_delta, deltas)
if numleaves < 0
    score = -Inf
else
    score = - log(numleaves) / log(length(deltas))
end

@rrsadykov rrsadykov assigned guimarqu and unassigned rrsadykov Jan 27, 2020
rrsadykov added a commit that referenced this issue Jan 27, 2020
guimarqu added a commit that referenced this issue Jan 29, 2020
* plug in new matrix

* bug in strong branching issue #242

* rm ColunaDemos for deps

* update version of dynsparsearrays

* missing return kw

* generic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants