Added compare function to compare all algorithms and started the permutation optimization.