Ovens and Bakers

production function · Cobb-Douglas · returns to scale · cost minimisation · search

An industrial bakery makes bread with ovens (K, capital) and bakers (L, labour). With K ovens and L bakers it bakes

Q = A\,K^{\alpha}\,L^{\beta}

loaves an hour, a Cobb-Douglas production function. Doubling both inputs multiplies output by 2^{\alpha + \beta}, so the function has

  • increasing returns to scale if \alpha + \beta > 1 (twice the inputs, more than twice the bread),
  • constant returns if \alpha + \beta = 1,
  • decreasing returns if \alpha + \beta < 1.

Compare the sum with 1 using a tolerance of 1e-9 (so alpha = 0.7 + 0.2 and beta = 0.1, which Python adds up to 0.9999999999999999, count as constant returns).

Ovens are rented at r dollars each and bakers paid w dollars each per hour. The bakery must bake at least target loaves an hour, using whole numbers of ovens and bakers, each between 1 and max_units. A mix reaches the target if its output is at least target - 1e-9 (this absorbs rounding in the powers).

Write cheapest_mix(A, alpha, beta, target, r, w, max_units) that returns a tuple (kind, best):

  1. kind: "increasing", "constant" or "decreasing";
  2. best: a tuple (K, L, cost) for the mix that reaches the target at the lowest cost r * K + w * L; if several mixes tie, the one with the fewest ovens; None if no mix within the limits reaches the target.

Examples

Input:  A = 2, alpha = 0.5, beta = 0.5, target = 24, r = 40, w = 10, max_units = 50
Output: ('constant', (6, 24, 480))
Explanation: 2 * sqrt(6 * 24) = 24 loaves for 240 + 240 = 480 dollars. 5 ovens need 29 bakers (490);
7 ovens need 21 (490).

Input:  A = 1, alpha = 0.5, beta = 0.5, target = 12, r = 3, w = 4, max_units = 60
Output: ('constant', (12, 12, 84))
Explanation: (12, 12) and (16, 9) both cost 84; the mix with fewer ovens is returned.

Input:  A = 2, alpha = 0.5, beta = 0.5, target = 24, r = 40, w = 10, max_units = 10
Output: ('constant', None)
Explanation: even 10 ovens and 10 bakers bake only 20 loaves.

Constraints

  • r, w are whole numbers, so costs are exact

Goals

  • Classify returns to scale from the exponents of a Cobb-Douglas production function
  • Search whole-unit input mixes for the cheapest one that reaches a target output
  • Find the fewest workers for a given number of machines without trying every pair
Starting Python…