Appendix A: Worked Tutorial Bank¶
A.1 Ride-Hailing¶
Environment:
Resources:
Demand:
Exam use:
Separate the information model from the decision model. Demand and travel-time predictions are information. Acceptance, assignment, and repositioning are decisions.
Expanded worked model
Decision point:
State \(S_k\):
time of day, vehicle locations, vehicle capacities/battery, open requests, traffic condition, charging-station availability
Decision \(x\in X(S_k)\):
Post-decision state \(S_k^x\):
vehicle commitments and positions after assignment/repositioning, before the next request or travel-time realization
Stochastic information \(\omega_{k+1}\):
Spatial demand pattern example
| Time | Typical origin density | Typical destination density | Operational implication |
|---|---|---|---|
| Morning | suburbs | downtown | preserve vehicles near residential pickup zones early |
| Evening | downtown | suburbs | reposition toward downtown before evening peak |
| Night | entertainment zones | mixed | value flexible nearby capacity |
Exam answer pattern:
The ride-hailing problem is stochastic because future requests and travel times are unknown. It is dynamic because every assignment changes future vehicle availability and future service quality.
A.2 Service-Time Distribution¶
Model answer:
A service-time density is nonnegative, often right-skewed, and characterized by central tendency and spread. Rare long services can create scheduling risk.
Worked buffer calculation
Suppose service time \(T\) has:
| Time | Probability |
|---|---|
| 20 | 0.5 |
| 40 | 0.3 |
| 100 | 0.2 |
Expected time:
If the next appointment starts after 45 minutes:
Business interpretation:
A.3 Pizza Delivery State¶
Tutorial state:
Expanded state:
Full MDP answer
| MDP element | Pizza delivery answer |
|---|---|
| Decision point | each new order, each dispatch opportunity, or every few minutes |
| State \(S_k\) | current time, three driver statuses, current routes, open orders, locations, order times |
| Decision \(x\) | dispatch now or wait; assign orders to drivers; update routes |
| Cost \(R(S_k,x)\) | delay, travel time, lateness penalty, service-quality penalty |
| Post-decision state \(S_k^x\) | routes and driver availability after dispatch decision |
| Stochastic information \(\omega_{k+1}\) | new orders, prep completion, travel-time realization |
| Objective | minimize expected total delay/cost |
Common mistake:
Do not put future unknown pizza orders into \(S_k\). Future orders are \(\omega_{k+1}\).
A.4 Trucks & Barges¶
MDP:
Decision points: each day
State: day, yard containers, destinations, due dates, known future containers
Decision: truck, barge, train, or hold
Cost: transport, setup, lateness, clean-up
Post-decision state: yard after shipments
Stochastic information: random arrivals and clean-up costs
Objective: minimize expected total cost
Policy Function Approximation rule design
The tutorial describes PFA implementation through filters, rules, and conditions. A business-friendly PFA can be written as:
If container is urgent and barge is not soon available, use truck.
If many containers share a destination and barge departure is soon, use barge.
If due date is far away and yard capacity is not tight, hold.
Formal policy:
where \(\theta\) contains thresholds such as urgency cutoff, minimum barge fill, or maximum holding days.
Worked rule comparison
| Rule | Merit | Risk |
|---|---|---|
| ship urgent containers by truck | avoids delay penalties | expensive if overused |
| consolidate non-urgent containers by barge | lowers unit cost | may miss deadlines |
| hold low-priority containers | preserves cheap transport option | increases yard congestion |
Exam phrase:
A PFA is suitable when the policy can be expressed as operational rules using filters and conditions. It is fast and interpretable, but it may fail if thresholds are poorly tuned.
A.5 Dynamic Knapsack¶
State:
Decision:
PFA:
VFA insight:
PFA threshold example
| Offer | Money | Space | Ratio | PFA decision |
|---|---|---|---|---|
| A | 3 | 2 | 1.5 | accept |
| B | 2.5 | 3 | 0.83 | reject |
| C | 1 | 1 | 1.0 | reject if strict |
CFA reserved-capacity example
Suppose 3 decision points remain and the rule reserves 2 capacity units per remaining decision point:
If current capacity is 7, accepting a 3-space offer leaves 4, which violates the reserve. A CFA can add a penalty so the static knapsack behaves more future-aware.
MSA / look-ahead example
Sample three future offer streams. For each current decision, solve the current-plus-future knapsack. Implement only the current accept/reject decision with the best average value. This is anticipatory because it uses possible future offers, but it is more expensive than a simple threshold rule.
VFA lookup-table example
The tutorial's VFA idea stores values for post-decision features such as time and remaining capacity:
If accepting an item gives money 2 and leaves capacity 4, while rejecting leaves capacity 5:
| Decision | Current money | Approx future value | Total |
|---|---|---|---|
| accept | 2 | \(\hat{V}(t+1,4)=3\) | 5 |
| reject | 0 | \(\hat{V}(t+1,5)=6\) | 6 |
VFA rejects because keeping capacity has higher estimated future value.
A.6 Newsvendor-Style Stocking Decision¶
Problem:
Cost:
Expected-cost idea:
Mini calculation:
| Demand | Probability | Cost if q=10 |
|---|---|---|
| 8 | 0.3 | 4 |
| 10 | 0.4 | 0 |
| 14 | 0.3 | 12 |
A.7 Exam-Style MDP Graph Calculation¶
Use this for tutorial graph questions.
Step 1: terminal values
Step 2: post-decision values
For a post-decision state with two possible next states:
Step 3: state values
For minimization:
For maximization:
Mini worked example
| Decision | Immediate cost | Next value if low | Next value if high | Probability low/high | Total expected cost |
|---|---|---|---|---|---|
| A | 5 | 10 | 20 | 0.5 / 0.5 | 20 |
| B | 8 | 6 | 10 | 0.5 / 0.5 | 16 |
Calculation:
Choose B in a minimization problem.
A.8 Tutorial-to-Exam Translation Table¶
| Tutorial example | Likely exam task | Key answer ingredients |
|---|---|---|
| ride-hailing | identify information vs decision model | environment/resources/demand; accept/assign/reposition |
| service-time PDF | describe uncertainty distribution | nonnegative, right-skew, mean/spread/tail risk |
| pizza delivery | define MDP | state, decision, post-decision state, stochastic transition |
| Trucks & Barges | model MDP or design PFA | daily decision point, shipping modes, filters/rules |
| dynamic knapsack | compare ADP methods | PFA threshold, CFA reserve, MSA samples, VFA lookup |
| MDP graph | calculate values/policy | backward recursion, expected post-decision values |