## Generated by Codox

# Propeller 0.3.2

# propeller.variation

Propeller includes many kinds of genetic operators to create variation within the population. You can specify the rate of the variation genetic operators with the `:variation` map.

# Variation

Propeller includes many kinds of genetic operators to create variation within the population. You can specify the rate of the variation genetic operators with the `:variation` map.

Some of the available genetic operators are described in this documentation. See the code for others and for details.

To add a new genetic operator you must add a case for the operator’s keyword in new-individual, calling existing or new utility functions that should be included earlier in this file.

## Crossover

Crossover genetic operators take two `plushy` representations of Push programs and exchange genetic material to create a new `plushy`.

Function | Parameters | Description
--- | --- | ---
`crossover` | `plushy-a` `plushy-b` | Crosses over two individuals using uniform crossover, one Push instruction at a time. Pads shorter one from the end of the list of instructions.
`tail-aligned-crossover` | `plushy-a` `plushy-b` | Crosses over two individuals using uniform crossover, one Push instruction at a time. Pads shorter one from the beginning of the list of instructions.

## Addition, Deletion, Replacement, Flip

Addition, deletion, replacement, and flip genetic operators take a `plushy` and a rate of occurrence to create a new `plushy`.

Function | Parameters | Description
--- | --- | ---
`uniform-addition` | `plushy` `instructions` `umad-rate` | Returns a plushy with new instructions possibly added before or after each existing instruction.
`uniform-replacement` | `plushy` `instructions` `replacement-rate` | Returns a plushy with new instructions possibly replacing existing instructions.
`uniform-deletion` | `plushy` `umad-rate` | Randomly deletes instructions from plushy at some rate.

## Uniform Mutation by Addition and Deletion

Uniform Mutation by Addition and Deletion (UMAD) is a uniform mutation operator which first adds genes with some probability before or after every existing gene and then deletes random genes from the resulting genome. It has been found that UMAD, with relatively high rates of addition and deletion, results in significant increases in problem-solving performance on a range of program synthesis benchmark problems. When you run a problem in Propeller, you can specify the `umad-rate` to determine the frequency of addition and deletion.

`:umad` in the `:variation` map when running a problem will call `uniform-addition` and `uniform-deletion` with the `umad-rate`. Since `uniform-addition` and `uniform-deletion` are somewhat stochastic, you can use `:rumad` to ensure that the actual rates of addition and deletion are equal when mutating a genome.

## New Individual

The function `new-individual` returns a new individual produced by selection and variation of individuals in the population based on the genetic operators provided in the `:variation` map.

### alternation

`(alternation genome1 genome2 alternation-rate alignment-deviation)`

Alternates between the two parent genomes.

### bmx

`(bmx plushy-a plushy-b rate max-distance argmap)`

Crosses over two plushies using best match crossover (bmx).

### crossover

`(crossover plushy-a plushy-b)`

Crosses over two individuals using uniform crossover, one Push instruction at a time. Pads shorter one from the end of the list of instructions.

### new-individual

`(new-individual pop argmap)`

Returns a new individual produced by selection and variation of individuals in the population.

### tail-aligned-crossover

`(tail-aligned-crossover plushy-a plushy-b)`

Crosses over two individuals using uniform crossover, one Push instruction at a time. Pads shorter one from the beginning of the list of instructions.

### uniform-addition

`(uniform-addition plushy instructions umad-rate argmap)`

Returns plushy with new instructions possibly added before or after each existing instruction.

### uniform-deletion

`(uniform-deletion plushy umad-rate)`

Randomly deletes instructions from plushy at a rate that is adjusted relative to the rate used for addition.

### uniform-gap-addition

`(uniform-gap-addition plushy gap-change-prob)`

Returns plushy with new instances of :gap possibly added within each gene, each of which is a subsequence of the plushy.

### uniform-gap-deletion

`(uniform-gap-deletion plushy gap-change-prob)`

Randomly deletes instances of :gap from plushy at a rate that is adjusted relative to the rate used for gap addition.

### uniform-replacement

`(uniform-replacement plushy instructions replacement-rate argmap)`

Returns plushy with new instructions possibly replacing existing instructions.