enhancement: moved optimization selection to _get_algorithm