Mutation Operations#

Summary#

|

RandTrMut

Perform the subtree mutation operation on the program.

RandPointMut

Perform the point mutation operation on the program.

RandHoistMut

Perform the hoist mutation operation on the program.

Methods#

|

class RandTrMut[source]#

Perform the subtree mutation operation on the program.

Subtree mutation selects a random subtree from the embedded program to be replaced. A donor subtree is generated at random and this is inserted into the original parent to form an offspring. This implementation uses the “headless chicken” method where the donor subtree is grown using the initialization methods and a subtree of it is selected to be donated to the parent.

__call__(prog, cond, prob=1, node_states=None, method=<class 'HyperGP.libs.utils.HalfAndHalf'>, **kwargs)[source]#

Call RandTrMut method.

Parameters:
  • prog – The individual

  • cond (ProgBuildStates) – The ‘cond’ will be pass to the ‘method’ to generate the random subtree

  • prob – The probability to perform the subtree mutation.

  • method – The method called to generate subtree, in which the fixed parameter types:(cond, node_states) will be passed to in this call.

Returns:

A new prog

class RandPointMut[source]#

Perform the point mutation operation on the program.

Point mutation selects a random node from the embedded program, replacing it by a random node from pset with the same arity.

__call__(prog, cond, prob=1)[source]#

Call RandHoistMut method.

Parameters:
  • prog – The individual

  • cond (ProgBuildStates) – Used to generate new node to make point mutation. The primitiveSet module should be in it.

  • prob – The probability to perform the subtree mutation.

Returns:

A new prog

class RandHoistMut[source]#

Perform the hoist mutation operation on the program.

Hoist mutation selects a random subtree from the embedded program, replacing it by a random subtree of the selected mutation subtree.

__call__(prog, prob=1)[source]#

Call RandHoistMut method.

Parameters:
  • prog – The individual

  • prob – The probability to perform the subtree mutation.

Returns:

A new prog