Migration – the migration schemes, distributed GA¶
This module contains all the migration schemes and the distributed GA related functions.
New in version 0.6: The Migration module.
-
class
Migration.MigrationScheme(host, port, group_name)¶ This is the base class for all migration schemes
Parameters: - host – the source hostname
- port – the source host port
- group_name – the group name
-
exchange()¶ Exchange individuals
-
getCompressionLevel()¶ Get the zlib compression level of network data
The values are in the interval described on the
Network.pickleAndCompress()
-
getGroupName()¶ Gets the group name
Note
all islands of evolution which are supposed to exchange individuals, must have the same group name.
-
getMigrationRate()¶ Return the the generation frequency supposed to migrate and receive individuals
Return type: the number of generations
-
getNumIndividuals()¶ Return the number of individuals that will migrate
Return type: the number of individuals to be replaced
-
getNumReplacement()¶ Return the number of individuals that will be replaced in the migration process
-
isReady()¶ Returns true if is time to migrate
-
select()¶ Pickes an individual from population using specific selection method
Return type: an individual object
-
selectPool(num_individuals)¶ Select num_individuals number of individuals and return a pool
Parameters: num_individuals – the number of individuals to select Return type: list with individuals
-
selector= None¶ This is the function slot for the selection method if you want to change the default selector, you must do this:
migration_scheme.selector.set(Selectors.GRouletteWheel)
-
setCompressionLevel(level)¶ Set the zlib compression level of network data
The values are in the interval described on the
Network.pickleAndCompress()Parameters: level – the zlib compression level
-
setGAEngine(ga_engine)¶ Sets the GA Engine handler
-
setGroupName(name)¶ Sets the group name
Parameters: name – the group name Note
all islands of evolution which are supposed to exchange individuals, must have the same group name.
-
setMigrationRate(generations)¶ Sets the generation frequency supposed to migrate and receive individuals.
Parameters: generations – the number of generations
-
setMyself(host, port)¶ Which interface you will use to send/receive data
Parameters: - host – your hostname
- port – your port
-
setNumIndividuals(num_individuals)¶ Set the number of individuals that will migrate
Parameters: num_individuals – the number of individuals
-
setNumReplacement(num_individuals)¶ Return the number of individuals that will be replaced in the migration process
Parameters: num_individuals – the number of individuals to be replaced
-
start()¶ Initializes the migration scheme
-
stop()¶ Stops the migration engine
-
class
Migration.WANMigration(host, port, group_name)¶ This is the Simple Migration class for distributed GA
- Example:
>>> mig = WANMigration("192.168.0.1", "10000", "group1")
Parameters: - host – the source hostname
- port – the source port number
- group_name – the group name
-
exchange()¶ This is the main method, is where the individuals are exchanged
-
getCompressionLevel()¶ Get the zlib compression level of network data
The values are in the interval described on the
Network.pickleAndCompress()
-
getGroupName()¶ Gets the group name
Note
all islands of evolution which are supposed to exchange individuals, must have the same group name.
-
getMigrationRate()¶ Return the the generation frequency supposed to migrate and receive individuals
Return type: the number of generations
-
getNumIndividuals()¶ Return the number of individuals that will migrate
Return type: the number of individuals to be replaced
-
getNumReplacement()¶ Return the number of individuals that will be replaced in the migration process
-
isReady()¶ Returns true if is time to migrate
-
select()¶ Pickes an individual from population using specific selection method
Return type: an individual object
-
selectPool(num_individuals)¶ Select num_individuals number of individuals and return a pool
Parameters: num_individuals – the number of individuals to select Return type: list with individuals
-
selector= None¶ This is the function slot for the selection method if you want to change the default selector, you must do this:
migration_scheme.selector.set(Selectors.GRouletteWheel)
-
setCompressionLevel(level)¶ Set the zlib compression level of network data
The values are in the interval described on the
Network.pickleAndCompress()Parameters: level – the zlib compression level
-
setGAEngine(ga_engine)¶ Sets the GA Engine handler
-
setGroupName(name)¶ Sets the group name
Parameters: name – the group name Note
all islands of evolution which are supposed to exchange individuals, must have the same group name.
-
setMigrationRate(generations)¶ Sets the generation frequency supposed to migrate and receive individuals.
Parameters: generations – the number of generations
-
setMyself(host, port)¶ Which interface you will use to send/receive data
Parameters: - host – your hostname
- port – your port
-
setNumIndividuals(num_individuals)¶ Set the number of individuals that will migrate
Parameters: num_individuals – the number of individuals
-
setNumReplacement(num_individuals)¶ Return the number of individuals that will be replaced in the migration process
Parameters: num_individuals – the number of individuals to be replaced
-
setTopology(graph)¶ Sets the topology of the migrations
Parameters: graph – the Util.Graphinstance
-
start()¶ Start capture of packets and initialize the migration scheme
-
stop()¶ Stops the migration engine