-
Notifications
You must be signed in to change notification settings - Fork 13
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
[IMPROVEMENT] From TKinter to PyGame #14
Comments
The issue of speed is when we have a high number of pheromones. If you can explain the logic behind the |
@riiswa I'm working on a workaround using dataframes to store pheromones information, but that implies reworking functions pheromones_affinity:
find_nest:
Thanks for confirming! :) |
Is this still something that's being pursued for this project? Agree that it would be a great way to improve simulation performance |
I agree with @emmanuel-ch.. I don't think the GUI framework is the root cause of performance issues. I was trying to find out what the most performant GUI framework is, but to no avail. I think @emmanuel-ch is correct in saying that the slowdown is attributable to the creation of memory components all of which grow exponentially with the number of ants. To refactor the code and represent each cell as a single unit that has a I haven't looked at the code in great detail in a while, but the The best solution that I can think of is a sort of sparse matrix or dictionary lookup of initialized positions. Essentially, you don't need to track 400,000 positions at the start. You can start with just the positions that have a I'm happy to help again if we come up with an accepted solution and break it up into manageable pieces 🏗️ P.S. I was the one who converted the original code into the code fragments you referenced @emmanuel-ch, but I don't know if it was supposed to be (0,0) at the top-left. The general standard for References: |
@nickumia - I have a branch ready with the solution you mentioned: a numpy array storing pheromones. Displaying only the "reduced" version on the screen: 1 circle for each location of pheromone. I'll make a PR for it in the next couple of days. |
Thank you for you research @nickumia , and I think you're right, we should save time in the data management, and not on the GUI part. @emmanuel-ch It could be interesting to see if we can use numba, to have a GPU compatible simulation. I can't wait to see your PR :) |
Challenge accepted! I'll share my conclusions once the current PR is accepted and we perform additional refactoring - I can still see places where code is suboptimal. |
It would be really cool to switch from TKinter to PyGame, especially for performance reasons and to allow the simulation of many more ants!
The text was updated successfully, but these errors were encountered: