Taking control of your network - Agent-based pathfinding

Aug 9 / Benjamin Schumann
Few things beat being a simulation consultant. Just in the past few weeks, I helped a vaccine manufacturer improve their internal logistics and do the same for an electric car manufacturer. What a privilege.

But it gets more interesting: both companies had the same core modelling challenge. They have a network of paths in which agents are moving and creating traffic. For the vaccine manufacturer, it was operators and forklifts moving pallets around. For the other it was forklifts and tugger trains moving pallets around.

Normal approach

In such situations, you have 2 options: you either use the material-handling library (requiring a lot of manual work and slowing large models considerably). Or you apply AnyLogic networks with their build-in path-finding.

For both clients, the material-handling library would have been far too slow due to the problem scale.

So networks it was. But was it?
The material-handling library does not scale well to huge production environments.
Network-based modelling does not allow for spatial KPIs and custom route finding.

THE PROBLEM

While AnyLogic networks are good for drawing networks, they do not allow you to actually measure performance within it. How often was this path used? Can I adjust/redraw the network at runtime as things unfold?

Even more, you have no actual control about the path-finding. Internally, AnyLogic does it for you, using a prescribed “shortest-path” approach. But in vaccine transport and electric car manufacturing (and really any other world), the shortest path might not be the right path…

Last, AnyLogic networks can only live on 1 “level”. Finding a path across levels is not trivial.

The solution

When two clients essentially need the same thing, it is probably something that others also need. So I decided to turn this into a public video series where I teach you the following:
  1. Agent-ify your network: We will turn every part of your AnyLogic network into agents. Each node and each path becomes an Agent that you can click on, animate and interact with
  2. Custom route-finding: We translate your AnyLogic network into a “graph” using an external (open-source) Java library called JGraphT
  3. We bypass the AnyLogic network entirely: If an agent wants to move from A to B, we first ask the route-finding library how to get there. Then, the agent will “visit” each path/node agent that we created in step 1. This allows us to collect detailed statistics on any part of the network. We can also add any special spatial behavior we like

Fair warning

This will be a 6-part video series. It is not for the faint-hearted. We do advanced stuff. We use inheritance, we use external libraries, we use some tricks here and there. If you are a Java or AnyLogic beginner, it may be a bit too ambitious. But do try it, just do not despair if this is a bit too much. I am happy to help :)

The model

PART 1 - INTRODUCTION

Here is first video introducing the example model and the key concepts, have fun :)
Write your awesome label here.

PART 2 - MODEL HIERARCHY

In the second part, we explore the model hierarchy to understand the fundamentals of what is about to come:
Write your awesome label here.

PART 3 - AGENT INSTANTIATION

In this third part, we learn how we create (instantiate) agents that will represent our network nodes and paths. This forms the most powerful aspect of this approach: If any node/path is an agent, we can do anything with them.
Write your awesome label here.

PART 4 - JGRAPHT LIBRARY FOR PATH-FINDING

Now that we have an agent-based network, lets apply a custom route-finding tool so we have full control over how to do route finding. JGraphT is a powerful library for that purpose. Let's see how to apply it.
Write your awesome label here.

PART 5 - AGENT MOVEMENT

In this video, it is time to make some agents apply the network, find their path and actually move.
Write your awesome label here.

PART 6 - INTERACT WITH THE NETWORK & WRAPUP

In this video, let's see how we can actually interact with our network and discuss where to take it from here :)
Write your awesome label here.
Created with