|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
es.udc.gii.common.eaf.algorithm.operator.replace.ReplaceOperator
es.udc.gii.common.eaf.algorithm.parallel.migration.MigrationOperator
public class MigrationOperator
A migration operator is a replace operator that performs the exchange of genetic material between two islands in a parallel evolutionary algorithm, where this makes sense (i.e. in an island model).
A migration operator has a MigrationTopology
of islands associated, which takes care
of the underlying connections between the islands. A MigAcceptancePolicy
says which individuals from those who have come from other islands are accepted.
An example could be to accept only individuals from an older generation than
the current island's generation. It also has a MigCullingStrategy
,
which is in charge of selecting the individuals to be removed from the the
current population of the island, and a MigSelectionStrategy
for selecting
the individuals that migrate from the current population of the island to
the neighbours islands.
Migration is controlled by a migration frequency. This frequency is an integer that states how often is migration applied. For example, if this frequency is set to 3, a migration will be performed every 3 generations.
Field Summary | |
---|---|
static int |
ACCEPTED
|
static int |
CULLED
|
private java.util.List<Individual> |
currentAccepted
|
private java.util.List<Individual> |
currentCulled
|
private MigrationObject |
currentMigrant
|
private java.util.List<MigrationObject> |
currentMigrants
|
private java.util.List<Individual> |
currentPopulation
|
private MigAcceptancePolicy |
migAcceptancePolicy
The policy for accepting the incommig individuals. |
private MigCullingStrategy |
migCullingStrategy
The strategy to follow for culling individuals from the current population. |
private int |
migrationFrequecy
The migration frequency [generations / migration]. |
private MigSelectionStrategy |
migSelectionStrategy
The strategy to follow for selecting those individuals to send to other islands. |
static int |
NOT_INITIALIZED
|
static int |
RECEIVED
|
static int |
SENDING
|
private int |
state
|
private boolean |
synchronizedReceive
Synchronize all processes before receiving. |
private MigrationTopology |
topology
The topology that connects the islands. |
Constructor Summary | |
---|---|
MigrationOperator()
Creates a new instance of MigrationOperator. |
|
MigrationOperator(MigrationTopology topology,
MigCullingStrategy migCullingStrategy,
MigSelectionStrategy migSelectionStrategy,
MigAcceptancePolicy migAcceptancePolicy,
int migrationFrequecy)
Creates a new instance of MigrationOperator. |
Method Summary | |
---|---|
protected java.util.List<Individual> |
acceptIndividuals(EvolutionaryAlgorithm algorithm,
java.util.List<Individual> toPopulation,
java.util.List<MigrationObject> migrants)
Returns the individuals that satisfy some criterion (see MigAcceptacePolicy )
among those which are received from other nodes. |
void |
configure(org.apache.commons.configuration.Configuration conf)
Configures this operator. |
protected java.util.List<Individual> |
cullIndividuals(EvolutionaryAlgorithm algorithm,
java.util.List<Individual> acceptedIndividuals,
java.util.List<Individual> toPopulation)
Returns the individuals which are to be culled (removed) from the current population considering the individuals which are beeing received and accepted from other nodes. |
void |
finish()
Terminates this migration operator correctly. |
java.util.List<Individual> |
getCurrentAccepted()
|
java.util.List<Individual> |
getCurrentCulled()
|
MigrationObject |
getCurrentMigrant()
|
java.util.List<MigrationObject> |
getCurrentMigrants()
|
java.util.List<Individual> |
getCurrentPopulation()
|
MigAcceptancePolicy |
getMigAcceptancePolicy()
|
MigCullingStrategy |
getMigCullingStrategy()
|
int |
getMigrationFrequecy()
|
MigrationTopology |
getMigrationTopology()
|
MigSelectionStrategy |
getMigSelectionStrategy()
|
int |
getState()
|
boolean |
isSynchronized()
|
protected java.util.List<Individual> |
migrate(EvolutionaryAlgorithm algorithm,
java.util.List<Individual> toPopulation)
Performs migration. |
protected java.lang.String |
myName()
The name of this operator. |
void |
notifyObservers(int state)
|
protected java.util.List<Individual> |
replace(EvolutionaryAlgorithm algorithm,
java.util.List<Individual> toPopulation)
The replace method of ReplaceOperator is overwritten and forced
to be final so that no subclass can overwrite it. |
protected MigrationObject |
selectIndividualsForMigration(EvolutionaryAlgorithm algorithm,
java.util.List<Individual> toPopulation)
Selects the individuals that will be sent to other nodes. |
void |
setMigAcceptancePolicy(MigAcceptancePolicy migAcceptancePolicy)
|
void |
setMigCullingStrategy(MigCullingStrategy migCullingStrategy)
|
void |
setMigrationFrequecy(int migrationFrequecy)
|
void |
setMigrationTopology(MigrationTopology topology)
|
void |
setMigSelectionStrategy(MigSelectionStrategy migSelectionStrategy)
|
protected void |
setState(int state)
|
void |
setSynchronized(boolean synchronizedReceive)
If set to true then before receiving the individuals a synchronization
of all process within the topology is performed. |
java.lang.String |
toString()
|
Methods inherited from class es.udc.gii.common.eaf.algorithm.operator.replace.ReplaceOperator |
---|
operate |
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NOT_INITIALIZED
public static final int SENDING
public static final int RECEIVED
public static final int ACCEPTED
public static final int CULLED
private int state
private MigrationTopology topology
private MigCullingStrategy migCullingStrategy
private MigSelectionStrategy migSelectionStrategy
private MigAcceptancePolicy migAcceptancePolicy
private int migrationFrequecy
private boolean synchronizedReceive
private java.util.List<Individual> currentAccepted
private java.util.List<Individual> currentCulled
private java.util.List<MigrationObject> currentMigrants
private MigrationObject currentMigrant
private java.util.List<Individual> currentPopulation
Constructor Detail |
---|
public MigrationOperator()
public MigrationOperator(MigrationTopology topology, MigCullingStrategy migCullingStrategy, MigSelectionStrategy migSelectionStrategy, MigAcceptancePolicy migAcceptancePolicy, int migrationFrequecy)
Method Detail |
---|
protected final java.util.List<Individual> replace(EvolutionaryAlgorithm algorithm, java.util.List<Individual> toPopulation)
ReplaceOperator
is overwritten and forced
to be final so that no subclass can overwrite it. The migration is forced
to be implemented by the migrate(es.udc.gii.common.eaf.algorithm.EvolutionaryAlgorithm, java.util.List)
method.
replace
in class ReplaceOperator
public void configure(org.apache.commons.configuration.Configuration conf)
Configuration example:
<Operator> <Class>...parallel.migration.MigrationOperator</Class> <MigrationFrequency>2</MigrationFrequency> <CullingStrategy> <Class>...</Class> ... </CullingStrategy> <SelectionStrategy> <Class>...</Class> ... </SelectionStrategy> <AcceptancePolicy> <Class>...</Class> ... </AcceptancePolicy> <Topology> <Class>...</Class> ... </Topology> <Synchronized/> </Operator>
Migration will be performed every 2 generations and, before receiving,
all nodes are synchronized. If no synchronization is needed, simply remove
the <Synchronized/>
tag.
configure
in interface Configurable
configure
in class ReplaceOperator
conf
- Configuration.protected java.util.List<Individual> migrate(EvolutionaryAlgorithm algorithm, java.util.List<Individual> toPopulation)
public void notifyObservers(int state)
protected MigrationObject selectIndividualsForMigration(EvolutionaryAlgorithm algorithm, java.util.List<Individual> toPopulation)
protected java.util.List<Individual> acceptIndividuals(EvolutionaryAlgorithm algorithm, java.util.List<Individual> toPopulation, java.util.List<MigrationObject> migrants)
MigAcceptacePolicy
)
among those which are received from other nodes.
protected java.util.List<Individual> cullIndividuals(EvolutionaryAlgorithm algorithm, java.util.List<Individual> acceptedIndividuals, java.util.List<Individual> toPopulation)
protected java.lang.String myName()
public java.lang.String toString()
toString
in class java.lang.Object
public void finish()
public boolean isSynchronized()
public int getMigrationFrequecy()
public void setMigrationFrequecy(int migrationFrequecy)
public MigrationTopology getMigrationTopology()
public void setMigrationTopology(MigrationTopology topology)
public MigCullingStrategy getMigCullingStrategy()
public void setMigCullingStrategy(MigCullingStrategy migCullingStrategy)
public MigSelectionStrategy getMigSelectionStrategy()
public void setMigSelectionStrategy(MigSelectionStrategy migSelectionStrategy)
public void setSynchronized(boolean synchronizedReceive)
true
then before receiving the individuals a synchronization
of all process within the topology is performed. This is usefull for ensuring
that each process has sent its data when accepting individuals from only
the same generation and that all processes will hence receive data in the same generation.
The default is false
.
public MigAcceptancePolicy getMigAcceptancePolicy()
public void setMigAcceptancePolicy(MigAcceptancePolicy migAcceptancePolicy)
public int getState()
protected void setState(int state)
public java.util.List<Individual> getCurrentAccepted()
public java.util.List<Individual> getCurrentCulled()
public MigrationObject getCurrentMigrant()
public java.util.List<MigrationObject> getCurrentMigrants()
public java.util.List<Individual> getCurrentPopulation()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |