A valley town gets its water from one utility: laying a second set of pipes would be absurd, so the utility is a natural monopoly. Each month it pays a large fixed cost F (the pipes and the treatment plant) plus c dollars per cubic metre delivered.
The town has N identical households. At a price of P dollars per cubic metre each household uses
q(P) = \max\left(0,\ \frac{a - P}{b}\right)
cubic metres a month. A tariff is a per-unit price P and a monthly fee per household (often 0). For a tariff:
- the utility's profit is N\,(P - c)\,q(P) + N \cdot \text{fee} - F (before any subsidy);
- each household's surplus is the area under its demand curve above the price, \tfrac{1}{2}(a - P)\,q(P), minus the fee;
- total surplus is
Ntimes the household surplus plus the profit. A subsidy from taxpayers is a transfer and is not counted.
The town council compares four tariffs:
"monopoly": no regulation. The utility charges the price that maximises its profit, with no fee."average_cost": the lowest price at which the profit, with no fee, is at least 0. If no price makes the profit reach 0, this tariff isNone."marginal_cost": pricec, no fee. The utility then losesF, which taxpayers would have to cover."two_part": pricecand a fee ofF / Nper household. Households join only if their surplus is still at least 0 (exactly 0 is enough); otherwise this tariff isNone.
Write water_tariffs(N, a, b, c, F) that returns a dict with these four keys, each mapped to None or to a tuple (P, fee, profit, total_surplus).
Examples
Input: N = 1000, a = 10, b = 0.5, c = 2, F = 24000
Output: {'monopoly': (6.0, 0, 8000.0, 24000.0), 'average_cost': (4.0, 0, 0.0, 36000.0),
'marginal_cost': (2, 0, -24000.0, 40000.0), 'two_part': (2, 24.0, 0.0, 40000.0)}
Explanation: at a price of 4 each household uses 12 m3, and 1000 * 2 * 12 = 24000 just covers F.
The two-part tariff reaches the same total surplus as pricing at cost, without a subsidy.
Input: N = 1000, a = 10, b = 0.5, c = 2, F = 40000
Output: {'monopoly': (6.0, 0, -8000.0, 8000.0), 'average_cost': None,
'marginal_cost': (2, 0, -40000.0, 24000.0), 'two_part': (2, 40.0, 0.0, 24000.0)}
Explanation: even the best single price earns only 32000 above the costs per cubic metre, less than F.
Constraints
- answers are compared with a tolerance of
1e-6
Goals
- Model a natural monopoly whose fixed cost makes marginal-cost pricing run at a loss
- Solve a quadratic for the lowest price that covers average cost, and detect when none exists
- Compare total surplus across pricing rules, including a two-part tariff