tune algorithm