This simulation uses simple production and trade mechanisms to demonstrate how endogenous supply and demand patterns can emerge. Agents can produce either apples or gold at each time step. Agents have to eat apples to survive, and can trade gold for apples. and have a certain desired 'reserve' amount of apples.
Agents have a desired 'reserve' amount of apples. They have uniformly distributed production abilities which determine how much gold or apples they can produce. They decide which to produce based on the predicted market value. If agents have less apples than their desired reserve, they try to submit a buy offer to nearby selling agents. If agents have more apples than their desired reserve, they try to sell apples.
Agents update the price they sell or buy at based on the last price they bought/sold at, and the prices their neighbors have set.
- Visualization -
Each square in the 3D environment represents an agent. They are differentiated based on both their height and color. Tall agents are currently producing apples, while short agents are producing gold. The color of agents is based on the price they are trying to sell/buy at:
p < 0.5 - red 0.5 <= p < 1 - orange 1 <= p < 1.5 - yellow 1.5 <= p < 2 - green 2 < p - blue
See also the Python implementation of this simulation.