-
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 PopulateOffers. 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.
And while everyone is selling and buying as much as possible, I think it skews the supply/demand ratio as it's not immediately reflective of the price. Like, if the supply is high, it will drive prices down, but sellers will still sell as much as they can, driving prices even lower. However, when I tried to moderate the number of asks/bids, and prices go up, people eventually stop trading and thus prices do not ever lower.
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:

I want to think of prices as a signal that needs dampening, and I want to introduce some dampening factors. However, a lot of times the change in prices is not responsive enough to the current market conditions (someone running out of food and need to either sell their goods or no one is buying because they have no money). So I wish the agents could adjust their prices more intelligently, I just don't know how.
Of course, this whole project is meant for the player to come in with governmental levers to moderate the system. I have stuff like sales tax, income tax, consumer side subsidies, and government reserves to try to buffer lack of goods or high prices. But so far I haven't had any luck make good use of those levers because the system it self is extremely unstable :(