robertfeldt / BlackBoxOptim.jl

Black-box optimization for Julia
Other
439 stars 56 forks source link

Differential Evolution optimizers take a long time to "finalize" #97

Closed karajan9 closed 6 years ago

karajan9 commented 6 years ago

I have encountered the following problem: if I optimize my problem with a variation of a differential evolution algorithm, after it has finished (MaxTime = 60 sec has run out) it takes a long time (~20 min?) until the command is actually finished. There is no more output (the final solution was already printed) but Julia is still busy and using the CPU.

Unfortunately the problem occurred on my work computer where I (currently) don't have access to my github account to provide more details right off the bat. If it helps I can try to provide the (lengthy) code that produced this problem. Hopefully the description is enough to give a hint, but I will try to assist to the best of my abilities although I'm not sure how far I can help in terms of debugging.

robertfeldt commented 6 years ago

Very interesting. Do you mean that it prints the result but it takes time after that to actually return?

We would really like more details and, preferably, example code to replicate this. Sounds like it could have to do with population-based algorithms but not clear. Do you remember if you used a very large population size? Please try to shorten your example code so you can share it and we can try to dig deeper. This is definitely something we want to fix asap, if possible.

robertfeldt commented 6 years ago

Hmm, I tried running a few different DE variants on many-dimensional rosenbrock problems and varied the population size but I cannot replicate what you describe. Please provide example code. Could this somehow be Windows-related? Any chance you can try if it is the same with Julia 1.0?

karajan9 commented 6 years ago

Very interesting. Do you mean that it prints the result but it takes time after that to actually return?

Precisely that. With the other methods it returns immediately after printing the final solution, as one would expect.

Do you remember if you used a very large population size?

I didn't change any of the options for any of the methods, just the MaxTime, SearchRange and possibly NumDimensions, if that is what you mean?

Any chance you can try if it is the same with Julia 1.0?

I guess that should be no problem, as long as there is no problem with other packages supporting 0.7 but not 1.0 (for whatever reason).

Since this is code I wrote for work I think I will need to ask if I can invest some time to dig into the problem or if it's okay to take the code home to work on it in my free time/test on a Linux machine/publish here. I should get an answer to these questions on Monday.

Just some more info

karajan9 commented 6 years ago

After being able to test the issue a bit more thoroughly today, it seems the problem is with Juno, not with BlackBoxOptim. If I include my script in a normal Julia session, everything runs fine; if @ time or @ elapsed macros are used in Juno they always show the MaxTime, and Julia rattles on after that.

If you have any idea what might cause this, this information could be passed on to the Juno team. Some rough stopwatching (since the @ time macros won't work) seemed to suggest that the correlation between MaxTime and additional time spent is quadratic, if that helps.

Edit: How does one use macro names without tagging random people? :rofl:

robertfeldt commented 6 years ago

Sorry, but us hard to know since I don't use Juno. It sounds like it should be related to the population size so you can try increasing that and see if the times increase. Maybe some kind of cleanup or visualisation-related issue in Juno for the matrix used to store the population? You could also try another population-based optimizer, for example Borg MOEA, and see if it seems to be the same problems.