alogos.systems.cfggp.init_population

Initialization functions to generate a population for CFG-GP.

Functions

given_genotypes(grammar, parameters=None)

Create a population from given genotypes.

given_derivation_trees(grammar, parameters=None)

Create a population from given derivation trees.

given_phenotypes(grammar, parameters=None)

Create a population from given phenotypes.

random_genotypes(grammar, parameters=None)

Create a population from random genotypes.

gp_rhh(grammar, parameters=None)

Create a population with GP RHH.

pi_rhh(grammar, parameters=None)

Create a population with PI RHH.

ptc2(grammar, parameters=None)

Create a population with PTC2.


Detailed object descriptions

alogos.systems.cfggp.init_population.given_genotypes(grammar, parameters=None)[source]

Create a population from given genotypes.

Parameters:
  • grammar (Grammar)

  • parameters (dict or ParameterCollection) – Following keyword-value pairs are considered by this function:

    • init_pop_given_genotypes (list of Genotype objects or data that can be converted to a genotype) : A list of genotypes, which are used to initialize the individuals of the population. Note that the length of this list determines the size of the generated population.

Returns:

population (Population)

Raises:

InitializationError – If creating the population fails.

alogos.systems.cfggp.init_population.given_derivation_trees(grammar, parameters=None)[source]

Create a population from given derivation trees.

Parameters:
  • grammar (Grammar)

  • parameters (dict or ParameterCollection) – Following keyword-value pairs are considered by this function:

    • init_pop_given_derivation_trees (list of DerivationTree) : A list of derivation trees, which are used to initialize the individuals of the population. Note that the length of this list determines the size of the generated population.

Returns:

population (Population)

Raises:

InitializationError – If creating the population fails.

alogos.systems.cfggp.init_population.given_phenotypes(grammar, parameters=None)[source]

Create a population from given phenotypes.

Parameters:
  • grammar (Grammar)

  • parameters (dict or ParameterCollection) – Following keyword-value pairs are considered by this function:

    • init_pop_given_phenotypes (list of str) : A list of phenotypes, which are used to initialize the individuals of the population. Note that the length of this list determines the size of the generated population.

Returns:

population (Population)

Raises:

InitializationError – If creating the population fails.

alogos.systems.cfggp.init_population.random_genotypes(grammar, parameters=None)[source]

Create a population from random genotypes.

Parameters:
  • grammar (Grammar)

  • parameters (dict or ParameterCollection) – Following keyword-value pairs are considered by this function:

    • population_size (int)

    • init_pop_unique_genotypes (bool)

    • init_pop_unique_phenotypes (bool)

    • init_pop_unique_max_tries (int)

Returns:

population (Population)

Raises:

InitializationError – If creating the population fails.

alogos.systems.cfggp.init_population.gp_rhh(grammar, parameters=None)[source]

Create a population with GP RHH.

Parameters:
  • grammar (Grammar)

  • parameters (dict or ParameterCollection) – Following keyword-value pairs are considered by this function:

    • population_size (int)

    • init_pop_unique_genotypes (bool)

    • init_pop_unique_phenotypes (bool)

    • init_pop_unique_max_tries (int)

    • init_pop_gp_rhh_start_depth (int)

    • init_pop_gp_rhh_end_depth (int)

Returns:

population (Population)

Raises:

InitializationError – If creating the population fails.

Notes

See gp_rhh.

alogos.systems.cfggp.init_population.pi_rhh(grammar, parameters=None)[source]

Create a population with PI RHH.

Parameters:
  • grammar (Grammar)

  • parameters (dict or ParameterCollection) – Following keyword-value pairs are considered by this function:

    • population_size (int)

    • init_pop_unique_genotypes (bool)

    • init_pop_unique_phenotypes (bool)

    • init_pop_unique_max_tries (int)

    • init_pop_pi_rhh_start_depth (int)

    • init_pop_pi_rhh_end_depth (int)

Returns:

population (Population)

Raises:

InitializationError – If creating the population fails.

Notes

See pi_rhh.

alogos.systems.cfggp.init_population.ptc2(grammar, parameters=None)[source]

Create a population with PTC2.

Parameters:
  • grammar (Grammar)

  • parameters (dict or ParameterCollection) – Following keyword-value pairs are considered by this function:

    • population_size (int)

    • init_pop_unique_genotypes (bool)

    • init_pop_unique_phenotypes (bool)

    • init_pop_unique_max_tries (int)

Returns:

population (Population)

Raises:

InitializationError – If creating the population fails.

Notes

See ptc2.