I am actually working on a program of sorts. This program takes a user entered value that specifies how many white keys they can span with one hand on a piano. It then computes (based on research) the general reach from one finger to the next one can expect based on the main hand's reach. This information is then used to try and compute proper finger assignments for any combination of piano keys one must hit in an instant.
For example: Keys: 50, 52, 60, 90, 95 Would correspond to: fingers: 1, 2, 5, 6, 9 respectively
With the fingers starting at the left hand pinky (1) to the right hand pinky (10). This is all well and good, however I notice the simplistic approach of just taking the first key and finding the distance to the next key and using the first finger within reach causes the program to favor the left hand and the pinky specifically. So, I added in a bit of hysteresis whereby a moving average between the minimum key on the left hand is recorded and calculated from the previous iteration and used in the next. Here, I then apply the moving average and act as if the key is an active key that needs to be hit, only so I can keep the previous hands position in mind when calculating the finger assignment... This works out well, I first try to calculate the finger assignment with this moving average, and if successful, good, if not I increment the moving average by one key and try again. However, this has the result that I cannot apply a minimum to the right hand calculation.
In essence, I am basically trying to use hysteresis to minimize hand movement of the user from one key press iteration to the next. The confusion I have is that I would like to apply this minimization not just on the left hand calculation, but on the right hand as well. The problem is that the right hand calculation and thus minimization is dependent on the left hand's minimization calculation.
To make a long story short, what are some methods of applying minimum optimization to two functions whereby the optimization of the second depends on the optimization of the first?
P.S. I apologize for the verbosity of this question, but I just wanted to give a good idea of what I'm going for. If you need any further clarification, let me know and I'll edit my question, thank you.