Class: Wallace::Koza::Operators::SubtreeCrossoverOperator

Inherits:
Operator
  • Object
show all
Defined in:
lib/modules/koza/operators/subtree_crossover_operation.rb

Overview

The subtree crossover operator takes two parent koza trees, selects a sub-tree from each of them at random and swaps them to give two offspring.

Instance Method Summary collapse

Methods inherited from Operator

#operate

Constructor Details

#initialize(id, inputs, max_tries) ⇒ SubtreeCrossoverOperator

Constructs a new subtree crossover operator.

Parameters:

  • id, the unique identifier for this operator.

  • inputs, an array of inputs (OperatorInput) to this operator.

  • max_tries, the maximum number of tries at recombining individuals before the inputs are returned.



13
14
15
16
# File 'lib/modules/koza/operators/subtree_crossover_operation.rb', line 13

def initialize(id, inputs, max_tries)
  super(id, inputs)
  @max_tries = max_tries
end