Economic Agents

CliMaPan-Lab includes several types of economic agents with comprehensive inline documentation explaining their behavior, state management, and lifecycle within the simulation.

Consumers

The Consumer agent represents households/individuals with detailed lifecycle documentation covering income sources, consumption decisions, wealth management, employment status, and epidemiological state progression.

Key Features: * Income Management: Wages, dividends, interest, and transfers * Consumption Decisions: Based on wealth and subsistence needs * Employment Dynamics: Hiring, firing, and firm attachment * COVID Progression: SEIR-like disease dynamics by age group * Climate Effects: Wealth impacts from climate shocks

class climapan_lab.src.consumers.Consumer(model: BaseModel, agent_id: int)[source]

Bases: Agent

A consumer agent

setup()[source]

Override in subclasses to initialize agent attributes.

reset()[source]
desired_C()[source]

Calculate desired consumption based on wealth and subsistence needs

update_wealth()[source]

Update wealth after income and consumption

receiveHiring(firmID)[source]

Process hiring by a firm

receiveFiring()[source]

Process firing by a firm

updateMemoryAfterHiringFiring()[source]

Update employment memory after hiring/firing

updateMemory(unemplRate)[source]

Track recent unemployment rates (used in wage formation early on)

setConsumption(value)[source]

Set realized consumption value

getConsumption()[source]

Get realized consumption value

get_desired_consumption()[source]

Get desired consumption in physical units

update_deposit(amount)[source]

Adjust deposit by amount

set_deposit(deposit)[source]

Set deposit to specific value

wealth_loss(loss_percentage)[source]

Apply wealth loss (used during climate shocks)

get_deposit()[source]

Get current deposit level

getEmploymentState()[source]

Check if employed worker

getUnemploymentState()[source]

Check if unemployed worker

setEmployment(value)[source]

Set employment status

isWorker()[source]

Check if consumer is a worker

getSumEmploymentState()[source]
getIdentity()[source]

Get agent ID

getFinancialDifficultyIndicator()[source]
setWage(wage=None)[source]

Set wage with unemployment dole fallback

getIncome()[source]

Get total income this period

getWage()[source]

Get current wage

setConsumerType(consumerType)[source]

Set consumer type (workers/capitalists/energy owners)

getConsumerType()[source]

Get consumer type

getBelongToFirm()[source]

Get firm ID if employed

setDiv(div)[source]

Set dividend (only for owners)

getDiv()[source]

Get dividend income

gov_transfer(value)[source]

Receive government transfer

setAgeGroup(ageGroup)[source]

Set age group (young/working/elderly)

getAgeGroup()[source]

Get age group

setCovidState(state=None, time=None, duration=None, nextState=None)[source]

Set COVID state with transition parameters

getCovidState()[source]

Get full COVID state dict

getCovidStateAttr(attr)[source]

Get specific COVID state attribute

propagateContact(inf_f, inf_c, p_firm, p_community)[source]

Calculate infection probability from contacts

progressCovid()[source]

Main COVID progression dispatcher by current state

setSickLeaves(date)[source]

Record sick leave date

getSickLeaves()[source]

Get list of sick leave dates

resetSickLeaves()[source]

Clear sick leave records

isDead()[source]

Check if consumer is dead

isEmployed()[source]

Check if consumer is employed

setObtainedCredit(obtainedCredit)[source]

Set obtained credit amount

getObtainedCredit()[source]

Get obtained credit amount

setDead()[source]

Zero-out economic state and mark as dead

Firms

All firm types inherit from GoodsFirmBase which provides comprehensive documentation covering the monthly production lifecycle, financial management, labor relations, and policy interactions.

Firm Lifecycle (Monthly): 1. Planning: Set production targets and budget requirements 2. Hiring: Labor market participation and wage calculation 3. Production: Physical production function execution 4. Sales: Market transactions and price setting 5. Settlement: Cost accounting, profit calculation, capital updates 6. Taxes/Dividends: Policy compliance and owner income distribution

Consumer Goods Firms

Produce final consumption goods with demand-driven production planning.

class climapan_lab.src.firms.ConsumerGoodsFirm(model: BaseModel, agent_id: int)[source]

Bases: GoodsFirmBase

A ConsumerGoodsFirm agent

setup()[source]

Override in subclasses to initialize agent attributes.

prepareForecast()[source]

Reset per-step aggregates and scope the current consumer pool.

calculate_input_demand()[source]

Plan production and input demands based on demand forecasts.

produce()[source]

Calculate actual production based on inputs and sick leave adjustments.

price_setting()[source]

Function to set price base on mark up over cost

compute_net_profit(eps=1e-08)[source]

Calculate profit after all costs, taxes, and owner payments

update_capital_growth()[source]

Update capital growth from purchases

Capital Goods Firms

Produce capital equipment for other firms with investment-driven demand.

class climapan_lab.src.firms.CapitalGoodsFirm(model: BaseModel, agent_id: int)[source]

Bases: GoodsFirmBase

A CapitalGoodsFirm agent

setup()[source]

Override in subclasses to initialize agent attributes.

prepareForecast()[source]

Reset per-step aggregates and scope the current employee pool.

calculate_input_demand()[source]

Plan production and inputs using simple exponential smoothing.

produce()[source]

Calculate actual production based on inputs and sick leave adjustments.

price_setting()[source]

Function to set price base on mark up over cost

compute_net_profit(eps=1e-08)[source]

Calculate profit after all costs, taxes, and owner payments

update_capital_growth()[source]

Update internal capital growth target

Energy Firms

Provide energy inputs to production with environmental impact differentiation.

class climapan_lab.src.firms.GreenEnergyFirm(model: BaseModel, agent_id: int)[source]

Bases: EnergyFirmBase

A GreenEnergyFirm agent

setup()[source]

Override in subclasses to initialize agent attributes.

class climapan_lab.src.firms.BrownEnergyFirm(model: BaseModel, agent_id: int)[source]

Bases: EnergyFirmBase

A BrownEnergyFirm agent

setup()[source]

Override in subclasses to initialize agent attributes.

Banks

class climapan_lab.src.banks.Bank(model: BaseModel, agent_id: int)[source]

Bases: Agent

A bank agent

setup()[source]

Override in subclasses to initialize agent attributes.

agentAssign()[source]
sommaW(eps=1e-08)[source]

This internal function of the Bank class is used to propagate the main functions of the bank

reset_bank()[source]

Government

class climapan_lab.src.governments.Government(model: BaseModel, agent_id: int)[source]

Bases: Agent

A government agent

setup()[source]

Override in subclasses to initialize agent attributes.

checkConsistency()[source]
agentAssign()[source]
transfer_expenditure(value)[source]
E_Gov()[source]
UE_Gov()[source]
update_budget(value)[source]
issue_bond()[source]

Climate Module

The Climate module provides comprehensive step-by-step documentation of climate dynamics including emissions tracking, CO₂ concentration updates, temperature changes, and economic impact calculations.

Climate Process (Monthly): 1. Emissions Aggregation: Collect and scale emissions from all firms 2. Carbon Cycle Update: CO₂ concentration with accumulation and mean-reversion 3. Temperature Dynamics: Radiative forcing and e-folding temperature updates 4. Shock Detection: Climate threshold monitoring and trigger activation 5. Damage Calculation: Economic and mortality impact assessment

Shock Types: * Aggregate Population: Population-level mortality impacts * Idiosyncratic: Individual-level survival calculations

class climapan_lab.src.climate.Climate(model: BaseModel, agent_id: int)[source]

Bases: Agent

setup()[source]

Override in subclasses to initialize agent attributes.

initGDP(GDP)[source]

Store baseline GDP for normalization in damage functions or shock scaling.

initAggregatedIncome()[source]

Store baseline aggregate income (wage + non-wage) for later shock scaling.

progress(list_firm)[source]

Advance the climate system by one economic period (called monthly from EconModel).

Steps:
  1. Aggregate emissions from firms (green vs brown).

  2. Update CO2 concentration with accumulation & reversion.

  3. Compute radiative forcing and update temperature using e-folding time.

  4. If temperature jump condition met, compute & flag a climate shock.

process_aggregate_damage()[source]
Compute aggregate damages:
  • ETD (economic/output) as a function of GDP, concentration ratio, and parameters.

  • ETM (labor/employment) as a function of workers_t, GDP ratio, and parameters.

These are stored as attributes and can be recorded/used elsewhere.

getPM()[source]

Return population mortality (PM) computed for aggregate shocks.

getAliveConsumersPostShock()[source]

Return the computed number of post-shock survivors for idiosyncratic shocks.