international_producer
agents.international_producer
International producer agent module for the EcoWHEATaly model.
Defines the InternationalProducer agent representing a world-region wheat producer (e.g., North America, Eastern Europe). Each producer manages its stock, performs monthly market sessions to find the equilibrium price, and harvests once per year.
InternationalProducer
Bases: Agent
Repast4py agent representing an international wheat producer.
Each producer holds a wheat stock that decreases with monthly sales and increases at harvest. During market sessions, it aggregates demand from all buyers and finds the equilibrium price where aggregate demand equals available supply.
Attributes:
| Name | Type | Description |
|---|---|---|
TYPE |
Agent type identifier used by repast4py context. |
updateStockAtInitialization()
Recalculate initial stock based on production and gather month.
Used by Italy to overwrite the default FAOSTAT-based stock after the model replaces Italian production with simulated farm output.
updateStock(delta)
Apply a proportional change to stock and production.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delta
|
Fractional change to apply (e.g., -0.05 for a 5% reduction). |
required |
performMarketSession(tmpcontext)
Perform a monthly market session and find the equilibrium price.
Collects linear demand functions from all international buyers, aggregates them into a demand schedule, and finds the price at which aggregate demand equals available monthly supply. Computes exchanged quantities per buyer and updates the stock. For Italy, also updates the policy maker's price history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tmpcontext
|
The simulation Model instance providing access to the repast4py context and schedule. |
required |
harvestIfgatherMonth(tmpcontext)
Add annual production to stock if the current month is the gather month.
Italy is excluded because its production is managed separately by the Italian farm sub-model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tmpcontext
|
The simulation Model instance providing access to the schedule tick. |
required |
save()
Serialize the agent state for MPI communication.
Returns:
| Type | Description |
|---|---|
Tuple
|
The agent's unique identifier tuple |
print_status()
Print a short status message identifying this agent.