modular_robot

CPPNWIN genotypes for modular robots.

Subpackages

Package Contents

Classes

BrainCpgNetworkNeighbor

A CPG brain based on ModularRobotBrainCpgNetworkNeighbor that creates weights from a CPPNWIN network.

BrainGenotypeCpg

An SQLAlchemy model for a CPPNWIN cpg brain genotype.

BrainGenotypeCpgOrm

An SQLAlchemy model for a CPPNWIN cpg brain genotype.

class BrainCpgNetworkNeighbor(genotype: multineat.Genome, body: revolve2.modular_robot.body.base.Body)

Bases: revolve2.modular_robot.brain.cpg.BrainCpgNetworkNeighbor

Inheritance diagram of standards.genotypes.cppnwin.modular_robot.BrainCpgNetworkNeighbor

A CPG brain based on ModularRobotBrainCpgNetworkNeighbor that creates weights from a CPPNWIN network.

Weights are determined by querying the CPPN network with inputs: (hinge1_posx, hinge1_posy, hinge1_posz, hinge2_posx, hinge2_posy, hinge3_posz) If the weight in internal, hinge1 and hinge2 position will be the same.

class BrainGenotypeCpg

An SQLAlchemy model for a CPPNWIN cpg brain genotype.

brain: standards.genotypes.cppnwin._multineat_genotype_pickle_wrapper.MultineatGenotypePickleWrapper
classmethod random_brain(innov_db: multineat.InnovationDatabase, rng: numpy.random.Generator) BrainGenotypeCpg

Create a random genotype.

Parameters:
  • innov_db – Multineat innovation database. See Multineat library.

  • rng – Random number generator.

Returns:

The created genotype.

mutate_brain(innov_db: multineat.InnovationDatabase, rng: numpy.random.Generator) BrainGenotypeCpg

Mutate this genotype.

This genotype will not be changed; a mutated copy will be returned.

Parameters:
  • innov_db – Multineat innovation database. See Multineat library.

  • rng – Random number generator.

Returns:

A mutated copy of the provided genotype.

classmethod crossover_brain(parent1: typing_extensions.Self, parent2: typing_extensions.Self, rng: numpy.random.Generator) BrainGenotypeCpg

Perform crossover between two genotypes.

Parameters:
  • parent1 – The first genotype.

  • parent2 – The second genotype.

  • rng – Random number generator.

Returns:

A newly created genotype.

develop_brain(body: revolve2.modular_robot.body.base.Body) standards.genotypes.cppnwin.modular_robot._brain_cpg_network_neighbor.BrainCpgNetworkNeighbor

Develop the genotype into a modular robot.

Parameters:

body – The body to develop the brain for.

Returns:

The created robot.

class BrainGenotypeCpgOrm

Bases: sqlalchemy.orm.MappedAsDataclass

Inheritance diagram of standards.genotypes.cppnwin.modular_robot.BrainGenotypeCpgOrm

An SQLAlchemy model for a CPPNWIN cpg brain genotype.

brain: multineat.Genome
classmethod random_brain(innov_db: multineat.InnovationDatabase, rng: numpy.random.Generator) BrainGenotypeCpgOrm

Create a random genotype.

Parameters:
  • innov_db – Multineat innovation database. See Multineat library.

  • rng – Random number generator.

Returns:

The created genotype.

mutate_brain(innov_db: multineat.InnovationDatabase, rng: numpy.random.Generator) BrainGenotypeCpgOrm

Mutate this genotype.

This genotype will not be changed; a mutated copy will be returned.

Parameters:
  • innov_db – Multineat innovation database. See Multineat library.

  • rng – Random number generator.

Returns:

A mutated copy of the provided genotype.

classmethod crossover_brain(parent1: typing_extensions.Self, parent2: typing_extensions.Self, rng: numpy.random.Generator) BrainGenotypeCpgOrm

Perform crossover between two genotypes.

Parameters:
  • parent1 – The first genotype.

  • parent2 – The second genotype.

  • rng – Random number generator.

Returns:

A newly created genotype.

develop_brain(body: revolve2.modular_robot.body.base.Body) standards.genotypes.cppnwin.modular_robot._brain_cpg_network_neighbor.BrainCpgNetworkNeighbor

Develop the genotype into a modular robot.

Parameters:

body – The body to develop the brain for.

Returns:

The created robot.