Skip to content

Instantly share code, notes, and snippets.

@monking
Last active February 7, 2019 21:17
Show Gist options
  • Save monking/c0f68340eba759258d4b to your computer and use it in GitHub Desktop.
Save monking/c0f68340eba759258d4b to your computer and use it in GitHub Desktop.
Hack For LA 2014-05-31 concept

Terms

A 3D+ point is a point with latitude, longitude, elevation, and time components.

A 3D+ vector describes the angle and magnitude of the difference between two 3D+ points.

A route is a series of 3D+ points which connect to form a continuous path.

Algorithm

Score routes against given 3D+ points origin and destination

DEFINE drudge, a factor to convert lat/lng distances to a score

DEFINE wander, a factor to convert deviation from course to a score

DEFINE effort, a factor to convert elevation gain to a score

DEFINE patience, a factor to convert time to a score

DEFINE rush, a factor to convert lateness to a score

SET speed = 13mph

FOR each route

SET score to 0

FIND start, the nearest 3D+ point to origin

FIND finish, the nearest 3D+ point to destination

CREATE ride, a 3D+ vector using start and finish

CREATE commute, a 3D+ vector using origin and destination

FOR each 3D+ point step in route

GET next step

GET lean, 3D+ vector using step and next step

BUMP score by wander * difference between angle of commute and angle of lean

BUMP score by effort * elevation gain of lean

BUMP score by wander * difference between angle of commute and angle of ride * distance of ride

BUMP score by rush * (time of finish - (time of destination - distance between finish and destination / speed))

BUMP score by patience * difference between time of origin and time of start

BUMP score by patience * difference between time of finish and time of destination

SORT routes descending by score

Todo

  • improve penalty for arriving late
  • improve accounting for pleasant deviation
    • balance of elevation gain and loss
    • frequency of alternation between climbing and descending
    • maybe allow some configuration by the user of the conversion factors
  • can I refactor comparisons to leverage 4-component vectors' inherent qualities (i.e. angle & magnitude)?
  • ride around town and TRACK THAT $#!7 (emulate different commuter routes, criss-crossing, going back and forth)
  • use time-shifted playback of tracking as if it were realtime

I am a...

conductor, about to ride -> login as a conductor

cyclist, looking to join a train

Location services enabled on our domain?

Yes -> score routes (here, now, void, realtime)

No: realtime or anytime?

poke at the map or type a location -> score routes (somewhere, now, void, realtime/anytime)

see conductors moving on the map

login as a conductor

start tracking your train

stop tracking

@sherylj
Copy link

sherylj commented May 30, 2014

Hi,
This is a good documentation. I would like to join your team if possible.
I'm curious to know what dataset you want to use for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment