These pages are auto-generated from self-documenting comments embedded in class files.
For more information on breve and steve, refer to the breve homepage.

## GeneticAlgorithmIndividual : GADirectedGraph

This class is included as part of the file DirectedGraph.tz.
To use this class in a simulation, include the line "@use DirectedGraph."

### Class description:

> GADirectedGraph is a special subclass of GeneticAlgorithmIndividual which maages directed networks of nodes for evolution. The primary use of these networks is to evolve creature morphologies. The networks are based on the the directed graphs used by Karl Sims in "Evolving Virtual Creatures" (1994). Multiple connections may exist between nodes, and nodes may have connections back to themselves.

> GAGraph makes use of a number of other classes. The GAGraph itself holds a reference to the graph's root node, which is an object of GADirectedGraphNode. This root node may be connected directly or indirectly to any other number of GADirectedGraphNode objects, using the connection class GADirectedGraphConnection.

> Because GADirectedGraphNode and GADirectedGraphConnection are intended to be used as general evolutionary objects, it is often neccessary to associate a set of parameters with these objects, above and beyond the information coded in the connected graph. For this reason, both classes are subclasses of an object which can hold a list of parameters, GADirectedGraphParameterObject.

> GADirectedGraphParameterObject holds a list of float values between -1.0 and 1.0. These parameters can be interpreted in whatever way the user desires. In the example of directed graphs being used to specify creature morphologies, the parameters hold information about the size and orientation of limbs relative to one another.

### Class methods:

> - copy
> - crossover
> - delete-root-node
> - get-root
> - mutate
> - print-graph
> - randomize

`copy from other (object)`

> Copies the contents of the directed graph other.

`crossover from-parent1 p1 (object) from-parent2 p2 (object)`

> Sets this child's genome to be a genetic crossover of p1 and p2.

`delete-root-node`

> Deletes the root node and all connected objects. This method "clears" the GADirectedGraph so that it may be reused.

`get-root`

> Returns the root node of the directed graph.

`mutate`

> Mutates the directed graph. The mutation adds a random connection, removes a random connection, and mutates the parameters of a random connection and node.

`print-graph`

> Prints out a text representation of the network.

`randomize with-max-nodes nMax (int) with-node-parameters np (int) with-connection-parameters cp (int) with-connection-probability p = 0.5 (double)`

> Randomizes this genome by creating a directed graph containing up to nMax nodes. Sets the number of node and connection parameters to np and cp, respectively. The optional connection probability, p, specifies the probability that a connection will be made from one node to another.

Documentation created Thu Jul 3 18:18:12 2008