def update_tr_radius(Delta, actual_reduction, predicted_reduction,
                     step_norm, bound_hit):
    if predicted_reduction > 0:
        ratio = actual_reduction / predicted_reduction
    else:
        ratio = 0

    if ratio < 0.25:
        Delta = 0.25 * step_norm
    elif ratio > 0.75 and bound_hit:
        Delta *= 2.0

    return Delta, ratio


# Construction and minimization of quadratic functions.
Get a network by cidr or raise if it does not exist.
dataset/ETHPy150Open scipy/scipy/scipy/optimize/_lsq/common.py/update_tr_radius--crossover with--dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/db/api.py/network_get_by_cidr