NivaarExam PrepOfficial exam papers ↗

23-Ind-A1 Operations Research · May 2016

Question 7 of 8: Dynamic Programming — Patrol Car Allocation

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

National Exams — May 2016 — 98-Ind-A1 Operations Research. Three-hour, open-book exam (any non-communicating calculator permitted); the paper totals 160 marks across 8 questions (each worth 20) and only 100 marks are required, so a candidate would normally answer 5 — all eight are solved below for completeness.

Reference texts: Hillier & Lieberman, Introduction to Operations Research (11th ed., McGraw-Hill) — linear programming and the revised simplex method (ch. 3–5), network optimization models (ch. 9), integer programming (ch. 12), decision analysis (ch. 16), and queueing theory (ch. 17).

Question 7: Dynamic Programming — Patrol Car Allocation (20 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

Given. 5 patrol cars to allocate among 3 precincts; expected crimes as a function of cars assigned, per precinct (table below).

Given data — crimes vs. cars assigned
Precinct0 cars12345
1251710410
2362720141211
3302012865

Find. The allocation $(x_1,x_2,x_3)$ with $x_1+x_2+x_3=5$ that minimizes total crimes, solved by (backward) dynamic programming.

x1=1 (17)x1=2 (10)x2=2 (20)x2=1 (27)x3=2 (12)x3=2 (12)total = 49S=5r=4r=3r=2 (a)r=2 (b)r=0Out
Fig. 7 — DP as a shortest-path network: both tied optimal allocations, $(1,2,2)$ and $(2,1,2)$, are shown converging to the same minimum-crime path (total 49).

Approach. Treat "cars remaining to allocate" as the DP state and the precincts as three stages; solve backward from precinct 3 to precinct 1, at each state keeping the best crime total for every possible number of cars still available.

  1. Stage 3 (last precinct). With $s$ cars left to give entirely to precinct 3, the best choice is always to use all of them (crimes strictly decrease with more cars): $f_3(s)=\text{crimes}_3(s)$.
    $f_3(s)$
    s012345
    $f_3(s)$302012865
  2. Stage 2. $f_2(s)=\min_{0\le x_2\le s}\big[\text{crimes}_2(x_2)+f_3(s-x_2)\big]$, evaluated for every $s=0,\dots,5$: $$f_2(5)=\min\{36{+}5,\,27{+}6,\,20{+}8,\,14{+}12,\,12{+}20,\,11{+}30\}=\min\{41,33,28,26,32,41\}=\boxed{26}\ \text{at } x_2=3.$$ The full table (needed because stage 1 can hand stage 2 any leftover from 0 to 5):
    $f_2(s)$ and best $x_2$
    s012345
    $f_2(s)$665647393226
    best $x_2$001123
  3. Stage 1 (all 5 cars). $f_1(5)=\min_{0\le x_1\le 5}\big[\text{crimes}_1(x_1)+f_2(5-x_1)\big]$: $$\min\{25{+}26,\ 17{+}32,\ 10{+}39,\ 4{+}47,\ 1{+}56,\ 0{+}66\}=\min\{51,49,49,51,57,66\}=\boxed{49}.$$ The minimum is tied at $x_1=1$ (giving $17+f_2(4)=17+32=49$) and $x_1=2$ (giving $10+f_2(3)=10+39=49$).
  4. Recover both optimal policies. For $x_1=1$: remaining $s=4\Rightarrow x_2=2$ (from the stage-2 table), remaining $s=2\Rightarrow x_3=2$, giving $(x_1,x_2,x_3)=(1,2,2)$, crimes $17+20+12=49$. For $x_1=2$: remaining $s=3\Rightarrow x_2=1$, remaining $s=2\Rightarrow x_3=2$, giving $(2,1,2)$, crimes $10+27+12=49$. Both use all 5 cars and both are optimal.
Final results — Question 7
ItemValue
Minimum total crimes49
Optimal allocation (a)$x_1{=}1,\ x_2{=}2,\ x_3{=}2$
Optimal allocation (b), tied$x_1{=}2,\ x_2{=}1,\ x_3{=}2$