Case 885

The average cost said yes and the next unit said no

the_average_cost_said_yes_and_the_next_unit_said_no.eml - A plant accepts an order priced above its average cost per unit, the average is computed exactly from real costs, and the order price is real. What the next hundred units actually cost to make is computed below.

ok: true — round-trip fixpoint reached (python1 == python2)updated 2026-09-17

EML

eml
# Self-authored for the EML case corpus (no external origin). A plant accepts an
# order priced above its average cost per unit, the average is computed exactly
# from real costs, and the order price is real. What the next hundred units
# actually cost to make is computed below.
#
# The decision is careful. It uses the real fixed and variable costs; the
# average cost per unit is the honest total over the honest volume; the order
# price is compared to that average correctly; and the intent is exactly
# 'accept orders that make money'.
#
# The average includes fixed cost already paid and assumes units made inside
# capacity, while the order's units come after capacity and cost overtime - so
# the price beats the average and loses to the margin.

1000 => fixed_cost
6 => variable_cost_per_unit
500 => units_at_capacity
100 => order_units
9 => order_price_per_unit
12 => overtime_cost_per_unit

variable_cost_per_unit * units_at_capacity => variable_total_at_capacity
fixed_cost + variable_total_at_capacity => total_cost_at_capacity
int(total_cost_at_capacity / units_at_capacity) => average_cost_per_unit
order_price_per_unit - average_cost_per_unit => margin_per_unit_by_the_average
margin_per_unit_by_the_average * order_units => profit_by_the_average
order_price_per_unit - overtime_cost_per_unit => margin_per_unit_at_the_margin
margin_per_unit_at_the_margin * order_units => profit_at_the_margin
order_price_per_unit * order_units => order_revenue
int((profit_by_the_average - profit_at_the_margin) * 10000 / order_revenue) => swing_per_myriad_of_order_revenue

"fixed cost                      : " + str(fixed_cost) ^0
"variable cost per unit          : " + str(variable_cost_per_unit) + ", inside capacity" ^0
"units at capacity               : " + str(units_at_capacity) ^0
"total cost at capacity          : " + str(total_cost_at_capacity) ^0
"average cost per unit           : " + str(average_cost_per_unit) ^0
"" ^0
"order                           : " + str(order_units) + " units at " + str(order_price_per_unit) ^0
"margin per unit by the average  : " + str(margin_per_unit_by_the_average) + ", profit " + str(profit_by_the_average) ^0
"cost of the next unit           : " + str(overtime_cost_per_unit) + ", overtime" ^0
"margin per unit at the margin   : " + str(margin_per_unit_at_the_margin) + ", profit " + str(profit_at_the_margin) ^0
"swing, of order revenue         : " + str(swing_per_myriad_of_order_revenue) + " per ten thousand" ^0
"" ^0

# ---- what the decision verified ----

"the accept-or-reject rule" ^0
"  costs : the real fixed and variable costs" ^0
"  average : honest total over honest volume, " + str(average_cost_per_unit) ^0
"  comparison : order price against the average, correctly" ^0
"  intent : accept orders that make money" ^0
"  costs omitted from the average : 0" ^0
"  verdict : 9 EXCEEDS THE AVERAGE OF 8, ACCEPT" ^0
"" ^0
"  computing the exact average from the real costs is the" ^0
"  part done right here, and it is why " + str(average_cost_per_unit) + " really is what a" ^0
"  unit has cost so far" ^0
"" ^0

# ---- what the next units cost ----

"the margin" ^0
"  what the average contains : fixed cost already paid, and" ^0
"    units made inside capacity" ^0
"  where the order's units are made : beyond capacity, on" ^0
"    overtime" ^0
"  what the next unit costs : " + str(overtime_cost_per_unit) + ", not " + str(average_cost_per_unit) ^0
"  so the order : earns " + str(order_price_per_unit) + " and costs " + str(overtime_cost_per_unit) + " per unit, " + str(profit_at_the_margin) + " in all" ^0
"  the fixed cost : is paid whether or not the order is taken" ^0
"" ^0

# ---- what the plant got ----

"the order" ^0
"  expected by the average : profit " + str(profit_by_the_average) ^0
"  actual at the margin : " + str(profit_at_the_margin) ^0
"  is the average wrong : no; it is exact" ^0
"  is the average the cost of the decision : no; the" ^0
"    decision is about the next " + str(order_units) + " units, and those cost " + str(overtime_cost_per_unit) ^0
"" ^0

# ---- null control ----

# The same order, judged against the marginal cost of the units it would add.
100 => nc_profit_judged_by_the_average
margin_per_unit_at_the_margin * order_units => nc_profit_judged_at_the_margin
1 => nc_order_rejected_when_judged_at_the_margin

"null control - compare the price to the marginal cost" ^0
"  profit judged by the average : " + str(nc_profit_judged_by_the_average) ^0
"  profit judged at the margin : " + str(nc_profit_judged_at_the_margin) ^0
"  order rejected at the margin : " + str(nc_order_rejected_when_judged_at_the_margin) ^0
"  no cost and no price changed; the comparison stopped" ^0
"  using a number about the past" ^0
"" ^0

# ---- the rule ----

"what a price-above-average-cost rule guarantees" ^0
"  the price exceeds what a unit has cost on average :" ^0
"    exactly, real costs, honest average" ^0
"  the order makes money : not addressed; the added units" ^0
"    cost the marginal " + str(overtime_cost_per_unit) + ", not the average " + str(average_cost_per_unit) + ", so the order" ^0
"    loses " + str(profit_at_the_margin) + " where the average promised " + str(profit_by_the_average) ^0
"" ^0

"an average describes what has been, and a decision changes what will be; the" ^0
"cost that matters is the cost of the units the decision adds, and the fixed" ^0
"cost folded into the average is spent whichever way the decision goes" ^0
"" ^0

"It computes the exact average cost of " + str(average_cost_per_unit) + " and sees a price of " + str(order_price_per_unit) + " above it. But" ^0
"the order's " + str(order_units) + " units are made on overtime at " + str(overtime_cost_per_unit) + ", so the margin is " + str(margin_per_unit_at_the_margin) + " a unit" ^0
"and the order loses " + str(profit_at_the_margin) + " where the average promised " + str(profit_by_the_average) + ", a swing of " + str(swing_per_myriad_of_order_revenue) + " per" ^0
"ten thousand of the order, until the price is compared to the marginal cost." ^0

Python (deterministic transpilation)

python
fixed_cost = 1000
variable_cost_per_unit = 6
units_at_capacity = 500
order_units = 100
order_price_per_unit = 9
overtime_cost_per_unit = 12
variable_total_at_capacity = variable_cost_per_unit * units_at_capacity
total_cost_at_capacity = fixed_cost + variable_total_at_capacity
average_cost_per_unit = int(total_cost_at_capacity / units_at_capacity)
margin_per_unit_by_the_average = order_price_per_unit - average_cost_per_unit
profit_by_the_average = margin_per_unit_by_the_average * order_units
margin_per_unit_at_the_margin = order_price_per_unit - overtime_cost_per_unit
profit_at_the_margin = margin_per_unit_at_the_margin * order_units
order_revenue = order_price_per_unit * order_units
swing_per_myriad_of_order_revenue = int((profit_by_the_average - profit_at_the_margin) * 10000 / order_revenue)
print("fixed cost                      : " + str(fixed_cost))
print("variable cost per unit          : " + str(variable_cost_per_unit) + ", inside capacity")
print("units at capacity               : " + str(units_at_capacity))
print("total cost at capacity          : " + str(total_cost_at_capacity))
print("average cost per unit           : " + str(average_cost_per_unit))
print("")
print("order                           : " + str(order_units) + " units at " + str(order_price_per_unit))
print("margin per unit by the average  : " + str(margin_per_unit_by_the_average) + ", profit " + str(profit_by_the_average))
print("cost of the next unit           : " + str(overtime_cost_per_unit) + ", overtime")
print("margin per unit at the margin   : " + str(margin_per_unit_at_the_margin) + ", profit " + str(profit_at_the_margin))
print("swing, of order revenue         : " + str(swing_per_myriad_of_order_revenue) + " per ten thousand")
print("")
print("the accept-or-reject rule")
print("  costs : the real fixed and variable costs")
print("  average : honest total over honest volume, " + str(average_cost_per_unit))
print("  comparison : order price against the average, correctly")
print("  intent : accept orders that make money")
print("  costs omitted from the average : 0")
print("  verdict : 9 EXCEEDS THE AVERAGE OF 8, ACCEPT")
print("")
print("  computing the exact average from the real costs is the")
print("  part done right here, and it is why " + str(average_cost_per_unit) + " really is what a")
print("  unit has cost so far")
print("")
print("the margin")
print("  what the average contains : fixed cost already paid, and")
print("    units made inside capacity")
print("  where the order's units are made : beyond capacity, on")
print("    overtime")
print("  what the next unit costs : " + str(overtime_cost_per_unit) + ", not " + str(average_cost_per_unit))
print("  so the order : earns " + str(order_price_per_unit) + " and costs " + str(overtime_cost_per_unit) + " per unit, " + str(profit_at_the_margin) + " in all")
print("  the fixed cost : is paid whether or not the order is taken")
print("")
print("the order")
print("  expected by the average : profit " + str(profit_by_the_average))
print("  actual at the margin : " + str(profit_at_the_margin))
print("  is the average wrong : no; it is exact")
print("  is the average the cost of the decision : no; the")
print("    decision is about the next " + str(order_units) + " units, and those cost " + str(overtime_cost_per_unit))
print("")
nc_profit_judged_by_the_average = 100
nc_profit_judged_at_the_margin = margin_per_unit_at_the_margin * order_units
nc_order_rejected_when_judged_at_the_margin = 1
print("null control - compare the price to the marginal cost")
print("  profit judged by the average : " + str(nc_profit_judged_by_the_average))
print("  profit judged at the margin : " + str(nc_profit_judged_at_the_margin))
print("  order rejected at the margin : " + str(nc_order_rejected_when_judged_at_the_margin))
print("  no cost and no price changed; the comparison stopped")
print("  using a number about the past")
print("")
print("what a price-above-average-cost rule guarantees")
print("  the price exceeds what a unit has cost on average :")
print("    exactly, real costs, honest average")
print("  the order makes money : not addressed; the added units")
print("    cost the marginal " + str(overtime_cost_per_unit) + ", not the average " + str(average_cost_per_unit) + ", so the order")
print("    loses " + str(profit_at_the_margin) + " where the average promised " + str(profit_by_the_average))
print("")
print("an average describes what has been, and a decision changes what will be; the")
print("cost that matters is the cost of the units the decision adds, and the fixed")
print("cost folded into the average is spent whichever way the decision goes")
print("")
print("It computes the exact average cost of " + str(average_cost_per_unit) + " and sees a price of " + str(order_price_per_unit) + " above it. But")
print("the order's " + str(order_units) + " units are made on overtime at " + str(overtime_cost_per_unit) + ", so the margin is " + str(margin_per_unit_at_the_margin) + " a unit")
print("and the order loses " + str(profit_at_the_margin) + " where the average promised " + str(profit_by_the_average) + ", a swing of " + str(swing_per_myriad_of_order_revenue) + " per")
print("ten thousand of the order, until the price is compared to the marginal cost.")

stdout (executed)

text
fixed cost                      : 1000
variable cost per unit          : 6, inside capacity
units at capacity               : 500
total cost at capacity          : 4000
average cost per unit           : 8

order                           : 100 units at 9
margin per unit by the average  : 1, profit 100
cost of the next unit           : 12, overtime
margin per unit at the margin   : -3, profit -300
swing, of order revenue         : 4444 per ten thousand

the accept-or-reject rule
  costs : the real fixed and variable costs
  average : honest total over honest volume, 8
  comparison : order price against the average, correctly
  intent : accept orders that make money
  costs omitted from the average : 0
  verdict : 9 EXCEEDS THE AVERAGE OF 8, ACCEPT

  computing the exact average from the real costs is the
  part done right here, and it is why 8 really is what a
  unit has cost so far

the margin
  what the average contains : fixed cost already paid, and
    units made inside capacity
  where the order's units are made : beyond capacity, on
    overtime
  what the next unit costs : 12, not 8
  so the order : earns 9 and costs 12 per unit, -300 in all
  the fixed cost : is paid whether or not the order is taken

the order
  expected by the average : profit 100
  actual at the margin : -300
  is the average wrong : no; it is exact
  is the average the cost of the decision : no; the
    decision is about the next 100 units, and those cost 12

null control - compare the price to the marginal cost
  profit judged by the average : 100
  profit judged at the margin : -300
  order rejected at the margin : 1
  no cost and no price changed; the comparison stopped
  using a number about the past

what a price-above-average-cost rule guarantees
  the price exceeds what a unit has cost on average :
    exactly, real costs, honest average
  the order makes money : not addressed; the added units
    cost the marginal 12, not the average 8, so the order
    loses -300 where the average promised 100

an average describes what has been, and a decision changes what will be; the
cost that matters is the cost of the units the decision adds, and the fixed
cost folded into the average is spent whichever way the decision goes

It computes the exact average cost of 8 and sees a price of 9 above it. But
the order's 100 units are made on overtime at 12, so the margin is -3 a unit
and the order loses -300 where the average promised 100, a swing of 4444 per
ten thousand of the order, until the price is compared to the marginal cost.

Trace event types

eml:run:starteml:assigneml:outputeml:run:done