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.
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
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.”## 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.Type each answer into its blank to call it out. What is typed stays in this browser only; nothing is sent anywhere.
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.
| Question | Your 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 |
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.
| Demand | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| Days 1 to 7 | 434 | 224 | 220 | 361 | 72 | 284 | 429 |
| Days 8 to 14 | 156 | 224 | 295 | 206 | 379 | 86 | 174 |
| Days 15 to 21 | 386 | 191 | 250 | 130 | 539 | 218 | 181 |
| Days 22 to 28 | 277 | 172 | 179 | 173 | 116 | 307 | 469 |
| Days 29 to 35 | 226 | 349 | 336 | 204 | 236 | 514 | 451 |
| Days 36 to 42 | 415 | 280 | 479 | 203 | 205 | 239 | 238 |
| Days 43 to 49 | 98 | 182 | 111 | 282 | 190 | 330 | 292 |
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]
| Question | Your 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 |
| Question | Your answer |
|---|---|
| Claude Code's loaves a day | |
| How it got there |
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.
| Orders | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| Days 1 to 7 | 399 | 128 | 84 | 239 | 22 | 233 | 275 |
| Days 8 to 14 | 156 | 124 | 207 | 139 | 210 | 54 | 48 |
| Days 15 to 21 | 217 | 104 | 212 | 65 | 502 | 136 | 121 |
| Days 22 to 28 | 179 | 74 | 148 | 133 | 90 | 356 | 301 |
| Days 29 to 35 | 142 | 184 | 184 | 69 | 124 | 150 | 291 |
| Days 36 to 42 | 220 | 263 | 341 | 102 | 180 | 111 | 118 |
| Days 43 to 49 | 62 | 112 | 64 | 140 | 146 | 225 | 201 |
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]
| Question | Your 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 |
| Question | Your answer |
|---|---|
| Claude Code's loaves on day 50 | |
| How it got there |