Hacker News new | ask | show | jobs
by anderskaseorg 2298 days ago
If you’re looking for a more practical algorithm: this problem can be formulated as a shortest path problem on the graph whose vertices are (n, fret, finger, string) tuples. A simple dynamic programming solution is to fill out a distance table whose entry distance[n, fret, finger, string] is the optimal cost of the prefix of the melody ending at note n, which can be computed as 0 if n = 1, or in terms of the entries for note n − 1 if n ≥ 2.
2 comments

I agree with that and I definitely will try.

As explained in the first comment, one of the motivations for the project was to learn constraint programming. The tablature generator could be a nice example to compare different paradigms and algorithms.

How did you learn this. Math undergrad? Comp sci? Something else?
This example is directly mentioned in MIT Introduction to Algorithms, I would recommend it - https://ocw.mit.edu/courses/electrical-engineering-and-compu...
You would definitely cover some graph and dynamic programming algorithms in a good introductory algorithms course.
This is one of the only huge benefits of formal CS education — those basic algorithm and discrete math courses make some problems trivial.
Check out Coursera's algorithms specialization: https://www.coursera.org/specializations/algorithms