How to let the computer choose the best plan: decision variables, an objective and constraints; the feasible region and its corners; solving a linear program with PuLP; and reading what the solution says about the scarce resources.
Slides¶
Present full screen Download the PDF
Click or tap the slide to move forward, its left edge to go back; the arrow keys work too.
Reading¶
Optimization Modeling: The Best Product Mix builds the weekly plan of Qahwa House’s central kitchen step by step: the roastery alone as a two-variable model drawn on a graph, the same model in PuLP, then all four products and three resources read from a table. It shows why making as much as possible of the highest-margin product earns 6,900 SAR a week less than the best plan, and what an infeasible or unbounded model is telling you.
Lab 9: Product mix model in PuLP¶
The central kitchen in Al-Kharj roasts two coffees and bakes two pastries for the four branches, with only so many roaster, oven and staff hours. The manager’s instinct is to make as much Yemeni Haraz as the branches will take, because it earns the most per batch. You write the model in words, solve it in PuLP, check it on the graph, compare it with the manager’s plan, and find out why two promises to customers cannot both be kept. This is midterm week, so the lab is shorter than usual.
Open the lab, then use its Open in Colab button. Its first cell installs PuLP and the HiGHS solver in Colab.
Data: qahwa
_roastery _mix .csv (four products, plus a last row with the hours available each week). The notebook downloads it by itself. Submit before the next lab session. The solutions are for checking your work afterwards.
Next week¶
Sensitivity analysis and duality: what one more hour of a scarce resource is worth, and how far a number can move before the best plan changes.