def _initialize_feasible(lb, ub):
    p0 = np.ones_like(lb)
    lb_finite = np.isfinite(lb)
    ub_finite = np.isfinite(ub)

    mask = lb_finite & ub_finite
    p0[mask] = 0.5 * (lb[mask] + ub[mask])
    
    mask = lb_finite & ~ub_finite
    p0[mask] = lb[mask] + 1
    
    mask = ~lb_finite & ub_finite
    p0[mask] = ub[mask] - 1

    return p0
dataset/ETHPy150Open scipy/scipy/scipy/optimize/minpack.py/_initialize_feasible/original