@crossover
def simulated_binary_crossover(random, mom, dad, args):
    crossover_rate = args.setdefault('crossover_rate', 1.0)
    if random.random() < crossover_rate:
        di = args.setdefault('sbx_distribution_index', 10)
        bounder = args['_ec'].bounder
        bro = copy.copy(dad)
        sis = copy.copy(mom)
        for i, (m, d, lb, ub) in enumerate(zip(mom, dad, bounder.lower_bound, bounder.upper_bound)):
            try:
                if m > d:
                    m, d = d, m
                beta = 1.0 + 2 * min(m - lb, ub - d) / float(d - m)
                alpha = 2.0 - 1.0 / beta**(di + 1.0)
                u = random.random() 
                if u <= (1.0 / alpha):
                    beta_q = (u * alpha)**(1.0 / float(di + 1.0))
                else:
                    beta_q = (1.0 / (2.0 - u * alpha))**(1.0 / float(di + 1.0))
                bro_val = 0.5 * ((m + d) - beta_q * (d - m))
                bro_val = max(min(bro_val, ub), lb)        
                sis_val = 0.5 * ((m + d) + beta_q * (d - m))
                sis_val = max(min(sis_val, ub), lb)
                if random.random() > 0.5:
                    bro_val, sis_val = sis_val, bro_val
                bro[i] = bro_val
                sis[i] = sis_val
            except ZeroDivisionError:
                # The offspring already have legitimate values for every element,
                # so no need to take any special action here.
                pass
        return [bro, sis]
    else:
        return [mom, dad]
Return the offspring of simulated binary crossover on the candidates.
dataset/ETHPy150Open aarongarrett/inspyred/inspyred/ec/variators/crossovers.py/simulated_binary_crossover