Lecture 6.1 Recap

6.1: Working, Economic, and One-Time-Safety Stock · ISE 754, Fall 2026 · in class 12 November 2026

A recap answers what students found most difficult in their pre-class review of the lecture, along with anything the instructor adds. Blue Lecture panels quote the lecture; orange Another view panels look at the same idea from another side.

In class: seven weeks at the bakery

Added by the instructor Lecture 6.1, Sec. 4, Example 6

Lee Pharm has kept records for seven weeks: the demand on each of 49 days and, in Part 2, the orders received by each morning. The price and the cost are those of Example 6, $5 and $1 a loaf, and a demand not filled is lost. Each part is done twice, first without AI and then with Claude Code, so the two can be compared. The answers are taken up in class and are not on this page.

How each part runs: first without AI, then with Claude Code

  1. With Claude Code closed, find the lecture's code blocks that solve the part, in the order they run, and be ready to call them out.
  2. Write down your prediction of the answer before running anything, the Prior check of Lecture 1.2: “Does the answer land inside an estimate committed before the answer was seen?”
  3. Copy 6-inv-1.jl to work/lectures/, open the copy, and run its top cell and its Setup cell. In the script's own words: “Run a cell: click inside it, then press Alt+Enter.”
  4. Add a new cell at the end of the copy, starting with a line such as ## In class: seven weeks. Paste the data line below into it, copy in the code blocks you found, change only what the part needs, and run it.
  5. Only then open Claude Code, give it the same statement and data, and compare its answer, and how it got there, with yours.

Type each answer into its blank to call it out. What is typed stays in this browser only; nothing is sent anywhere.

Warm-up, by hand: a loaf that costs $3

For the 13 days of demand in Example 6, determine the number of loaves to bake each day if a loaf costs $3 to bake instead of $1, by putting the demands in order and counting up them as Example 6(e) does, and then check it with the lecture's code, changing only the cost.

The 13 days of demand, as Example 6 gives them once the customers turned away are added: 237, 214, 161, 146, 331, 159, 423, 332, 139, 327, 152, 98, 116.

QuestionYour answer
What a loaf over costs, and what a loaf under costs
The share of the days to count up to
Which demand in order
Loaves a day
Checked in code: loaves, and total profit over the 13 days

Part 1: one number of loaves, from the demand

Determine the number of loaves to bake each day that maximizes total profit over the 49 days, and its total profit, and compare it with baking 216 loaves each day, the mean and the median demand, and perfect prediction.

The bakery's demand, in loaves, on each of the 49 days, a week to a row: days 1 to 7 in the first row, 8 to 14 in the second, and so on.
Demand1234567
Days 1 to 743422422036172284429
Days 8 to 1415622429520637986174
Days 15 to 21386191250130539218181
Days 22 to 28277172179173116307469
Days 29 to 35226349336204236514451
Days 36 to 42415280479203205239238
Days 43 to 4998182111282190330292

The same 49 demands as a line of Julia, in day order:

d = [434, 224, 220, 361, 72, 284, 429, 156, 224, 295, 206, 379, 86, 174, 386, 191, 250, 130, 539, 218, 181, 277, 172, 179, 173, 116, 307, 469, 226, 349, 336, 204, 236, 514, 451, 415, 280, 479, 203, 205, 239, 238, 98, 182, 111, 282, 190, 330, 292]

Without AI Claude Code closed

QuestionYour answer
The code blocks that solve it, in order
Your prediction, written before running: loaves a day
Baking 216 loaves a day: total profit
Perfect prediction: total profit
Best number of loaves a day
Its total profit
Mean demand, and its total profit
Median demand, and its total profit
By hand, as Example 6(e): which demand in order
Safety stock, the best number less the mean

With Claude Code the same statement and data

QuestionYour answer
Claude Code's loaves a day
How it got there
Part 2: the morning's orders

Using the orders received by each morning, determine the linear rule on the orders that maximizes total profit, and its total profit, and the number of loaves to bake on day 50 if 350 orders have been received by the morning.

As in Part 1: the code blocks first, without AI, then Claude Code.

The orders received by the morning of each of the 49 days, a week to a row, as for the demand.
Orders1234567
Days 1 to 73991288423922233275
Days 8 to 141561242071392105448
Days 15 to 2121710421265502136121
Days 22 to 281797414813390356301
Days 29 to 3514218418469124150291
Days 36 to 42220263341102180111118
Days 43 to 496211264140146225201

The same 49 orders as a line of Julia, in day order:

o = [399, 128, 84, 239, 22, 233, 275, 156, 124, 207, 139, 210, 54, 48, 217, 104, 212, 65, 502, 136, 121, 179, 74, 148, 133, 90, 356, 301, 142, 184, 184, 69, 124, 150, 291, 220, 263, 341, 102, 180, 111, 118, 62, 112, 64, 140, 146, 225, 201]

Without AI Claude Code closed

QuestionYour answer
The code blocks that solve it, in order
Your prediction, written before running: loaves on day 50
Baking just the orders: total profit
The rule: intercept and slope
The rule's total profit
Loaves on day 50, with 350 orders
Least squares and least absolute deviation: total profit

With Claude Code the same statement and data

QuestionYour answer
Claude Code's loaves on day 50
How it got there