examples.distinctGenes
Class MyChromosome
java.lang.Object
org.jgap.BaseChromosome
org.jgap.Chromosome
examples.distinctGenes.MyChromosome
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, IBusinessKey, IChromosome, IHandler, IInitializer, IPersistentRepresentation, IUniqueKey, ICloneable
public class MyChromosome
- extends Chromosome
Sample class: Descendent of Chromosome that creates Chromosomes with n
CompositeGenes. All but one CompositeGene's have 4 sub-genes, the last one
has only 3 sub-genes.
- Since:
- 3.0
- See Also:
- Serialized Form
Method Summary |
boolean |
isHandlerFor(java.lang.Object a_obj,
java.lang.Class a_class)
Determines whether the handler is suitable for the given object instance
or class. |
java.lang.Object |
perform(java.lang.Object a_obj,
java.lang.Class a_class,
java.lang.Object a_params)
Performs a task for the given object or class. |
static IChromosome |
randomInitialMyChromosome(Configuration a_configuration)
|
Methods inherited from class org.jgap.Chromosome |
calcFitnessValue, checkGenes, cleanup, clone, cloneObject, cloneObject, compareTo, equals, getApplicationData, getConstraintChecker, getFitnessValue, getFitnessValueDirectly, getMultiObjectives, hashCode, initFromGene, isCompareApplicationData, isSelectedForNextGeneration, randomInitialChromosome, setApplicationData, setCompareApplicationData, setConstraintChecker, setFitnessValue, setFitnessValueDirectly, setGenes, setIsSelectedForNextGeneration, setMultiObjectives, toString, verify |
Methods inherited from class org.jgap.BaseChromosome |
createGene, decode, encode, getAge, getBusinessKey, getConfiguration, getGene, getGenes, getGenesPersistentRepresentation, getGenesPersistentRepresentation, getPersistentRepresentation, getUniqueID, getUniqueIDTemplate, increaseAge, increaseOperatedOn, operatedOn, resetAge, resetOperatedOn, setAge, setGene, setUniqueIDTemplate, setValueFromPersistentRepresentation, size, split |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
MyChromosome
public MyChromosome()
throws InvalidConfigurationException
- Throws:
InvalidConfigurationException
MyChromosome
public MyChromosome(Configuration a_configuration)
throws InvalidConfigurationException
- Throws:
InvalidConfigurationException
MyChromosome
public MyChromosome(Configuration a_configuration,
int a_desiredSize)
throws InvalidConfigurationException
- Throws:
InvalidConfigurationException
MyChromosome
public MyChromosome(Configuration a_configuration,
Gene a_sampleGene,
int a_desiredSize)
throws InvalidConfigurationException
- Throws:
InvalidConfigurationException
MyChromosome
public MyChromosome(Configuration a_configuration,
Gene[] a_initialGenes)
throws InvalidConfigurationException
- Throws:
InvalidConfigurationException
MyChromosome
public MyChromosome(Configuration a_configuration,
Gene a_sampleGene,
int a_desiredSize,
IGeneConstraintChecker a_constraintChecker)
throws InvalidConfigurationException
- Throws:
InvalidConfigurationException
isHandlerFor
public boolean isHandlerFor(java.lang.Object a_obj,
java.lang.Class a_class)
- Description copied from class:
Chromosome
- Determines whether the handler is suitable for the given object instance
or class.
- Specified by:
isHandlerFor
in interface IHandler
- Overrides:
isHandlerFor
in class Chromosome
- Parameters:
a_obj
- the object instance to checka_class
- the class to check, alternatively if no object instance is
available (some handlers could need to get an object and would always
return false if only a class is provided)
- Returns:
- true: handler suitable for given object or class
perform
public java.lang.Object perform(java.lang.Object a_obj,
java.lang.Class a_class,
java.lang.Object a_params)
throws java.lang.Exception
- Performs a task for the given object or class. For some handlers,
additional parameters are necessary, which could be provided.
- Specified by:
perform
in interface IHandler
- Overrides:
perform
in class Chromosome
- Parameters:
a_obj
- the object instance to perform the handler task fora_class
- the class to perform the handler task for, in case no object
instance is available (some handlers could need to get an object and would
always throw an exception if only a class is provided)a_params
- optional parameters needed for the handler to perform its
task
- Returns:
- Object
- Throws:
java.lang.Exception
- in case of any error
randomInitialMyChromosome
public static IChromosome randomInitialMyChromosome(Configuration a_configuration)
throws InvalidConfigurationException
- Throws:
InvalidConfigurationException