Lawfare Academy

Business Analytics: Optimization and Simulation · Chapter 7 of 8

Derive the newsvendor rule and connect simulation to optimization

Return to the linked course unit →

DEVELOPED COURSE TEXT

Derive the newsvendor rule and connect simulation to optimization

Write the marginal consequence of one more unit

Helix's kit order is placed before demand and cannot be revised. Selling pricep=10, costc=6 and salvagev=2. If the next ordered unit sells, it earns incremental contributionp-c=4. If it remains unsold, it losesc-v=4. These are underage and overage costs in the simple lost-sales benchmark. They are marginal consequences relative to not ordering that unit, not the total profit on all stock.
For a continuous demand distribution with cumulative functionF, the expected marginal profit at orderq is(p-c)[1-F(q)]-(c-v)F(q). Setting it to zero givesF(q)=(p-c)/(p-v)=4/8=.5. Thus the optimal order is a median under this symmetric marginal-cost structure. The derivation assumes a single period, known demand distribution, constant prices/costs, unlimited order feasibility and no additional shortage penalty. A mean-demand rule is not generally optimal; it happens to agree with the median in some symmetric distributions.

Handle the discrete distribution with finite increments

ForD 60,100,140 with probabilities.3,.4,.3, the cumulative probability reaches.3 at 60 and.7 at 100. The smallest demand value whose cumulative probability is at least.5 is 100. For integer orders between 60 and 100, the next unit sells with probability.7 and remains with probability.3, so expected incremental profit is.7×4-.3×4=1.6. Between 100 and 140, it sells with probability.3 and remains with probability.7, so incremental profit is-1.6. The objective rises to 100 and falls afterward.
This explains the exact expected profits 272 atq 80,304 atq 100 and 272 atq 120. Simulation is not needed to solve this tiny distribution, but it validates the code and prepares for cases with multiple products, correlated demand or more complex policies. An optimizer that repeatedly queries noisy simulation estimates needs care:it can select a policy with a high estimated mean partly because of random noise. Separate training and independent evaluation, as the previous chapter does.

Add shortage penalties and capacity constraints explicitly

Suppose each lost sale also incurs a stipulated penaltyk=4, not already counted in price or cost. The underage cost becomesp-c+k=8, while overage remains 4. The critical fractile is 8/(8+4)=2/3. In the current discrete distribution, the optimal quantile remains 100 becauseF 100=.7 exceeds 2/3. If the penalty rises tok=8, the fractile becomes 12/16=.75 and the optimal order jumps to 140. A discrete policy can stay unchanged over a range and then change abruptly.
If the warehouse caps orders at 90, chooseq 90 in the original no-penalty model because expected profit is still rising below 100. Expected profit is 288:at demand 60, profit 120; at higher demand, profit 360; weighted mean.3×120+.7×360=288. This is a constrained optimum, not evidence that 90 is the unconstrained median. A shared capacity across products requires a joint allocation model rather than applying independent quantiles and hoping their totals fit.

Distinguish service objectives and profit objectives

A cycle-service target such asP(D≤q)≥.9 is a different constraint from maximizing expected contribution. In the three-state distribution, it requiresq≥140. The fill rate, expected fraction of demand served, is another measure and generally differs from the probability of no stockout. State which service definition is intended before choosing a policy. A high service target can be valuable for customer relationships, but its economic and capacity consequences should be visible.
The advanced recommendation compares expected profit, service and downside consequences under the same distribution. It also tests input uncertainty:if low-demand probability increases substantially, the optimal quantile can change. A Monte Carlo estimate with a tiny SE cannot establish that the demand probabilities are accurate. Use observed data, forecast validation or a transparent scenario range to support them. The method earns its value by connecting the marginal economics to a feasible action, then distinguishing numerical optimization from uncertainty about the model itself.

Worked records

Record 1

Original kit model:p 10, c 6, v 2, no extra shortage penalty, D 60/100/140 with probabilities.3/.4/.3. Quantities initially integer 0–160.

Develop the reasoning

Underage 4, overage 4, critical fractile.5. The discrete optimal order is 100; exact expected profit 304. At a warehouse cap 90, expected profit 288 andq 90 is optimal. Perfect demand information would chooseq=D and earn 4 D, expected 400; EVPI relative to the optimal uninformed policy is 96 before any information cost or delay.

Progressive practice — optional

1. Foundation

Derive the critical fractile.

Compare the worked reasoning

Cu/(Cu+Co)=4/(4+4)=.5.

Change the record

Salvage falls to 0.

Compare the changed-record reasoning

Co 6, Cu 4, fractile.4. In this discrete distribution the optimal order remains 100 becauseF 60=.3 andF 100=.7.

2. Application

Find the optimal order with extra shortage penalty 8 per lost sale.

Compare the worked reasoning

Cu 12, Co 4, fractile.75, so order 140.

Change the record

Warehouse cap is 120.

Compare the changed-record reasoning

Expected marginal benefit remains positive between 100 and 140 under that penalty, so choose the feasible boundary 120. Atq 120, the three profit outcomes including penalty are 0,320,320, so expected profit is 224. Atq 100, the corresponding mean is 208; the cap binds below the unconstrainedq 140 optimum.

3. Transfer

Does a 90% no-stockout target select the profit optimum?

Compare the worked reasoning

No. It requires 140 here, while expected-profit optimum is 100.

Change the record

The target is relaxed to 70%.

Compare the changed-record reasoning

q 100 exactly meetsP(D≤100)=.7 and also maximizes the original expected profit. The agreement is specific to these costs and distribution.

Sources and scope