diff --git a/pymoo/operators/crossover/sbx.py b/pymoo/operators/crossover/sbx.py index d2f3a309..1150246f 100644 --- a/pymoo/operators/crossover/sbx.py +++ b/pymoo/operators/crossover/sbx.py @@ -70,7 +70,10 @@ def calc_betaq(beta): child2 = np.where(sm, c2, c1) # child for parent 2 # exchange children with given probability - b = np.random.random(len(prob_bin)) < prob_bin + b = np.bitwise_xor( + np.random.random(len(prob_bin)) < prob_bin, + X[0, cross] > X[1, cross] + ) child1, child2 = np.where(b, (child2, child1), (child1, child2)) # first copy the unmodified parents