Agent Population and SD Housing

This simple model of a city population dynamics shows how agents can be placed into and interact with a system dynamics environment. Agents (people) rent houses in a city with seven districts. Each district has a certain attractiveness (constant, but you can vary it manually by a slider during runtime). The rental price in a district depends on its occupancy with a certain delay. On average every month each person considers the current situation and makes decision. If there are available houses in a more attractive district at an affordable price, he will move. If all prices in the city are higher than he can afford, he leaves the city (and removes himself from the model). Otherwise he will stay. The income distribution of the population is defined by a table function. The fraction of income that a person is ready to pay for rent is individual for each person and uniformly distributed.
The flows between the stocks of available houses and occupied houses are controlled by the agents: in the event of moving an agent increments and decrements the corresponding buckets of the stocks. The rental prices variable is visible to the agents and affects their decision making. The agents therefore are a part of the system feedback loops.