Use a generic line search function in all algorithms