KlausVigo / phangorn

Phylogenetic analysis in R
http://klausvigo.github.io/phangorn/
205 stars 38 forks source link

Suggestion/request for bab (branch and bound) function when runtime is long #175

Open bbitarello opened 2 months ago

bbitarello commented 2 months ago

Hello,

I have been using the bab function (thank you!) a lot lately and sometimes it takes very long, presumably due to having to explore a wider space of the possible trees. I understand this is unavoidable because of the algorithm.

My suggestion is that the function could somehow keep track of how many times it has to cycle over the while (npsc > 0) { and, beyond a certain number, it periodically print something out so that we have a sense of "where it's at" in terms of searching that tree space. Right now it is not possible to try to predict how long a bab run will take, and runtimes vary enormously even for the same number of tips and traits (again unavoidable), and having some info printed out when it's taking long could be helpful.

Thank you for considering this suggestion!

KlausVigo commented 1 month ago

Dear @bbitarello,

thanks for the suggestions. I made some changes and added progress bar, but it is very likely that the steps take different time. You can switch trace to 0, to shut it up. You can try this in the development version

install.packages('phangorn', repos = 'https://klausvigo.r-universe.dev')

Let me know if this works for you.

Kind regards, Klaus

bbitarello commented 1 month ago

Thank you so much. Since we're currently wrapping up a project using bab(), I will finish that with the non-dev version and then will test this and report back. Thanks again!

KlausVigo commented 1 month ago

The development version should be also a bit faster (up to twice as fast) as I reduced a bit of overhead. Regards, Klaus