Skip to content

Commit fad2e38

Browse files
retain original parent order (#730)
1 parent 9617129 commit fad2e38

File tree

1 file changed

+4
-1
lines changed
  • pymoo/operators/crossover

1 file changed

+4
-1
lines changed

pymoo/operators/crossover/sbx.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ def calc_betaq(beta):
7070
child2 = np.where(sm, c2, c1) # child for parent 2
7171

7272
# exchange children with given probability
73-
b = np.random.random(len(prob_bin)) < prob_bin
73+
b = np.bitwise_xor(
74+
np.random.random(len(prob_bin)) < prob_bin,
75+
X[0, cross] > X[1, cross]
76+
)
7477
child1, child2 = np.where(b, (child2, child1), (child1, child2))
7578

7679
# first copy the unmodified parents

0 commit comments

Comments
 (0)