def get_factors(n_dim):
    """
    Helper function to get factors for Nelder-Mead optimizer, based on the dimension of the problem.
    """
    reflection_factor = 1.0
    expansion_factor = 1 + 2 / n_dim
    contraction_factor = 0.75 - 1 / (2 * n_dim)
    shrink_factor = 1 - 1 / n_dim
    return reflection_factor, expansion_factor, contraction_factor, shrink_factor