Home » Simulation 🌟 AI Research · Newsletter · ML Labs · About

Logistic Simulation

The concept of deterministic discrete event simulations could be extended to model more interesting scenarios.

Take a look at this imaginary map of locations (cities) and roads connecting them:

sim-logistics-map.png

Aside from demonstrating my slight fascination with steampunk and games, we could use this map to describe a domain:

  • there is a world with locations that are connected by the roads;
  • we have trucks that travel on these roads, travel takes time.

How can we find the fastest (not shortest!) path between any two locations: A and B?

One way to approach that is to run a simulation. We will launching truck instances from the location A in all directions at once. At every intersection we will fork and create more instances in all unvisited directions.

Time will move forward. As soon as the first truck instance arrives to location B, we can abort the simulation. The route that this winning truck took would be our fastest route.

Another term for this algorithm is "A* Search". It is described well on wikipedia.

Here is how we could implement the algorithm in Python:

sim-logistic.png

You can read more about this venue in the following articles:

And in following Transport Tycoon Software Katas (I'm linking only the relevant catas):

🤗 Check out my newsletter! It is about building products with ChatGPT and LLMs: latest news, technical insights and my journey. Check out it out