|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectes.udc.gii.common.eaf.algorithm.parallel.migration.acceptance.BinaryAcceptancePolicy
public abstract class BinaryAcceptancePolicy
With this class complex acceptance policies can be created as binary trees.
The left and right components must not be null. A runtime exception will be
thrown if setting either of them to null or when calling the accept(es.udc.gii.common.eaf.algorithm.parallel.topology.migration.MigrationObject, es.udc.gii.common.eaf.algorithm.EvolutionaryAlgorithm, java.util.List
method with some of them set to null.
Field Summary | |
---|---|
private MigAcceptancePolicy |
leftComponent
Left component of this node. |
private MigAcceptancePolicy |
rightComponent
Right component of this node. |
Constructor Summary | |
---|---|
BinaryAcceptancePolicy()
Creates a new instance of BinaryAcceptancePolicy |
|
BinaryAcceptancePolicy(MigAcceptancePolicy leftComponent,
MigAcceptancePolicy rightComponent)
Creates a new instance of BinaryAcceptancePolicy |
Method Summary | |
---|---|
java.util.List<Individual> |
accept(MigrationObject migrant,
EvolutionaryAlgorithm algorithm,
java.util.List<Individual> currentPopulation)
Accepts the individuals that come in a MigrationObject based on
some criterion. |
protected abstract java.util.List<Individual> |
binaryOperation(java.util.List<Individual> acceptedFromLeft,
java.util.List<Individual> acceptedFromRight)
The concrete binary operation that is performed with the results of the left and right components. |
void |
configure(org.apache.commons.configuration.Configuration conf)
Configures this object. |
MigAcceptancePolicy |
getLeftComponent()
|
MigAcceptancePolicy |
getRightComponent()
|
void |
setLeftComponent(MigAcceptancePolicy leftComponent)
Set the left component of this node. |
void |
setRightComponent(MigAcceptancePolicy rightComponent)
Set the right component of this node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private MigAcceptancePolicy leftComponent
private MigAcceptancePolicy rightComponent
Constructor Detail |
---|
public BinaryAcceptancePolicy()
public BinaryAcceptancePolicy(MigAcceptancePolicy leftComponent, MigAcceptancePolicy rightComponent)
Method Detail |
---|
public java.util.List<Individual> accept(MigrationObject migrant, EvolutionaryAlgorithm algorithm, java.util.List<Individual> currentPopulation)
MigrationObject
based on
some criterion.
This method calls first the same method of its left component, then the
same method of its right component and finally it relies on the protected
binaryOperation(java.util.List
method for merging the two results accordingly.
accept
in interface MigAcceptancePolicy
protected abstract java.util.List<Individual> binaryOperation(java.util.List<Individual> acceptedFromLeft, java.util.List<Individual> acceptedFromRight)
public void configure(org.apache.commons.configuration.Configuration conf)
Configuration example:
<AcceptancePolicy> <Class>subclass of BinaryAcceptancePolicy</Class> <AcceptancePolicy> <Class>...GenerationBasedAcceptance</Class> <AcceptIndividualsFrom>ANY_GENERATION</AcceptIndividualsFrom> </AcceptancePolicy> <AcceptancePolicy> <Class>subclass of BinaryAcceptancePolicy</Class> <AcceptancePolicy> <Class>...GenerationBasedAcceptance</Class> <AcceptIndividualsFrom>SOME_GENERATION</AcceptIndividualsFrom> </AcceptancePolicy> <AcceptancePolicy> <Class>some MigAcceptancePolicy</Class> ... </AcceptancePolicy> </AcceptancePolicy> </AcceptancePolicy>
This constructs the following tree:
(B1) / \ (G1) (B2) / \ (G2) (M)
B1 is the constructed BinaryAcceptancePolicy. Its left component is a
GenerationBasedAcceptance
(G1) with parameter ANY_GENERATION. Its right
component is also a BinaryAcceptancePolicy with another
GenerationBasedAcceptance (G2) with parameter SOME_GENERATION as left
component and some other implementation of MigAcceptancePolicy
as
right component.
configure
in interface Configurable
public MigAcceptancePolicy getLeftComponent()
public void setLeftComponent(MigAcceptancePolicy leftComponent)
null
is passed,
a runtime exception is thrown.
public MigAcceptancePolicy getRightComponent()
public void setRightComponent(MigAcceptancePolicy rightComponent)
null
is passed,
a runtime exception is thrown.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |