You can also formulate the problem as a dynamic programming problem.
Here's a Java repo I made back in college solving the simpler problem: given a tab, what's the easiest fingering to play it? https://github.com/twschiller/optimal-guitar.
It works by modeling the (1) the difficulty of hand positions, and (2) transitions