a agorithm of finding path for MLN, It is a function to learn MLN randomly