Skip to content

Instantly share code, notes, and snippets.

@Vaguery
Created December 3, 2010 14:09
Show Gist options
  • Select an option

  • Save Vaguery/726991 to your computer and use it in GitHub Desktop.

Select an option

Save Vaguery/726991 to your computer and use it in GitHub Desktop.
Feature: One-point uneven crossover works as specified
In order to combine "good ideas" that have arisen independently in different Pile scripts
As a symbolic regression modeler
I want crossover to snip scripts up and stick them back together
Scenario: crossover conserves the number of tokens
Given parent_1 is the Pile script "+ + + + + + + + + +"
And parent_2 is the Pile script "- - - - - - - - - -"
When I apply uneven one-point crossover to those parents
Then the result is a collection of 2 Pile scripts
And there should be 20 tokens altogether in the offspring
And the pooled tokens from both offspring should include 10 "+"
And the pooled tokens from both offspring should include 10 "-"
Scenario: crossover breakpoints are chosen with uniform probability
Given parent_1 is the Pile script "+ + + + + + + + + +"
And parent_2 is the Pile script "- - - - - - - - - -"
When I apply crossover to those parents (independently) many times
Then the minimum length of an offspring should be 0 tokens
And the maximum length of an offspring should be 20 tokens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment