Ruby for Home-Ec
summary
Two concrete Ruby solutions show what actually happens: a ~20-line greedy_approximation script takes 64 cuts from 35 boards (three board lengths), accounts for kerf, and proves board order matters — one ordering leaves 17 cuts impossible, another makes all but one, and a third ordering makes every cut. A second short script sorts ~100 pantry jars (salsa verde = 20) using integer-safe division via mathn to evenly space common items. Both scripts run and output usable plans; code lives on Github.
AI-written summary · about
chapters (10)
- 0:00Start
- 4:36Method Greedy Approximation
- 8:45The Knapsack Problem
- 9:12Knapsack Problem
- 9:53Subset Sum Problem
- 10:51The Stock Cutting Problem
- 11:31Guillotine Stock Cutting Problem
- 26:27Animation
- 26:59Simulated Annealing
- 31:11How Do I Come Up with a Mathematical Algorithm








