Dwarakesh Baraneetharan

Computer Science  ·  Mathematics

Loading000
Skip to content
All work
01 / Bikeshare swap planner2026

A route planner for Citi Bike that works out where to swap bikes, so no leg of a long ride crosses the free-ride limit and starts charging by the minute.

2,507
stations, live
4 ms
to plan a trip
122
automated tests
Author
my role

Overview

Stack

  • TypeScript
  • Next.js
  • Cloudflare Workers
  • MapLibre
  • Playwright

Citi Bike gives annual members 45 minutes per ride and day pass riders 30, then charges by the minute. The official way around it is to dock the bike and pull it straight back out, which restarts the clock, but doing that well means knowing which docks will still have a free space when you arrive. Sampling the live feed, about 7% of the network cannot accept a bike at any given moment and another 12% is one or two riders away from that, so a planner that only knows where stations are sends you somewhere unusable roughly one time in five. DockHop runs a Dijkstra search over live dock counts instead, where an edge between two stations exists only if the ride fits inside the leg budget and the destination currently has room.

What I did

  1. 01Modelled the swap problem as a shortest path search over live availability, pricing the risk of a nearly full station in seconds so the search can trade that risk against detour time on its own.
  2. 02Ranked the docks at each end of a trip by routed walking time rather than straight-line distance, which changes the answer: a dock 148 m away on the far side of a closed campus is a ten minute walk, and one that looks 30 m further is three.
  3. 03Fitted the travel model to a month of published trip history, then measured that it beat a flat rate by five hundredths of a percentage point, and documented why the time buffer rather than the model is what actually keeps riders under the cap.
  4. 04Covered it with 79 unit tests and 43 browser tests, including a property test that asserts across 200 generated station networks that no planned leg can exceed the fare limit.
Next project

External Merge Sort

A textbook algorithm, measured