Simulation Design

Link to Document : Mathematical Models

For the design of our simulation, we tried to blend our learnings from previous courses with that of the simulation module.

We decided on Agent Based Modelling as we wanted to best simulate how customers in a supermarket would behave in reality. In the prototyping process, we realized that Object Oriented programming played especially nicely with Agent Based Simulations and planned our architecture using this logic. To make it even more realistic, we also wanted to make the customers fully Non-Colliding among themselves as well as with other entities, customers dont like banging into each other after all.

After deciding our goals, we used our learnings from Digital World and Engineering Systems Architecture to conceptualize the relationships.

For the movement of our agents, we model them as taking a single step with 5 possible choices.

  • Move up
  • Move down
  • Stay in current position
  • Move left
  • Move right

A map tracking all the locations of entities is updated whenever an agent moves. To efficiently ensure a no collisions happen, we enforce the logic at the agent level, whereby the agents' possible movements are conditional on them being non-colliding. Thus, if a certain location is filled, none of the agents will be able to move to that location.

Each step is probabilistic with an array of weights given to different zones on the grid, the weight directions are approximately described by the arrow vectors below. The ratios of the weights act as the odds for each direction. We iterate through each avaiable agent and move them according to this logic.

The base directional weights are divided into 4 quarters based on the layout of our supermarket, these will be modified generatively depending on the agent's surrounding entities.

By implementing the individual logic, running the simulation allows us to aggregate it to top level behaviour, which achieves our objective of agent based modelling.




Generating random arrivals


The second half of simulation introduced generation of random variables and so we used Poisson Processes to simulate the arrival of the customers with the option of thinning the Poisson process. In our Simulation, we allow the user to vary both the arrival rate and thinning probability.

Diagrams of the Mathematical formulation are in the link above.

Press "Simulate" at the top of the page to view the simulation.