-
Notifications
You must be signed in to change notification settings - Fork 16
High level implementation
EconSim consists of the following major components:
- An AuctionHouse class that manages agents, stats, and facilitate trades
- EconAgents, each with their own inventory of goods, decides how much of each good to buy or sell, hire or fire other agents
- InventoryItems, each decide on the price based on how much was traded relative to offer amount, supply and demand, and agent conditions.
In each round, agents consume n batches of input goods to produce n batches of output goods. For example, a farmer consumes 2 wood and (30% chance) consumes 1 tool to produce 8 units of food. This is defined as 1 batch. If a farmer has multiple employees, they can increase the number of batches the original farmer can consume/produce. Additionally, non farmers consume food, so they must buy food as well. The more food they have, the more they consume (see QolAgent.cs:Tick)
Agents always try to sell all their outputs by default. Agents buys as much of food and inputs as they can afford. This is currently done to maximize trade throughput.
Trade is currently set to matching the lowest priced asks and highest priced bids first, using the ask price as the clearing price. When a bid price is lower than the ask price, the bidder will still buy at the ask price but just in smaller quantity (only buy what's affordable). This trading strategy also maximizes number of trades.
Prices are adjusted within InventoryItems class. At the most basic level, ask prices UpdateSellerPriceBelief (sellers) increase if seller sold everything in previous round, other wise ask prices will decrease. The supply vs demand will impact how much the prices change. Same goes for the bid prices UpdateBuyerPriceBelief. Ask prices have a minimum they won't go below based on the price of inputs and food costs.
In terms of a systems, I see ask price and bid prices as forces negotiating the value of goods in terms of production cost and available money/desire to consume those goods. The problem I run into is that everyone needs food, and food needs the cumulative goods produced by everyone else, however, everyone else tends to go broke at some point and they can't seem to increase their prices fast enough to not starve to death.
There is a way for agents to change jobs once they go broke. They change to the most profitable profession at the time (usually farmers). However, after a while there will be no one doing other jobs, and since farmers require other goods, the economy eventually halts due to a lack of other goods. Here's what the flow chart of consumption/production looks like:
