from glyph import gp from glyph import utils from toolz import cons import sys import os sys.path.append(os.path.dirname(__file__)) import control_problem pset = gp.sympy_primitive_set( categories=["algebraic", "trigonometric", "exponential"], arguments=["y0", "y1"], constants=["c"], ) Individual = gp.Individual(pset=pset, name="Individual") class AssessmentRunner(assessment.AAssessmentRunner): """Define a measure for the fitness assessment. Uses constant optimization. Optimal values for the constants are stored to an individual's popt attribute. """ def setup(self): # Setup dynamic system. self.nperiods = 50.0 self.x = np.linspace(0.0, self.nperiods * 2.0 * np.pi, 2000, dtype=np.float64)
import operator import re import sys import dill import numpy as np import pytest import scipy.integrate from glyph import assessment from glyph import gp from glyph.utils.numeric import hill_climb, rms SingleConstIndividual = gp.Individual(pset=gp.sympy_primitive_set( categories=['algebraic', 'exponential', 'neg', 'sqrt'], arguments=['x_0'], constants=['c']), name="SingleConstIndividual", marker="sympy") TwoConstIndividual = gp.Individual(pset=gp.sympy_primitive_set( categories=['algebraic', 'exponential', 'neg'], arguments=['x_0'], constants=['c_0', 'c_1']), name="TwoConstIndividual", marker="sympy") UnlimitedConstants = gp.Individual(pset=gp.numpy_primitive_set( 1, categories=('algebraic', 'trigonometric', 'exponential', 'symc')), name="UnlimitedConstants", marker="symc")
def SympyIndividual(): return gp.Individual(pset=gp.sympy_primitive_set(constants=["c"]), name="SympyIndividual")
import re import sys import dill import numpy as np import pytest import scipy.integrate from glyph import assessment from glyph import gp from glyph.utils.numeric import hill_climb, rms SingleConstIndividual = gp.Individual( pset=gp.sympy_primitive_set( categories=["algebraic", "exponential", "neg", "sqrt"], arguments=["x_0"], constants=["c"]), name="SingleConstIndividual", marker="sympy", ) TwoConstIndividual = gp.Individual( pset=gp.sympy_primitive_set(categories=["algebraic", "exponential", "neg"], arguments=["x_0"], constants=["c_0", "c_1"]), name="TwoConstIndividual", marker="sympy", ) UnlimitedConstants = gp.Individual( pset=gp.numpy_primitive_set(1, categories=("algebraic", "trigonometric",
def NumpyIndividual(): # 13 for the boston data set return gp.Individual(gp.numpy_primitive_set(arity=13), "NumpyIndividual")