top of page

Dynamically adding model presentations to make navigation during editing faster in AnyLogic.

Updated: Feb 27, 2023

This special guest blog post by intern Devon Cowling. He is currently doing his final year project for his degree in Industrial Engineering at the University of Pretoria under the supervision of Jaco-Ben Vosloo. This will be a short post on improving the navigation speed of AnyLogic when dealing with large and complex agent presentations. Due to the way these animations and presentations work in AnyLogic, they can use many resources.


It can be nothing less than aggravating for anyone who has dealt with crippling performance loss during model development when dealing with large agent presentations. At first glance, it seems easy enough just to delete the presentation while working on the model and manually re-add it before runtime. This works fine and will improve navigation speed but is quite cumbersome and tedious. This approach requires you to repeat this every time you work on the animation agent, and if you're like me and forget to delete it from the project taskbar before opening the agent, you get a nasty surprise as your computer time travels back to dial-up speeds.

I have created an example model with a large road network, borrowed from my final year project. The large road network is housed in an agent called AgentWithIntenseAnimation, and needs to be seen on Main during runtime.

Check out how slow the movement of the AnyLogic canvas is in the video below while the presentation is shown.

If you almost felt like pulling your hair out during the video, imagine how I felt working on this project for weeks...

Thankfully there is an easy method to fix this, add the presentation dynamically!

This speeds up the navigation while maintaining the presentation's functionality and animation at runtime. And the best part... it only needs to be done once!

Using the code below code on start-up of the top-level agent will add the presentation:

presentation.add(new ShapeEmbeddedObjectPresentation​(Agent agent,
                                       ShapeDrawMode drawMode,
                                       boolean ispublic,
                                       double x,
                                       double y,
                                       double z,
                                       double rotation,
                                       boolean drawAgentWithOffset,
                                       boolean scaleIsAutomatic,
                                       Agent embeddedObject));

For the example model I've created, the code above would look like this:

presentation.add(new ShapeEmbeddedObjectPresentation(this,

Using the above technique the result was as follows:

As you can see, adding the presentation dynamically makes navigation much smoother and working on that agent easier, whether that be to add statistics or buttons etc.

This method has made working on a model with a large presentation much more user-friendly (and literally saved me from pulling my hair out), so I hope it can be helpful to anyone who has struggled with slow navigation in AnyLogic.

You can download the example model from the AnyLogic cloud here, or the link below

Download ZIP • 274KB

Once you've had first-hand experience with the difference in navigation speed, you will want to make every presentation dynamic!

P.S. A big thank you to AnyLogic support for assisting in finding this solution

Devon Cowling


Devon Cowling is a guest writer for the AnyLogic Modeler. Feel free to connect with him over LinkedIn.

What next?

If you liked this post, you are welcome to read more posts by following the links above to similar posts. Why not subscribe to our blog or follow us on any of the social media accounts for future updates? The links are in the Menu bar at the top, or the footer at the bottom. You can also join the mobile app here!

If you really want to make a difference in supporting us please consider joining our Patreon community here

If you want to contact us for some advice, maybe a potential partnership or project or just to say "Hi!", feel free to get in touch here, and we will get back to you soon!

505 views1 comment

1 commentaire

Good afternoon, I would like to take your videos for my presentation at work. I will use this program to convert your video to mp4 format from mov. If you have no complaints, please let me know!

Post: Blog2_Post
bottom of page