#include <Crossover.hpp>
Public Member Functions | |
Crossover (int iTries=5) | |
bool | crossover (Individual &ind1, Individual &ind2) |
Crossover::Crossover | ( | int | iTries = 5 |
) |
Creates a new object capable of performing crossover
[in] | iTries | The number of attempted swaps which may come back as invalid before the crossover is aborted |
bool Crossover::crossover | ( | Individual & | ind1, | |
Individual & | ind2 | |||
) |
Swaps a subtree in ind1 with a subtree in ind2 where the parent grammar symbol is the same (and thus the swap is valid). If the swap is invalid (ie. violates depth restrictions on either individual, another random swap is made.