World {galgo} | R Documentation

## The representation of a set of niches with migration for genetic algorithms

### Description

Represents a set of nices for the genetic algorithm. Because the niches are “closed populations”, it is sometimes needed exchange information bewteen niches (or “islands”). The `World` object implements the exchange of chromosomes between niches, and to be compatible, it also implements the needed methods than an usual niche but considering the immigration property. Thus, the `Galgo` object can receive a list of Niches, a list of Worlds, or a list of any mixture of them.

### Usage

    World(id=0,
    	niches=list(),
    	immigration=0,
    	maxFitness=0,
    	bestFitness=0,
    	maxChromosome=NULL,
    	bestChromosome=NULL,
    	generation=0,
    	...)

### Arguments

`id` | A way to identify the object.
`niches` | A list of defined niches composing the world. However, it can be a list containing even `World` objects.

`immigration`

It can be `NULL`, a `function`, or a `vector`. When it is `NULL` immigration is disabled. When it is a `function` it is evaluated using the same `World` object as parameter, the result should be a numeric value. When the length of `immigration` is greather than 1 a cycled version is used depending on the `generation`. If the resulted or selected numeric value is greather than 1 it is interpreted as the number of chromosomes to migrate, otherwise it is assumed to be a probability to migrate one chromosome. The final `I` best chromosomes to migrate apply to all niches.

`bestFitness` | The best fitness ever visited.
`maxFitness` | The maximum fitness from the current chromosomes. It should be 0 initially, but it is included for generalization.
`maxChromosome` | The chromosome whose fitness is maximum from the current chromosomes. It should be NULL initially, but it is included for generalization.
`bestChromosome` | The chromosome whose fitness is maximum visited ever. It should be NULL initially, but it is included for generalization.
`generation` | For internal use only.
`...` | Other user named values to include in the object (like pMutation, pCrossover or any other).

### Class

Package: galgo
Class World

`Object`
`~~|`
`~~+--``World`

Directly known subclasses:

public static class World
extends Object

### Fields and Methods

Methods:

| `best` | Returns the best chromosome.
| `bestFitness` | Returns the fitness of the best chromosome.
| `clone` | Clones itself and its niches.
| `evaluate` | Evaluate all niches with a fitness function.
| `generateRandom` | Generates random values for all niches in the world.
| `length` | Gets the number of niches defined in the world.
| `max` | Returns the chromosome whose current fitness is maximum.
| `maxFitness` | Returns the fitness of the maximum chromosome.
| `newCollection` | Generates a list cloning an object.
| `newRandomCollection` | Creates a list of cloned object with its internal values generated by random.
| `plot` | Plots information about world object.
| `print` | Prints the representation of a world object.
| `progeny` | Calls progeny method to all niches in the world object.
| `refreshStats` | Updates the internal statistics from the current population.
| `reInit` | Erases all internal values in order to re-use the world object.
| `summary` | Prints the representation and statistics of the world object.

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`, `Chromosome`, `Niche`, `Galgo`, `BigBang`.

### Examples

       cr <- Chromosome(genes=newCollection(Gene(shape1=1, shape2=100),5))
       ni <- Niche(chromosomes=newRandomCollection(cr, 10))
       wo <- World(niches=newRandomCollection(ni,2))
       wo

       progeny(wo) # returns the chromosomes indexes that were mutated

[Package galgo version 1.4 Index]