Advertising¶
Ad platform simulation with audience tiers, advertisers, and bidding.
Advertising economics simulation components.
Models the dynamics of digital advertising platforms, including audience targeting tiers, advertiser profitability analysis, and the Adverse Advertising Amplification (AAA) effect.
The AAA effect describes how small changes in consumer sentiment cause disproportionately large revenue losses for advertising platforms. This happens because outer-ring (broad, high-CPA) campaigns become unprofitable first and get shut off, removing the platform's most lucrative revenue streams.
Typical usage::
platform = AdPlatform("Meta")
tiers = [
AudienceTier("Niche", base_monthly_sales=100, base_cpa=10.0),
AudienceTier("Broad", base_monthly_sales=1000, base_cpa=40.0),
]
advertiser = Advertiser(
"PosterShop",
product_price=100.0,
production_cost=50.0,
tiers=tiers,
platform=platform,
)
sim = Simulation(entities=[platform, advertiser], end_time=...)
for e in advertiser.start_events():
sim.schedule(e)
sim.run()
AudienceTier
dataclass
¶
An audience segment with specific advertising economics.
Represents one concentric ring of advertising reach. Inner rings (niche audiences) have high conversion rates and low cost per acquisition (CPA). Outer rings (broad audiences) have low conversion rates and high CPA.
The ad spend for a tier is constant regardless of consumer sentiment (you reach the same audience at the same cost). When sentiment drops, fewer people convert, so CPA rises. When CPA exceeds the profit margin, a rational advertiser shuts off the tier entirely.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Human-readable tier label. |
required |
base_monthly_sales
|
int
|
Expected sales per period at sentiment=1.0. |
required |
base_cpa
|
float
|
Cost per acquisition at sentiment=1.0. |
required |
monthly_ad_spend
property
¶
Fixed monthly ad spend (reach cost is constant).
effective_cpa ¶
CPA adjusted for current consumer sentiment.
breakeven_sentiment ¶
Minimum sentiment at which this tier is profitable.
Below this value, CPA exceeds margin and a rational advertiser would shut off the campaign.
is_profitable ¶
Whether this tier generates positive profit at given sentiment.
tier_profit ¶
Advertiser profit from this tier for one period.
tier_platform_revenue ¶
Platform revenue from this tier for one period.
Returns zero if the tier is shut off (unprofitable). When active, the platform collects the full fixed ad spend regardless of conversion count.
AdvertiserStats
dataclass
¶
AdvertiserStats(
periods_evaluated: int = 0,
total_profit: float = 0.0,
total_platform_revenue: float = 0.0,
tier_shutoff_events: int = 0,
)
Aggregate statistics for an advertiser.
Advertiser ¶
Advertiser(
name: str,
*,
product_price: float,
production_cost: float,
tiers: list[AudienceTier],
platform: AdPlatform,
evaluation_interval: float = 1.0,
)
Bases: Entity
A business that sells products through advertising on a platform.
Manages multiple audience tiers, periodically evaluating profitability and shutting off tiers that don't generate positive profit. Reports ad revenue to the associated AdPlatform.
The margin (product_price - production_cost) determines the maximum CPA tolerable. As consumer sentiment drops, CPA rises and outer tiers become unprofitable first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Entity name. |
required |
product_price
|
float
|
Selling price per unit. |
required |
production_cost
|
float
|
Non-advertising cost per unit. |
required |
tiers
|
list[AudienceTier]
|
List of AudienceTier objects, from niche to broad. |
required |
platform
|
AdPlatform
|
The AdPlatform entity to report revenue to. |
required |
evaluation_interval
|
float
|
Simulated seconds between evaluations. |
1.0
|
sensitivity_analysis ¶
sensitivity_analysis(
sentiment_range: tuple[float, float] = (0.0, 1.0),
steps: int = 100,
) -> list[dict]
Static analysis of profit/revenue across sentiment values.
Returns a list of dicts with keys: sentiment, advertiser_profit, platform_revenue, active_tiers, tier_names.
AdPlatformStats
dataclass
¶
Aggregate statistics for an ad platform.