Added mechanism to check wether optimal solution has been found, implemented mechanism to check when messages have globally converged