Skip to content

Instantly share code, notes, and snippets.

@macrintr
macrintr / gp_alter.py
Last active January 12, 2023 15:04
Removing "dummy" node need from STGP within DEAP
"""
File name: gp_alter.py
Author: Thomas Macrina
Date created: 03/21/2014
Python Version: 2.7
Overwriting the generate() method within DEAP's gp.py
to remove the need for "dummy" nodes within strongly-typed
individuals.
@macrintr
macrintr / deap_functions_with_memory.py
Last active August 29, 2015 14:02
DEAP setup to create functions with memory
"""
Author: Thomas Macrina
Date created: 06/23/2014
Python Version: 2.7
Use global class to allow GP functions to access previous values
"""
import random
from operator import *
@macrintr
macrintr / deap_ephemerals_scoop.py
Last active August 29, 2015 13:59
Simple DEAP strongly-typed GP setup to demonstrate difficulties with ephemerals and scoop
"""
Author: Thomas Macrina
Date created: 04/15/2014
Python Version: 2.7
Simple DEAP strongly-typed GP setup to demonstrate
difficulties with ephemerals and scoop.
"""
import sys
@macrintr
macrintr / gp_from_string_fix.py
Last active August 29, 2015 13:57
Updating from_string method in DEAP gp.py PrimitiveTree class
"""
File name: gp_from_string_fix.py
Author: Thomas Macrina
Date created: 03/21/2014
Python Version: 2.7
Overwriting the from_string() method within DEAP's gp.py
to properly function with a strongly-typed primitive set.
line 30 corresponds to line 100 in gp.py v1.0.0