Evan bio photo

Evan

Noticing Birds.

Email LinkedIn Public Key Github

Just flew back from New York, and boy are my arms tired.

I hadn’t been to NYC as an adult, so this was a real treat of a trip.

I was able to visit with college friends, look at the fancy pigeons, and eat street meats.

What started inspired this trip was not a desire to see piles of garbage on the sidewalk, but a small, money making scheme of mutual interests.

New York Hustle

New York has a docked bike-share program maintained by CitiBike. With tons of tourists, and 1.6MM commuters coming into the city each day, the bikes become unevenly distributed, reducing the value of the bike share system.

To supplement manual movers, CitiBike runs a ‘bike-angel’ program, to incentivize people to move bikes from areas of high concentration to areas of high demand. Incentives include stickers, pins, extra time on one’s membership, and ‘points’ redeemable for cold hard cash.

When I learned about the bike-angel concept I was excited at to possibility of getting paid to ride bikes in New York, and being able to use my computer science skills to increase my earnings.

Spherical Cow in a Frictionless Vacuum

The above points are awarded by picking up bikes from high concentration areas and moving them to areas that need bikes. Citibike distributes a feed of points as a JSON file consisting of a hash, where the keys are station ids, and the points are the values. The values range from -3 to 3. Negative numbers are earnable pick-up points, positive numbers are drop-off points. Zero is neutral. Using this lovely one-liner, I was able to find all the maximal points that could be earned under ideal conditions.

JSON.parse(open(url).read)['stations'].values.reject(&:zero?).group_by{ |s| s>0 }.values.map{ |a| a.sort_by(&:abs).reverse }.inject(&:zip).map{ |d| d.compact.map(&:abs).inject(:+) }.inject(&:+)

For a random sample, that’s 558 points. Given that each point is worth about 10 cents, and scores are valid for 1/2 hour, and I can move all the bikes between stations in a half hour(frictionless vacuum), this comes to about $100/hr, to ride bikes.

With the possible money-making opportunities, I booked tickets two weeks out and started on creating a solution.

Adding Friction

Given that I haven’t invented a teleporter, I needed a way to calculate the optimal route between all the station pairs. Fun fact, this is not Traveling Salesman. While similar, Evan’s bicycling program EBP is different from TSP. Easier is that I don’t need to finish my route where I started. Even easier is that “cities” can only be visited in certain pairs, reducing the search space. Harder is that I need to regenerate my route map every 30 minutes.

To start, I spun up a small rails app on Heroku that would pull the station scores, and find the optimal routes between stations. I used a giant SQL query to calculate a ‘wage’ for routes, based on 10c per point, and time to bicycle between stations calculated with PostGIS using ST_DISTANCE.

The median wage was about $14 and the high-value pairs were in the mid-twenties, so not too bad.

Adding Air Resistance

Citibike’s covers a large city with tons of bridges, two rivers, three creeks, four islands, and two states.

To find all routes between 780 bike stations would be about 607,620 pairs(n!/(n -r)!). Which is more than any API would let me process in a reasonable amount of time.

Given that some routes could be including a short swim, I needed to get bicycling directions between stations. For this, I spun up the routing service from Mapzen. Mapzen’s routing service uses Open Street Map data to find the optimal bicycling directions between two points, giving a time, route, and distance.

Given that pick up and drop off stations are fairly dispersed throughout NYC, one doesn’t quite need to calculate all routes. As a heuristic, it would probably be stations fairly close together that would be traversed more often that stations further away. I prioritized all pairs within 1km of each other, then once that finished in about a day, stations between 1-2km from each other, and so on.

This gave me some real news.

While it improved accuracy, it also slashed wages, lowering the median revenue bike ride from the mid-twenties to about $6. It also lowered the distance of the median ride, decreasing the revenue of a given route by increasing rides that wouldn’t earn any money.

Realizing the Cow.

With all good things, there are rules. To end a segment, there is a two minute waiting period, lowering median wages to $4. One cannot return ‘negative points’ by moving bikes from high demand areas to low demand areas. This means that after completing a revenue trip, I’d have to walk to the next closest pickup/neutral station, which might not be for a mile.

Only annual members could participate in the bike angel’s program, which costs $163/yr, and is not refundable, and due upfront. Given the high startup costs and low potential earnings, I knew that this wasn’t going to be the good idea I thought it was.

mediocre routes

Discovering Competition

While in NY, I grabbed coffee with the Program Manager of the Bike Angle’s program. Collin Waldoch is a cool dude, who has a fantastic handle on this space.

It turns out the leader board is dominated by hobbyists who move bikes as a form of recreation. The bike angels have inspired legions of fanatical users who rearrange the bikes for the joy of bicycling.

To move faster, top angels utilize scooters and skateboards to ensure they can spend less time in nonrevenue service, and more time moving bikes.

The real challenge of the bike angels program is not the data side, determining points to assign to stations, it is in the product; how to describe the program, how to incentivize people to become a bike angel, getting development resources to integrate bike angles with CitiBike share, etc

Productizing Data Insight

While my goal was to earn fat stacks of cash by riding bikes, I did build a small amount of infrastructure to get this far. I’ve open sourced my code, which is just a giant SQL query, and some Heroku infrastructure.

Weird shapes in a list

The root page of the app shows the currently available optimal routes.

Most interesting is the routing data between the stations, which can be downloaded here.