Data available from google elevation API
Need a poltly acount for fancy visulization.
def Search(Point a, step r, slope s):
find all the point(in 36 different direction) on the cycle centered at a, radius = r.
claculate the slope
If (all slope is negative):
return
Else:
find the 3 point with slope closet to s
a.record(b,c,d)
search(b),search(c), search(d)
Slope is
Optimization:
-
Keep tracking the variance of slopes on each ski track, terminate the search in advance for those with high variance.
-
recurrence with memorization to avoid repited computation.
Among the paths we randomly searched, our goal is to find those satisfy two objective:
- The trail slope is close to the given area
The hinge loss is applied, there's a linear penalty for the slopes exceeding:
- The terrian roughness is as small as possible
We use the standard deviation of slopes on the path:
$$L_2 = \sigma_{a} ={\sqrt {{\frac {1}{N}}\sum {i=1}^{N}(S{i}-\bar{S})^{2}}},{\rm {\ \ where\ \ }}\bar{S} ={\frac {1}{N}}\sum {i=1}^{N}S{i}$$
In order to get the overall loss function, we normalize each of above objective and add them together.
randomly choose 5000 starting point and find the coresspoing paths.
Find 10 best path with the smallest cost