cs-117 — The Poster Budget
| Field | Value |
|---|---|
| id | cs-117 |
| difficulty | Beginner |
| topics | optimization, formulation |
| lecture | lecture-30 |
| estimated time | 5-minute attempt + 10-minute discussion |
| prerequisites | none |
| objective | state inputs, outputs, and assumptions, then solve a small instance by hand |
| solution | held by the instructor; discussed after the attempt |
Problem
Maximise posters bought under a budget with two price options and a wall-length constraint. Write objective and constraints formally, then solve by hand.
Your deliverable is the enumerated answer, the space count, and the pruning rule with its measured effect. If the problem is ambiguous anywhere, state the assumption you are making and carry on — a stated assumption is part of a good answer.
Examples
- Input: budget 20; posters A price 5 reach 40 each, B price 4 reach 30; wall space 3 m, A needs 1 m, B needs 0.5 m
- Output: formulation: max 40a+30b s.t. 5a+4b<=20, a+0.5b<=3, integers >=0; best by enumeration: a=2,b=2 -> 140
Solve for the worked instance first. Then ask what would change if one number, name, or condition were replaced by something stranger.
What to notice
- Write objective and constraints BEFORE solving; then enumerate the small integer space honestly.
- Brute force is a legitimate algorithm when the space is honest about its size.
- Pruning is not cheating; it is arithmetic applied early.
Discussion starter
After the solution is revealed, the class spends five minutes on this prompt: "Which constraint is cheapest to check first, and why does order matter?"
Constraints and assumptions
- Difficulty: Beginner (no prior experience assumed).
- Topics: optimization, formulation.
- Classroom-scale inputs unless the problem says otherwise.
- Time-box: about five minutes for a first attempt; partial answers with clear reasoning are worth more than silent struggling.
- Optional stretch (not required): describe an alternative approach and say when it beats the obvious one.
Hints and extension
- First nudge: identify the pattern the worked instance uses before computing anything.
- If stuck after three minutes, write the input/output line you expect and trace the smallest example by hand.
- After the reveal, attempt the extension below before the next lecture.
- Extension challenge: Reformulate with a different objective and describe how the optimum moves.