CASE STUDY 02 · JOURNEY & CAPACITY MATHEMATICS

Intermediate TSD + Average + AP + Ratio

Campus Shuttle Timetable & Capacity Planner

Calculate a multi-leg journey, distinguish moving and overall average speed, generate departures and verify whether planned seats satisfy demand.

01 · PROBLEM DEFINITION

A timetable connects distance, time and demand

A campus shuttle travels from Main Gate to Library, CSE Block and Hostel. The three legs are 2.4 km at 24 km/h, 1.5 km at 18 km/h and 3.0 km at 30 km/h. Total dwell time at stops is eight minutes.

Morning departures start at 08:00 and repeat every 20 minutes for ten trips. Each shuttle has 48 seats and expected demand is 420 passengers. Demand across four one-hour windows follows the ratio 3:4:2:1. The planner must calculate journey duration, correct average speeds, departure times, minimum trips, occupancy and passengers per window.

Planning rule: retain consistent units. Speeds are kilometres per hour, while the timetable uses minutes; every leg time must therefore be converted.
02 · MULTI-LEG JOURNEY

Calculate time for each leg before adding

time = distance / speed
Leg 1: 2.4/24 hour = 0.10 hour = 6 minutes
Leg 2: 1.5/18 hour = 1/12 hour = 5 minutes
Leg 3: 3.0/30 hour = 0.10 hour = 6 minutes

Total moving distance is 6.9 km and moving time is 17 minutes. Adding eight minutes of dwell gives 25 minutes elapsed journey time. Dwell affects passenger arrival time but does not add distance.

Common unit error: Adding 8 directly to 17/60 mixes minutes with hours. Convert everything to one time unit before arithmetic.
03 · WEIGHTED AVERAGE SPEED

Do not average the three speed numbers directly

Moving average speed = total distance / total moving time
= 6.9 / (17/60) = 24.35 km/h

Overall average speed = total distance / total elapsed time
= 6.9 / (25/60) = 16.56 km/h

The arithmetic mean of 24, 18 and 30 is 24 km/h, but it gives each speed equal importance. The shuttle spends unequal distances and times at those speeds. The valid average is total distance divided by corresponding total time. Including dwell time produces a different operational average.

MeasureTime denominatorUse
Moving average17 minutesVehicle motion performance
Overall average25 minutesPassenger timetable
04 · ARITHMETIC PROGRESSION

Regular departures form an AP in minutes

a = 08:00 = 480 minutes after midnight
d = 20 minutes
nth departure = a + (n − 1)d
10th departure = 480 + 9×20 = 660 minutes = 11:00

The generated sequence is 08:00, 08:20, 08:40, 09:00, 09:20, 09:40, 10:00, 10:20, 10:40 and 11:00. Converting clock time to minutes makes ordinary AP arithmetic possible; divmod converts it back to hours and minutes.

05 · CAPACITY & PERCENTAGE

Round trips upward when capacity is a minimum

Minimum trips = ceil(420 / 48) = ceil(8.75) = 9
Planned seats = 10 × 48 = 480
Occupancy = 420/480 × 100 = 87.5%
Unused seats = 480 − 420 = 60

Nine trips provide 432 seats and are the mathematical minimum. Ten scheduled trips create a 60-seat buffer. Whether that buffer is adequate depends on arrival variation and desired service level, not only the average prediction.

06 · DISTRIBUTING INTEGER DEMAND

Use the ratio, then preserve the total

The ratio 3:4:2:1 contains ten parts. With 420 expected passengers, one part is 42, so the four windows receive 126, 168, 84 and 42 passengers. Their sum is exactly 420.

When a total is not divisible by the ratio sum, independent rounding can lose or create passengers. The program first assigns integer floors, then gives the remaining passengers to windows with the largest fractional remainders. This is a practical largest remainder allocation.

Verification: Every allocated value is a non-negative integer and the allocated sum must equal the original demand.
07 · PROGRAMMATIC VERIFICATION

Python program with explicit units

programs/campus-shuttle-planner.py
Loading source…

RouteLeg keeps each distance and speed together and derives minutes. Separate functions handle journey aggregation, clock formatting, AP departures and integer ratio allocation, making every formula independently testable.

08 · INTERACTIVE TRACING

Trace the plan from route to seats

  1. Calculate each leg.
  2. Combine movement.
  3. Build timetable duration.
  4. Calculate both averages.
  5. Generate departures.
  6. Check capacity.
  7. Distribute demand.
Current state

Press Next to begin.

09 · VERIFICATION STRATEGY

Test units and boundaries

Distance-time identity
For every leg, verify speed × time in hours reconstructs the original distance.
Average bounds
Moving average must lie between minimum and maximum moving speeds; overall average becomes lower when positive dwell is added.
AP difference
Convert departures to minutes and verify every consecutive difference equals 20.
Capacity boundary
Eight trips must be insufficient, nine sufficient and expected demand no greater than planned ten-trip capacity.
Ratio conservation
Test a non-divisible demand such as 423 and verify integer allocations still sum to 423.
10 · PRACTICE

Check the reasoning

How is moving average speed calculated?

Why are nine trips required for 420 passengers?

Extensions

  1. Calculate a return schedule using a required layover.
  2. Find the interval needed for 15 departures between 07:30 and 12:10.
  3. Add standing capacity with a maximum permitted occupancy percentage.
  4. Compare one large shuttle with two smaller vehicles using operating cost.
11 · INTERVIEW PREPARATION

Explain why each formula fits

Why is average speed not the mean of speeds?

Speeds contribute for different durations or distances. Total distance divided by total time automatically supplies the correct weighting.

Why convert clock time to minutes?

It turns time-of-day values into one numeric scale where AP addition and comparison are straightforward.

Why use ceiling for required trips?

The constraint is capacity at least equal to demand, and trips are indivisible. Ceiling gives the smallest integer satisfying that inequality.

Why can expected occupancy be insufficient for planning?

An average hides uneven arrivals. Peak-window demand, variation, delays and required service buffers must also be checked.

12 · KEY TAKEAWAY

Units and constraints decide the correct operation

Journey legs require compatible time units, average speed requires total distance over total time, regular departures use AP, capacity minima use ceiling and ratio allocations must conserve integer demand.