| java.lang.Object org.jgap.Configuration
All known Subclasses: org.jgap.gp.impl.GPConfiguration, org.jgap.impl.DefaultConfiguration, org.jgap.ConfigurationForTesting, org.jgap.audit.PermutingConfiguration,
Configuration | public class Configuration implements Configurable,Serializable,ICloneable,Comparable(Code) | | The Configuration class represents the current configuration of
plugins and parameters necessary to execute the genetic algorithm (such
as fitness function, natural selector, genetic operators, and so on).
Note that, while during setup, the settings, flags, and other
values may be set multiple times. But once the lockSettings() method
is invoked, they cannot be changed. The default behavior of the
Genotype constructor is to invoke this method, meaning that
once a Configuration object is passed to a Genotype, it cannot
be subsequently modified. There is no mechanism for unlocking
the settings once they are locked.
Not all configuration options are required. See the documentation
for each of the respective mutator methods to determine whether
it is required to provide a value for that setting, and what the
setting will default to if not.
author: Neil Rotstan author: Klaus Meffert since: 1.0 |
Inner Class :class ConfigurationConfigurable implements Serializable | |
Method Summary | |
public synchronized void | addGeneticOperator(GeneticOperator a_operatorToAdd) Adds a genetic operator for use in this algorithm. | public void | addNaturalSelector(NaturalSelector a_selector, boolean a_processBeforeGeneticOperators) Adds a NaturalSelector to the ordered chain of registered
NaturalSelector's. | protected void | checkProperty(String a_propname, Object a_obj, Object a_oldObj, String a_errmsg) Verifies that a property is not set. | public Object | clone() | public int | compareTo(Object a_other) The compareTo-method. | protected Object | doClone(Object a_objToClone) Helper called from clone. | public boolean | equals(Object a_other) The equals-method. | public IBreeder | getBreeder() | public synchronized BulkFitnessFunction | getBulkFitnessFunction() Retrieves the bulk fitness function previously setup in this
Configuration object. | public IChromosomePool | getChromosomePool() Retrieves the ChromosomePool instance, if any, that is associated with
this configuration. | public int | getChromosomeSize() Retrieves the chromosome size being used by this genetic
algorithm. | public ConfigurationHandler | getConfigurationHandler() Implementation of the Configurable interface. | public IEventManager | getEventManager() Retrieves the event manager associated with this configuration. | public FitnessEvaluator | getFitnessEvaluator() | public synchronized FitnessFunction | getFitnessFunction() Retrieves the fitness function previously setup in this Configuration
object. | public int | getGenerationNr() | public List | getGeneticOperators() Retrieves the genetic operators setup in this Configuration instance. | public String | getId() | public IJGAPFactory | getJGAPFactory() | public int | getMinimumPopSizePercent() | public String | getName() | public synchronized NaturalSelector | getNaturalSelector() Retrieves the natural selector setup in this Configuration instance. | public synchronized NaturalSelector | getNaturalSelector(boolean a_processBeforeGeneticOperators, int a_index) | public ChainOfSelectors | getNaturalSelectors(boolean a_processBeforeGeneticOperators) | public int | getNaturalSelectorsSize(boolean a_processBeforeGeneticOperators) | public synchronized int | getPopulationSize() Retrieves the population size setup in this Configuration instance. | public synchronized RandomGenerator | getRandomGenerator() Retrieves the random generator setup in this Configuration instance. | public IChromosome | getSampleChromosome() Retrieves the sample Chromosome that contains the desired Gene setup
for each respective gene position (locus). | public double | getSelectFromPrevGen() | protected static String | getThreadKey(Thread current, String a_id) Builds a string considering the current thread and the given id. | public void | incrementGenerationNr() | public boolean | isAlwaysCalculateFitness() true: Chromosome.getFitnessValue() will always (re-)calculate thefitness value. | public boolean | isKeepPopulationSizeConstant() See setKeepPopulationSizeConstant for description. | public boolean | isLocked() Retrieves the lock status of this object. | public boolean | isPreserveFittestIndividual() | public synchronized void | lockSettings() Locks all of the settings in this configuration object. | protected String | makeKey(Object a_obj) | protected String | makeThreadKey() | public Configuration | newInstance(String a_id, String a_name) Creates a new Configuration instance by cloning. | public void | removeNaturalSelectors(boolean a_processBeforeGeneticOperators) Removes all natural selectors (either pre or post ones). | public static void | reset() SHOULD NOT BE NECESSARY TO CALL UNDER NORMAL CIRCUMSTANCES. | public static void | reset(String a_id) Reset the configuration so that re-setting parameters such as fitness
function is possible (without calling this method, an overwriting of a
previously set fitness function results in a RuntimeException). | public static void | resetProperty(String a_propName) See Configuration.reset(). | public static void | resetProperty(String a_propName, String a_id) | public void | setAlwaysCaculateFitness(boolean a_alwaysCalculate) Parameters: a_alwaysCalculate - true: Chromosome.getFitnessValue() will always(re-)calculate the fitness value. | public void | setBreeder(IBreeder a_breeder) | public synchronized void | setBulkFitnessFunction(BulkFitnessFunction a_functionToSet) Sets the bulk fitness function to be used for this genetic algorithm.
The bulk fitness function may be used to evaluate and assign fitness
values to the entire group of candidate Chromosomes in a single batch.
This can be useful in cases where it's difficult to assign fitness
values to a Chromosome in isolation from the other candidate
Chromosomes.
Note that it is illegal to set both a bulk fitness function and a
normal fitness function. | public void | setChromosomePool(IChromosomePool a_chromosomePoolToSet) Sets the ChromosomePool that is to be associated with this
configuration. | public void | setEventManager(IEventManager a_eventManagerToSet) Sets the event manager that is to be associated with this configuration. | public void | setFitnessEvaluator(FitnessEvaluator a_fitnessEvaluator) Set the fitness evaluator (deciding if a given fitness value is better
when it's higher or better when it's lower). | public synchronized void | setFitnessFunction(FitnessFunction a_functionToSet) Sets the fitness function to be used for this genetic algorithm.
The fitness function is responsible for evaluating a given Chromosome and
returning a positive integer that represents its worth as a candidate
solution. | protected void | setId(String a_id) Only to be called by sub classes, such as GPConfiguration. | public void | setJGAPFactory(IJGAPFactory a_factory) | public void | setKeepPopulationSizeConstant(boolean a_keepPopSizeConstant) Allows to keep the population size constant after one evolution, even if
there is no appropriate instance of NaturalSelector (such as
WeightedRouletteSelector) registered with the Configuration.
Be aware that keeping the population size constant often means that a
higher population size is necessary (e.g. | public void | setMinimumPopSizePercent(int a_minimumSizeGuaranteedPercent) Minimum size guaranteed for population. | public void | setName(String a_name) | public synchronized void | setNaturalSelector(NaturalSelector a_selectorToSet) Sets the natural selector to be used for this genetic algorithm.
The natural selector is responsible for actually selecting
which Chromosome instances are allowed to move on to the next
round of evolution (usually guided by the fitness values
provided by the fitness function). | public synchronized void | setPopulationSize(int a_sizeOfPopulation) Sets the population size to be used for this genetic algorithm. | public void | setPreservFittestIndividual(boolean a_preserveFittest) Determines whether to save (keep) the fittest individual. | public synchronized void | setRandomGenerator(RandomGenerator a_generatorToSet) Sets the random generator to be used for this genetic algorithm.
The random generator is responsible for generating random numbers,
which are used throughout the process of genetic evolution and
selection. | public void | setSampleChromosome(IChromosome a_sampleChromosomeToSet) Sets the sample Chromosome that is to be used as a guide for the
construction of other Chromosomes. | public void | setSelectFromPrevGen(double a_percentage) | public String | toString() | protected void | verifyChangesAllowed() Makes sure that this Configuration object isn't locked. | public synchronized void | verifyStateIsValid() Tests the state of this Configuration object to make sure it's valid.
This generally consists of verifying that required settings have, in
fact, been set. |
PROPERTY_BFITFNC_INST | final public static String PROPERTY_BFITFNC_INST(Code) | | |
PROPERTY_EVENT_MGR_INST | final public static String PROPERTY_EVENT_MGR_INST(Code) | | |
PROPERTY_FITEVAL_INST | final public static String PROPERTY_FITEVAL_INST(Code) | | |
PROPERTY_FITFUNC_INST | final public static String PROPERTY_FITFUNC_INST(Code) | | |
PROPERTY_JGAPFACTORY_CLASS | final public static String PROPERTY_JGAPFACTORY_CLASS(Code) | | Constant for class name of JGAP Factory to use. Use as:
System.setProperty(PROPERTY_JGAPFACTORY_CLASS, "myJGAPFactory");
If none such property set, class JGAPFactory will be used.
|
PROPERTY_SAMPLE_CHROM_INST | final public static String PROPERTY_SAMPLE_CHROM_INST(Code) | | |
S_CHROMOSOME_SIZE | final public static String S_CHROMOSOME_SIZE(Code) | | |
S_CONFIGURATION | final public static String S_CONFIGURATION(Code) | | Constants for toString()
|
S_CONFIGURATION_HANDLER | final public static String S_CONFIGURATION_HANDLER(Code) | | |
S_CONFIGURATION_NAME | final public static String S_CONFIGURATION_NAME(Code) | | |
S_EVENT_MANAGER | final public static String S_EVENT_MANAGER(Code) | | |
S_FITNESS_EVALUATOR | final public static String S_FITNESS_EVALUATOR(Code) | | |
S_FITNESS_FUNCTION | final public static String S_FITNESS_FUNCTION(Code) | | |
S_GENETIC_OPERATORS | final public static String S_GENETIC_OPERATORS(Code) | | |
S_NATURAL_SELECTORS | final public static String S_NATURAL_SELECTORS(Code) | | |
S_POPULATION_SIZE | final public static String S_POPULATION_SIZE(Code) | | |
S_RANDOM_GENERATOR | final public static String S_RANDOM_GENERATOR(Code) | | |
S_SAMPLE_CHROM | final public static String S_SAMPLE_CHROM(Code) | | |
Configuration | public Configuration()(Code) | | |
Configuration | public Configuration(String a_id, String a_name)(Code) | | Initialize with default values.
Parameters: a_id - unique id for the configuration within the current thread Parameters: a_name - informative name of the configuration, may be null author: Neil Rotstan author: Klaus Meffert since: 1.0 |
Configuration | public Configuration(String a_name)(Code) | | Constructs a configuration with an informative name but without a unique
ID. This practically prevents more than one configurations to be
instantiated within the same thread.
Parameters: a_name - informative name of the configuration, may be null author: Klaus Meffert |
addGeneticOperator | public synchronized void addGeneticOperator(GeneticOperator a_operatorToAdd) throws InvalidConfigurationException(Code) | | Adds a genetic operator for use in this algorithm. Genetic operators
represent evolutionary steps that, when combined, make up the
evolutionary process. Examples of genetic operators are reproduction,
crossover, and mutation. During the evolution process, all of the
genetic operators added via this method are invoked in the order
they were added. At least one genetic operator must be provided.
Parameters: a_operatorToAdd - the genetic operator to add. throws: InvalidConfigurationException - if the genetic operator is null orif this Configuration object is locked author: Neil Rotstan since: 1.0 |
addNaturalSelector | public void addNaturalSelector(NaturalSelector a_selector, boolean a_processBeforeGeneticOperators) throws InvalidConfigurationException(Code) | | Adds a NaturalSelector to the ordered chain of registered
NaturalSelector's. It's possible to execute the NaturalSelector before
or after (registered) genetic operations have been applied.
Parameters: a_selector - the selector to be added to the chain Parameters: a_processBeforeGeneticOperators - true: execute NaturalSelectorbefore any genetic operator will be applied, false: .. after.. throws: InvalidConfigurationException - author: Klaus Meffert since: 1.1 |
checkProperty | protected void checkProperty(String a_propname, Object a_obj, Object a_oldObj, String a_errmsg)(Code) | | Verifies that a property is not set. If not set, set it, otherwise throw
a RuntimeException with a_errmsg as text.
Parameters: a_propname - the property to check (the current thread will beconsidered as a part of the property's name, too) Parameters: a_obj - the object that should be set in charge of the property Parameters: a_oldObj - the old object that is set until now. Not used yet Parameters: a_errmsg - the error message to throw in case the property is alreadyset for the current thread author: Klaus Meffert since: 3.0 |
clone | public Object clone()(Code) | | deep clone of this instance author: Klaus Meffert since: 3.2 |
compareTo | public int compareTo(Object a_other)(Code) | | The compareTo-method.
Parameters: a_other - the other object to compare -1, 0, 1 author: Klaus Meffert since: 3.2 |
doClone | protected Object doClone(Object a_objToClone) throws Exception(Code) | | Helper called from clone.
Parameters: a_objToClone - the object to clone cloned object or null, if cloning not possible throws: Exception - author: Klaus Meffert since: 3.2 |
equals | public boolean equals(Object a_other)(Code) | | The equals-method.
Parameters: a_other - the other object to compare true if seen as equal author: Klaus Meffert since: 3.2 |
getBreeder | public IBreeder getBreeder()(Code) | | the breeder set or new standard breeder instance in case no breederwas set before. author: Klaus Meffert since: 3.2 |
getBulkFitnessFunction | public synchronized BulkFitnessFunction getBulkFitnessFunction()(Code) | | Retrieves the bulk fitness function previously setup in this
Configuration object.
the bulk fitness function author: Neil Rotstan since: 1.0 |
getChromosomePool | public IChromosomePool getChromosomePool()(Code) | | Retrieves the ChromosomePool instance, if any, that is associated with
this configuration. The ChromosomePool is used to pool discarded
Chromosome instances so that they may be recycled later, thereby
saving memory and the time to construct them from scratch. The presence
of a ChromosomePool instance is optional. If none exists, then new
Chromosomes should be constructed each time one is needed.
the ChromosomePool instance associated this configuration, ornull if none has been provided author: Neil Rotstan since: 1.0 |
getChromosomeSize | public int getChromosomeSize()(Code) | | Retrieves the chromosome size being used by this genetic
algorithm. This value is set automatically when the sample chromosome
is provided.
chromosome size used in this configuration author: Neil Rotstan since: 1.0 |
getEventManager | public IEventManager getEventManager()(Code) | | Retrieves the event manager associated with this configuration. The event
manager is responsible for the management of event subscribers
and event notifications.
the actively configured event manager instance since: 1.0 |
getFitnessEvaluator | public FitnessEvaluator getFitnessEvaluator()(Code) | | the assigned FitnessEvaluator author: Klaus Meffert since: 2.0 |
getFitnessFunction | public synchronized FitnessFunction getFitnessFunction()(Code) | | Retrieves the fitness function previously setup in this Configuration
object.
the fitness function author: Neil Rotstan since: 1.0 |
getGenerationNr | public int getGenerationNr()(Code) | | |
getGeneticOperators | public List getGeneticOperators()(Code) | | Retrieves the genetic operators setup in this Configuration instance.
Note that once this Configuration instance is locked, a new, immutable list
of operators is used and any lists previously retrieved with this method
will no longer reflect the actual list in use.
the list of genetic operators author: Neil Rotstan since: 1.0 |
getId | public String getId()(Code) | | the id of the configuration set author: Klaus Meffert since: 3.1 |
getJGAPFactory | public IJGAPFactory getJGAPFactory()(Code) | | the JGAP factory registered author: Klaus Meffert |
getMinimumPopSizePercent | public int getMinimumPopSizePercent()(Code) | | |
getName | public String getName()(Code) | | informative name of the configuration author: Klaus Meffert since: 2.3 |
getNaturalSelector | public synchronized NaturalSelector getNaturalSelector()(Code) | | Retrieves the natural selector setup in this Configuration instance.
the natural selector author: Neil Rotstan since: 1.0 |
getNaturalSelector | public synchronized NaturalSelector getNaturalSelector(boolean a_processBeforeGeneticOperators, int a_index)(Code) | | Parameters: a_processBeforeGeneticOperators - true: retrieve selector that isregistered to be executed before genetic operators, false: get the onethat is registered to be executed after genetic operators Parameters: a_index - index of the selector to get NaturalSelector author: Klaus Meffert since: 1.1 |
getNaturalSelectors | public ChainOfSelectors getNaturalSelectors(boolean a_processBeforeGeneticOperators)(Code) | | Only use for read-only access! Especially don't call clear() for the
returned ChainOfSelectors object!
Parameters: a_processBeforeGeneticOperators - true: retrieve selector that isregistered to be executed before genetic operators, false: get the onethat is registered to be executed after genetic operators ChainOfSelectors author: Klaus Meffert since: 1.1 |
getNaturalSelectorsSize | public int getNaturalSelectorsSize(boolean a_processBeforeGeneticOperators)(Code) | | Parameters: a_processBeforeGeneticOperators - true: retrieve selector that isregistered to be executed before genetic operators, false: get the onethat is registered to be executed after genetic operators size of selector list (distinct by a_processBeforeGeneticOperators) author: Klaus Meffert since: 1.1 |
getPopulationSize | public synchronized int getPopulationSize()(Code) | | Retrieves the population size setup in this Configuration instance.
population size |
getRandomGenerator | public synchronized RandomGenerator getRandomGenerator()(Code) | | Retrieves the random generator setup in this Configuration instance.
the random generator author: Neil Rotstan since: 1.0 |
getSampleChromosome | public IChromosome getSampleChromosome()(Code) | | Retrieves the sample Chromosome that contains the desired Gene setup
for each respective gene position (locus).
sample Chromosome instance author: Neil Rotstan since: 1.0 |
getSelectFromPrevGen | public double getSelectFromPrevGen()(Code) | | |
getThreadKey | protected static String getThreadKey(Thread current, String a_id)(Code) | | Builds a string considering the current thread and the given id.
Parameters: current - the current Thread Parameters: a_id - a hopefully unique id of the configuration string built up author: Klaus Meffert since: 3.01 |
incrementGenerationNr | public void incrementGenerationNr()(Code) | | |
isAlwaysCalculateFitness | public boolean isAlwaysCalculateFitness()(Code) | | true: Chromosome.getFitnessValue() will always (re-)calculate thefitness value. This may be necessary in case of environments where thestate changes without the chromosome to notice. author: Klaus Meffert since: 3.2.2 |
isKeepPopulationSizeConstant | public boolean isKeepPopulationSizeConstant()(Code) | | See setKeepPopulationSizeConstant for description.
true: population size will always be the same size(as given with Configuration.setPopulationSize(int) author: Klaus Meffert since: 2.4 |
isLocked | public boolean isLocked()(Code) | | Retrieves the lock status of this object.
true if this object has been locked by a previous successfulcall to the lockSettings() method, false otherwise author: Neil Rotstan since: 1.0 |
isPreserveFittestIndividual | public boolean isPreserveFittestIndividual()(Code) | | true: fittest chromosome should always be transferred to nextgeneration author: Klaus Meffert since: 2.1 |
lockSettings | public synchronized void lockSettings() throws InvalidConfigurationException(Code) | | Locks all of the settings in this configuration object. Once
this method is successfully invoked, none of the settings may
be changed. There is no way to unlock this object once it is locked.
Prior to returning successfully, this method will first invoke the
verifyStateIsValid() method to make sure that any required configuration
options have been properly set. If it detects a problem, it will
throw an InvalidConfigurationException and leave the object unlocked.
It's possible to test whether this object is locked through the
isLocked() method.
It is ok to lock an object more than once. In that case, this method
does nothing and simply returns.
throws: InvalidConfigurationException - if this Configuration object isin an invalid state at the time of invocation author: Neil Rotstan since: 1.0 |
makeKey | protected String makeKey(Object a_obj)(Code) | | Parameters: a_obj - the object to make a key for, must not be null key produced for the object (hashCode() is used, so it should beimplemented properly!) author: Klaus Meffert since: 3.0 |
newInstance | public Configuration newInstance(String a_id, String a_name)(Code) | | Creates a new Configuration instance by cloning. Allows to preset the
ID and the name.
Parameters: a_id - new ID for clone Parameters: a_name - new name for clone deep clone of this instance author: Klaus Meffert since: 3.2 |
removeNaturalSelectors | public void removeNaturalSelectors(boolean a_processBeforeGeneticOperators)(Code) | | Removes all natural selectors (either pre or post ones).
Parameters: a_processBeforeGeneticOperators - true: remove all selectorsprocessed before genetic operators, false: remove the ones processedafterwards author: Klaus Meffert since: 2.3 |
reset | public static void reset()(Code) | | SHOULD NOT BE NECESSARY TO CALL UNDER NORMAL CIRCUMSTANCES. May be useful
for unit tests.
Reset the configuration so that re-setting parameters such as fitness
function is possible (without calling this method, an overwriting of a
previously set fitness function results in a RuntimeException).
author: Klaus Meffert since: 3.0 |
reset | public static void reset(String a_id)(Code) | | Reset the configuration so that re-setting parameters such as fitness
function is possible (without calling this method, an overwriting of a
previously set fitness function results in a RuntimeException).
Parameters: a_id - a hopefully unique id of the configuration author: Klaus Meffert since: 3.0 |
resetProperty | public static void resetProperty(String a_propName)(Code) | | See Configuration.reset().
Parameters: a_propName - the property to reset author: Klaus Meffert since: 3.0 |
setAlwaysCaculateFitness | public void setAlwaysCaculateFitness(boolean a_alwaysCalculate)(Code) | | Parameters: a_alwaysCalculate - true: Chromosome.getFitnessValue() will always(re-)calculate the fitness value. This may be necessary in case ofenvironments where the state changes without the chromosome to notice. author: Klaus Meffert since: 3.2.2 |
setBreeder | public void setBreeder(IBreeder a_breeder)(Code) | | Parameters: a_breeder - the breeder to use author: Klaus Meffert since: 3.2 |
setBulkFitnessFunction | public synchronized void setBulkFitnessFunction(BulkFitnessFunction a_functionToSet) throws InvalidConfigurationException(Code) | | Sets the bulk fitness function to be used for this genetic algorithm.
The bulk fitness function may be used to evaluate and assign fitness
values to the entire group of candidate Chromosomes in a single batch.
This can be useful in cases where it's difficult to assign fitness
values to a Chromosome in isolation from the other candidate
Chromosomes.
Note that it is illegal to set both a bulk fitness function and a
normal fitness function. Although one or the other is required, the
two are mutually exclusive.
Parameters: a_functionToSet - bulk fitness function to be used throws: InvalidConfigurationException - if the bulk fitness function isnull, the normal fitness function has already been set, or if thisConfiguration object is locked author: Neil Rotstan author: Klaus Meffert since: 1.0 |
setChromosomePool | public void setChromosomePool(IChromosomePool a_chromosomePoolToSet) throws InvalidConfigurationException(Code) | | Sets the ChromosomePool that is to be associated with this
configuration. The ChromosomePool is used to pool discarded Chromosome
instances so that they may be recycled later, thereby saving memory and
the time to construct them from scratch. The presence of a ChromosomePool
is optional. If none exists, then a new Chromosome will be constructed
each time one is needed.
Parameters: a_chromosomePoolToSet - the ChromosomePool instance to use throws: InvalidConfigurationException - if this object is locked author: Neil Rotstan since: 1.0 |
setEventManager | public void setEventManager(IEventManager a_eventManagerToSet) throws InvalidConfigurationException(Code) | | Sets the event manager that is to be associated with this configuration.
The event manager is responsible for the management of event subscribers
and event notifications.
Parameters: a_eventManagerToSet - the EventManager instance to use in thisconfiguration throws: InvalidConfigurationException - if the event manager is nullor this Configuration object is locked author: Neil Rotstan since: 1.0 |
setFitnessEvaluator | public void setFitnessEvaluator(FitnessEvaluator a_fitnessEvaluator)(Code) | | Set the fitness evaluator (deciding if a given fitness value is better
when it's higher or better when it's lower).
Parameters: a_fitnessEvaluator - the FitnessEvaluator to be used author: Klaus Meffert since: 2.0 |
setFitnessFunction | public synchronized void setFitnessFunction(FitnessFunction a_functionToSet) throws InvalidConfigurationException(Code) | | Sets the fitness function to be used for this genetic algorithm.
The fitness function is responsible for evaluating a given Chromosome and
returning a positive integer that represents its worth as a candidate
solution. These values are used as a guide by the natural to determine
which Chromosome instances will be allowed to move on to the next round of
evolution, and which will instead be eliminated.
Note that it is illegal to set both this fitness function and a bulk
fitness function. Although one or the other must be set, the two are
mutually exclusive.
Parameters: a_functionToSet - fitness function to be used throws: InvalidConfigurationException - if the fitness function is null, abulk fitness function has already been set, or if this Configurationobject is locked. author: Neil Rotstan since: 1.1 |
setId | protected void setId(String a_id)(Code) | | Only to be called by sub classes, such as GPConfiguration.
Parameters: a_id - the id to set author: Klaus Meffert since: 3.2 |
setJGAPFactory | public void setJGAPFactory(IJGAPFactory a_factory)(Code) | | Parameters: a_factory - the IJGAPFactory to use author: Klaus Meffert since: 3.01 |
setKeepPopulationSizeConstant | public void setKeepPopulationSizeConstant(boolean a_keepPopSizeConstant)(Code) | | Allows to keep the population size constant after one evolution, even if
there is no appropriate instance of NaturalSelector (such as
WeightedRouletteSelector) registered with the Configuration.
Be aware that keeping the population size constant often means that a
higher population size is necessary (e.g. for the MinimizingMakeChange
example)!
Parameters: a_keepPopSizeConstant - true: population size will always bethe same size (as given with Configuration.setPopulationSize(int) author: Klaus Meffert since: 2.4 |
setMinimumPopSizePercent | public void setMinimumPopSizePercent(int a_minimumSizeGuaranteedPercent)(Code) | | Minimum size guaranteed for population. This is significant during
evolution as natural selectors could select fewer chromosomes for the next
generation than the initial population size was.
Parameters: a_minimumSizeGuaranteedPercent - if zero or below then no ensurancefor size given, see Genotype.evolve() author: Klaus Meffert |
setName | public void setName(String a_name)(Code) | | Parameters: a_name - informative name of the configuration author: Klaus Meffert since: 2.3 |
setNaturalSelector | public synchronized void setNaturalSelector(NaturalSelector a_selectorToSet) throws InvalidConfigurationException(Code) | | Sets the natural selector to be used for this genetic algorithm.
The natural selector is responsible for actually selecting
which Chromosome instances are allowed to move on to the next
round of evolution (usually guided by the fitness values
provided by the fitness function). This setting is required.
Parameters: a_selectorToSet - the natural selector to be used throws: InvalidConfigurationException - if the natural selector is null orthis Configuration object is locked author: Neil Rotstan since: 1.0 |
setPopulationSize | public synchronized void setPopulationSize(int a_sizeOfPopulation) throws InvalidConfigurationException(Code) | | Sets the population size to be used for this genetic algorithm.
The population size is a fixed value that represents the
number of Chromosomes contained within the Genotype (population).
This setting is required.
Parameters: a_sizeOfPopulation - population size to be used throws: InvalidConfigurationException - if the population size is notpositive or this object is locked author: Neil Rotstan since: 1.0 |
setPreservFittestIndividual | public void setPreservFittestIndividual(boolean a_preserveFittest)(Code) | | Determines whether to save (keep) the fittest individual.
Parameters: a_preserveFittest - true: always transfer fittest chromosome to nextgeneration author: Klaus Meffert since: 2.1 |
setRandomGenerator | public synchronized void setRandomGenerator(RandomGenerator a_generatorToSet) throws InvalidConfigurationException(Code) | | Sets the random generator to be used for this genetic algorithm.
The random generator is responsible for generating random numbers,
which are used throughout the process of genetic evolution and
selection. This setting is required.
Parameters: a_generatorToSet - random generator to be used throws: InvalidConfigurationException - if the random generator is null orthis object is locked author: Neil Rotstan since: 1.0 |
setSampleChromosome | public void setSampleChromosome(IChromosome a_sampleChromosomeToSet) throws InvalidConfigurationException(Code) | | Sets the sample Chromosome that is to be used as a guide for the
construction of other Chromosomes. The Chromosome should be setup
with each gene represented by the desired concrete Gene implementation
for that gene position (locus). Anytime a new Chromosome is created,
it will be constructed with the same Gene setup as that provided in
this sample Chromosome.
Parameters: a_sampleChromosomeToSet - Chromosome to be used as the sample throws: InvalidConfigurationException - if the given Chromosome is null orthis Configuration object is locked author: Neil Rotstan since: 1.0 |
setSelectFromPrevGen | public void setSelectFromPrevGen(double a_percentage)(Code) | | |
toString | public String toString()(Code) | | string representation of the configuration containing allconfigurable elements author: Klaus Meffert since: 2.3 |
verifyChangesAllowed | protected void verifyChangesAllowed() throws InvalidConfigurationException(Code) | | Makes sure that this Configuration object isn't locked. If it is, then
an exception is thrown with an appropriate message indicating
that settings in this object may not be altered. This method
should be invoked by any mutator method in this object prior
to making any state alterations.
throws: InvalidConfigurationException - if this Configuration object islocked author: Neil Rotstan since: 1.0 |
verifyStateIsValid | public synchronized void verifyStateIsValid() throws InvalidConfigurationException(Code) | | Tests the state of this Configuration object to make sure it's valid.
This generally consists of verifying that required settings have, in
fact, been set. If this object is not in a valid state, then an
exception will be thrown detailing the reason the state is not valid.
throws: InvalidConfigurationException - if the state of this Configurationis not valid. The error message in the exception will detail the reasonfor invalidity author: Neil Rotstan since: 1.0 |
|
|