Skip to content

Commit

Permalink
better soluation
Browse files Browse the repository at this point in the history
  • Loading branch information
Weixuan Fu committed Apr 7, 2017
1 parent 043d7dc commit f7324ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tpot/gp_deap.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,12 @@ def cxOnePoint(ind1, ind2):
else:
for idx, node in enumerate(ind1[1:], 1):
types1[node.ret].append(idx)
common_types = []
for idx, node in enumerate(ind2[1:], 1):
if node.ret in types1 and not node.ret in types2:
common_types.append(node.ret)
types2[node.ret].append(idx)

common_types = sorted([x for x in types1 if x in types2], key=lambda X: X.__name__)

if len(common_types) > 0:
type_ = np.random.choice(common_types)

Expand Down

0 comments on commit f7324ed

Please sign in to comment.