Chromosome {galgo} | R Documentation

## The representation of a set of genes for genetic algorithms

### Description

Represents a set of genes for the genetic algorithm. The chromosome contains all current values of each gene and will be evaluated using a “fitness” function similar to those defined by Goldberg. The fitness function normally depends on the `Galgo` object.

See references for Genetic Algorithms.

### Usage

    Chromosome(id=0,
    	genes=list(),
    	getValues=function(x, ...) unlist(lapply(x, ...)),
    	decode=function(x) genes(x),
    	values=list(),
    	...)

### Arguments

`id` | A way to identify the object.
`genes` | A list of defined Gene objects composing the chromosome.
`getValues` | A function to be evaluated for every gene to obtain a value. In general, the result could be any object in a list. In particular, the default is a vector of current gene values.
`decode` | A function that converts the chromosome representation in real values. It is used mainly for output purposes and for frequency counting. It has no effect for variable selection in microarray data since the default `decode` is directly the gene value.
`values` | The specific initial values. If `value` is not specified, `getValues` function is ran to obtain initial values.
`...` | Other user named values to include in the object.

### Class

Package: galgo
Class Chromosome

`Object`
`~~|`
`~~+--``Chromosome`

Directly known subclasses:

public static class Chromosome
extends Object

### Fields and Methods

Methods:

| `as.double` | Converts the chromosome values (genes) to its numerical representation.
| `clone` | Clones itself and its genes.
| `decode` | Converts the gene values to user-readable values.
| `generateRandom` | Generates random values for all genes in the chromosome.
| `genes` | Converts the genes values to a numeric vector.
| `length` | Gets the number of genes defined in the chromosome.
| `mutate` | Mutates a chromosome in specific positions.
| `newCollection` | Generates a list of chromosomes cloning the original chromosome object.
| `newRandomCollection` | Creates a list of cloned chromosomes object with its internal values generated by random.
| `print` | Prints the representation of the chromosome object.
| `reInit` | Erases all internal values in order to re-use the object.
| `summary` | Prints the representation of the chromosome object and all its genes.

Methods inherited from Object:
as.list, unObject, $, $<-, [[, [[<-, as.character, attach, clone, detach, equals, extend, finalize, getFields, getInstanciationTime, getStaticInstance, hasField, hashCode, ll, load, objectSize, print, save

### Author(s)

Victor Trevino. Francesco Falciani Group. University of Birmingham, U.K. http://www.bip.bham.ac.uk/bioinf

### References

Goldberg, David E. 1989 Genetic Algorithms in Search, Optimization and Machine Learning. Addison-Wesley Pub. Co. ISBN: 0201157675

### See Also

`Gene`. `Niche`. `World`. `Galgo`. `BigBang`.

### Examples

      cr <- Chromosome(genes=newCollection(Gene(shape1=1, shape2=100),5))
      cr

[Package galgo version 1.4 Index]