Heuristics, and the Horizon That Moves

Manuel D. Rossetti, PhD P.E.

Agenda

  • Why anyone uses a heuristic when an optimal algorithm exists
  • Three rules that are one procedure
  • What each costs on the belt
  • When none of this is worth doing
  • The rolling horizon, where the guarantee disappears

An Uncomfortable Question

An optimal algorithm exists. It is not slow. It fits on half a page.

So why is almost every planning system in the field running something else?

The answer is not running time.

It Is Assumption Two

The recursion needs \(d_1\) through \(d_N\) before it can compute \(V(N)\), because \(V(N)\) depends on every window cost, and every window cost depends on the requirements out to period \(N\).

Those requirements are a forecast.

The decision that actually gets made is the one for period 1. And it has been made to depend on a number twelve periods out that nobody believes.

A heuristic that looks only a few periods ahead makes the period 1 decision from data the planner can believe.

Three Rules, One Procedure

Start an order in period 1 and extend the window one period at a time. At each step compute a figure of merit, and stop when it stops improving.

Whatever period the window reached, the next order starts in the one after it, and begin again.

Rule Figure of merit for \([t,u]\) Stop when
Silver-Meal \(w(t,u)/(u-t+1)\), cost per period it rises
Least unit cost \(w(t,u)/d[t,u]\), cost per unit it rises
Part-period balancing \(w(t,u) - k_t\), what the window carries it passes \(k_t\)

All three use the same window costs the recursion used. That is what makes the comparison a comparison.

What Each Rule Is Imitating

Silver-Meal minimizes cost per period. The reasoning appeals to the EOQ, where the quantity minimizing cost per unit time is optimal because every cycle is identical. Here they are not, so this is a local imitation of that argument, not a consequence of it.

Least unit cost minimizes cost per unit. Older, more intuitive, since a buyer thinks in dollars per piece. It tends to order larger quantities, because adding a period always adds units to the denominator.

Part-period balancing extends until accumulated carrying is as close as it can get to \(k_t\), imitating the equal-terms property of the EOQ. Dividing by \(h\) turns carrying into a count of part-periods, which is where the name comes from.

One Implementation Difference

Silver-Meal and least unit cost walk a number to a minimum and keep the period before the first rise.

Part-period balancing walks a number past a target, then keeps whichever of the last two came closer.

It can step back. Write it that way.

The First Window, Three Ways

\(k/h = 300\), so part-period balancing extends until the window carries about 300 belt-months.

\(u\) \(w(1,u)\) Silver-Meal Least unit cost Part-period
1 300 300.00 7.500 0
2 360 180.00 3.600 60
3 600 200.00 2.727 300
4 1,500 375.00 2.885 1,200

Silver-Meal stops at \(u=2\). Cost per period rises from $180 to $200. Orders 100.

Least unit cost goes to \(u=3\), where $2.727 a belt is least. Orders 220.

Part-period balancing carries exactly $300 at \(u=3\). Nothing can come closer. Also orders 220.

The Three Plans

\(t\) 1 2 3 4 5 6 7 8 9 10 11 12
\(d_t\) 40 60 120 300 420 260 120 40 0 80 180 220
Silver-Meal 100 0 420 0 840 0 0 0 0 260 0 220
Least unit cost 220 0 0 720 0 380 0 300 0 0 0 220
Part-period 220 0 0 720 0 420 0 0 0 260 0 220
Optimal 220 0 0 300 420 420 0 0 0 260 0 220

All three place five orders. The optimum places six.

That is the first surprise. The heuristics are not ordering too often.

They are ordering too seldom, and the carrying that buys is what costs them.

Where Silver-Meal Loses Its Money

The 840 in month 5. Extending from month 5, the cost per period runs

\[ 300.00, \quad 280.00, \quad 266.67, \quad 230.00, \quad 184.00 \]

and only then rises to 220.00 at month 10.

It never rises through the whole run, so the rule never stops.

Months 6 through 8 have falling requirements and month 9 has none at all, so each additional period adds almost nothing to the numerator while adding a full period to the denominator.

The average keeps falling because the window is getting longer, not because the plan is getting better.

That is the failure mode of a cost-per-period rule, and it is triggered by a declining tail and a dead period: exactly the shape of a seasonal item going into its off season.

Everything On One Item

Method Orders Setup Carrying Cost Penalty
Lot-for-lot 11 $3,300 $0 $3,300 +33.06%
Least unit cost 5 $1,500 $1,540 $3,040 +22.58%
Periodic order quantity, \(T=2\) 6 $1,800 $960 $2,760 +11.29%
Silver-Meal 5 $1,500 $1,160 $2,660 +7.26%
Adjusted economic order quantity 6 $1,800 $800 $2,600 +4.84%
Part-period balancing 5 $1,500 $1,100 $2,600 +4.84%
Wagner-Whitin 6 $1,800 $680 $2,480 optimal

Read That Table Carefully

It does not say what a table like this is usually taken to say.

Silver-Meal, which the literature reports as the best of the three heuristics on average, is beaten here by part-period balancing and by an adjusted economic order quantity computed from the average requirement.

One instance settles nothing.

What it does show is how far apart the methods can land on a single item: part-period balancing gives away 4.84% and least unit cost 22.58%, so the choice among the three heuristics is worth nearly eighteen percentage points here.

When None of This Is Worth Doing

If the requirements barely vary, the EOQ already has the answer and this chapter is an elaborate way of reproducing it.

\[ VC = \frac{\frac{1}{N}\sum_t (d_t - \bar{d})^{2}}{\bar{d}^{2}} \]

Dimensionless, so it does not matter whether you count belts or pallets. A perfectly level requirement gives \(VC = 0\).

Rule of thumb: \(VC < 0.2\) calls for an EOQ; \(VC \ge 0.2\) calls for the methods of this chapter.

For the belt, \(\bar{d} = 153.33\) and the variance is 14,555.6:

\[ VC = \frac{14{,}555.6}{153.33^{2}} = \mathbf{0.619} \]

But It Is a Rule of Thumb

Well past the threshold.

And yet the adjusted economic order quantity landed within 4.84% of optimal at \(VC = 0.619\).

Which is better than the rule would lead you to expect.

The threshold is a convention, not a theorem.

How Wrong Can the Cost Ratio Be?

Solve the belt with a ratio \(k/h\) that is wrong by a factor \(m\), then charge the resulting plan at the true costs.

\(m\) 0.25 0.5 0.75 1 1.5 2 4
Orders 9 9 7 6 4 4 3
Cost $2,800 $2,800 $2,540 $2,480 $2,660 $2,660 $3,280
Penalty 12.90% 12.90% 2.42% 0% 7.26% 7.26% 32.26%

A factor of two in either direction costs less than 13%. The flatness of the EOQ cost curve survives the move to discrete periods.

Two Features of That Table

The curve is not smooth. The number of orders is an integer, and the plan does not change at all over a range of \(m\).

Doubling and halving are not symmetric. At \(m = 2\) the plan has four orders and costs 7.26%; at \(m = 0.5\) it has nine and costs 12.90%.

Ordering too often is the more expensive mistake on this item, since every extra order costs a full $300 while the carrying it saves is spread thin.

Now Put Two Tables Side by Side

The penalty for using Silver-Meal instead of the optimum: 7.26%.

The penalty for getting the cost ratio wrong by a factor of two: 7.26%.

An organization that has not measured \(k\) to within a factor of two, and most have not, is not in a position to care which method it uses.

The Rolling Horizon

Everything so far assumed a horizon that ends. The belt’s year is planned, the plan is executed, and the problem is over.

No item is planned that way.

What happens: the planner solves over the next \(N\) periods, places only the order for the current period, waits a period, and solves again over a horizon that has moved forward one period and acquired a new last period.

The plan for periods 2 through \(N\) was never executed. It existed to inform the decision for period 1.

Two Things Follow Immediately

Only the first decision matters. The quality of a method is the quality of the sequence of first decisions it produces, not the quality of the plans it produces.

Wagner-Whitin is no longer optimal.

It is optimal for the problem it was handed, and the problem it was handed is a truncation of the real one.

What the Truncation Costs

Roll the belt: at each month, solve over the next \(W\) months, place that month’s order, move on.

Planning window \(W\) 2 3 4 5 6
Silver-Meal $2,640 $2,840 $2,660 $2,660 $2,660
Wagner-Whitin $2,640 $2,480 $2,480 $2,480 $2,480

Wagner-Whitin reaches the full-horizon optimum at a window of three months and stays there.

That is the forcing property doing its work. Month 5 forces an order, so the decision for month 4 cannot be improved by anything beyond month 5.

And Look at Silver-Meal

It never reaches the optimum, and its cost is not even monotone in the window.

A three-month window costs it $200 more than a two-month window.

Let us understand that rather than explain it away.

Lengthening the window gives the rule more periods to average over, and averaging over more periods is precisely what drives its cost-per-period down and its windows too long.

A longer horizon is not always better information for a rule that was not built to use it.

Does the Heuristic Ever Win?

It is often said that under a rolling horizon a heuristic can beat the optimal algorithm, since neither is optimal for the real problem.

The claim is true as stated. It is easy to read it as a claim about how the two typically compare. That is a different claim.

Settle it by measurement: 2,000 twelve-period schedules, requirements drawn at random, rolled under both rules.

Window SM cheaper WW cheaper Tied Mean, SM Mean, WW
3 360 704 936 $1,440.91 $1,429.90
4 246 886 868 $1,395.74 $1,375.08
6 71 1,062 867 $1,383.20 $1,350.14

Reading the Study

Silver-Meal does win, 360 times out of 2,000 at a three-period window. The claim is not empty.

The two rules tie about 45% of the time, because on many schedules they make the same first decision every period.

When they differ, the algorithm is ahead about two to one at a three-period window and about fifteen to one at six.

On average the algorithm is cheaper at every window length, by 0.8% to 2.4%.

The rolling horizon does not rescue the heuristic. What it does is remove the guarantee, which turns a proof into an empirical question, and the empirical answer here still favours the algorithm.

A Cost the Tables Do Not Show

Each period the plan is recomputed, and the new plan may disagree with the old one about orders that have not been placed yet.

Suppliers were told to expect 300 belts in month 7, and now the plan says 0.

That instability is called nervousness, and it is expensive in ways that appear in no cost equation.

Part of it comes from the method. Silver-Meal orders 100 belts in month 1 at every window length from two to six. Wagner-Whitin orders 100 at a two-month window and 220 at every longer one.

The heuristic is steadier here, because it never looks far enough ahead for a distant period to change its mind.

Three Devices Against It

A freeze fence fixes the plan for the first several periods and forbids the next solve from changing them. It converts instability into inflexibility, which is sometimes the better problem.

A time fence is softer: inside it, changes need approval; outside it, the plan may move freely.

A change penalty adds a cost for every order differing from the previous plan. The previous plan becomes part of the data.

The third is the most direct treatment and the least used, for exactly that reason.

What We Did Today

Heuristics exist because the recursion needs a forecast, not because it is slow.

Three rules are one procedure with three stopping conditions, and they order too seldom, not too often.

Silver-Meal fails on a declining tail followed by a dead period, which is the shape of a seasonal item going into its off season.

Method error and parameter error are the same size here: 7.26% either way.

The rolling horizon removes the guarantee and turns the comparison into an empirical question.

For Next Time

Read before next session: Demand You Should Not Forecast, The Bill of Material, and The MRP Record.

Everything so far assumed demand was observed. Next session it is calculated, from a production schedule one level up.

Next session:

  • Why forecasting dependent demand throws away information you already have
  • The bill of material, and low-level codes
  • The six-row record, and the \(\max\) that is the whole idea
  • The explosion, and the single most common error in working one by hand

The methods of this chapter do most of their real work inside requirements planning. That is where we are going.

⌂ Index