Algorithm to find the global optimum of left-to-right hidden Markov model parameters