Java Doc for Configuration.java in  » Development » jgap » org » jgap » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » jgap » org.jgap 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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

Field Summary
final public static  StringPROPERTY_BFITFNC_INST
    
final public static  StringPROPERTY_EVENT_MGR_INST
    
final public static  StringPROPERTY_FITEVAL_INST
    
final public static  StringPROPERTY_FITFUNC_INST
    
final public static  StringPROPERTY_JGAPFACTORY_CLASS
     Constant for class name of JGAP Factory to use.
final public static  StringPROPERTY_SAMPLE_CHROM_INST
    
final public static  StringS_CHROMOSOME_SIZE
    
final public static  StringS_CONFIGURATION
    
final public static  StringS_CONFIGURATION_HANDLER
    
final public static  StringS_CONFIGURATION_NAME
    
final public static  StringS_EVENT_MANAGER
    
final public static  StringS_FITNESS_EVALUATOR
    
final public static  StringS_FITNESS_FUNCTION
    
final public static  StringS_GENETIC_OPERATORS
    
final public static  StringS_MINPOPSIZE
    
final public static  StringS_NATURAL_SELECTORS
    
final public static  StringS_NONE
    
final public static  StringS_POPULATION_SIZE
    
final public static  StringS_POST
    
final public static  StringS_PRE
    
final public static  StringS_RANDOM_GENERATOR
    
final public static  StringS_SAMPLE_CHROM
    
final public static  StringS_SIZE
    
final public static  StringS_TOSTRING
    

Constructor Summary
public  Configuration()
    
public  Configuration(String a_id, String a_name)
     Initialize with default values.
public  Configuration(String a_name)
     Constructs a configuration with an informative name but without a unique ID.
public  Configuration(String a_configFileName, boolean a_ignore)
     Reads in the configuration from the given file.

Method Summary
public synchronized  voidaddGeneticOperator(GeneticOperator a_operatorToAdd)
     Adds a genetic operator for use in this algorithm.
public  voidaddNaturalSelector(NaturalSelector a_selector, boolean a_processBeforeGeneticOperators)
     Adds a NaturalSelector to the ordered chain of registered NaturalSelector's.
protected  voidcheckProperty(String a_propname, Object a_obj, Object a_oldObj, String a_errmsg)
     Verifies that a property is not set.
public  Objectclone()
    
public  intcompareTo(Object a_other)
     The compareTo-method.
protected  ObjectdoClone(Object a_objToClone)
     Helper called from clone.
public  booleanequals(Object a_other)
     The equals-method.
public  IBreedergetBreeder()
    
public synchronized  BulkFitnessFunctiongetBulkFitnessFunction()
     Retrieves the bulk fitness function previously setup in this Configuration object.
public  IChromosomePoolgetChromosomePool()
     Retrieves the ChromosomePool instance, if any, that is associated with this configuration.
public  intgetChromosomeSize()
     Retrieves the chromosome size being used by this genetic algorithm.
public  ConfigurationHandlergetConfigurationHandler()
     Implementation of the Configurable interface.
public  IEventManagergetEventManager()
     Retrieves the event manager associated with this configuration.
public  FitnessEvaluatorgetFitnessEvaluator()
    
public synchronized  FitnessFunctiongetFitnessFunction()
     Retrieves the fitness function previously setup in this Configuration object.
public  intgetGenerationNr()
    
public  ListgetGeneticOperators()
     Retrieves the genetic operators setup in this Configuration instance.
public  StringgetId()
    
public  IJGAPFactorygetJGAPFactory()
    
public  intgetMinimumPopSizePercent()
    
public  StringgetName()
    
public synchronized  NaturalSelectorgetNaturalSelector()
     Retrieves the natural selector setup in this Configuration instance.
public synchronized  NaturalSelectorgetNaturalSelector(boolean a_processBeforeGeneticOperators, int a_index)
    
public  ChainOfSelectorsgetNaturalSelectors(boolean a_processBeforeGeneticOperators)
    
public  intgetNaturalSelectorsSize(boolean a_processBeforeGeneticOperators)
    
public synchronized  intgetPopulationSize()
     Retrieves the population size setup in this Configuration instance.
public synchronized  RandomGeneratorgetRandomGenerator()
     Retrieves the random generator setup in this Configuration instance.
public  IChromosomegetSampleChromosome()
     Retrieves the sample Chromosome that contains the desired Gene setup for each respective gene position (locus).
public  doublegetSelectFromPrevGen()
    
protected static  StringgetThreadKey(Thread current, String a_id)
     Builds a string considering the current thread and the given id.
public  voidincrementGenerationNr()
    
public  booleanisAlwaysCalculateFitness()
     true: Chromosome.getFitnessValue() will always (re-)calculate thefitness value.
public  booleanisKeepPopulationSizeConstant()
     See setKeepPopulationSizeConstant for description.
public  booleanisLocked()
     Retrieves the lock status of this object.
public  booleanisPreserveFittestIndividual()
    
public synchronized  voidlockSettings()
     Locks all of the settings in this configuration object.
protected  StringmakeKey(Object a_obj)
    
protected  StringmakeThreadKey()
    
public  ConfigurationnewInstance(String a_id, String a_name)
     Creates a new Configuration instance by cloning.
public  voidremoveNaturalSelectors(boolean a_processBeforeGeneticOperators)
     Removes all natural selectors (either pre or post ones).
public static  voidreset()
     SHOULD NOT BE NECESSARY TO CALL UNDER NORMAL CIRCUMSTANCES.
public static  voidreset(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  voidresetProperty(String a_propName)
     See Configuration.reset().
public static  voidresetProperty(String a_propName, String a_id)
    
public  voidsetAlwaysCaculateFitness(boolean a_alwaysCalculate)
    
Parameters:
  a_alwaysCalculate - true: Chromosome.getFitnessValue() will always(re-)calculate the fitness value.
public  voidsetBreeder(IBreeder a_breeder)
    
public synchronized  voidsetBulkFitnessFunction(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  voidsetChromosomePool(IChromosomePool a_chromosomePoolToSet)
     Sets the ChromosomePool that is to be associated with this configuration.
public  voidsetEventManager(IEventManager a_eventManagerToSet)
     Sets the event manager that is to be associated with this configuration.
public  voidsetFitnessEvaluator(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  voidsetFitnessFunction(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  voidsetId(String a_id)
     Only to be called by sub classes, such as GPConfiguration.
public  voidsetJGAPFactory(IJGAPFactory a_factory)
    
public  voidsetKeepPopulationSizeConstant(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  voidsetMinimumPopSizePercent(int a_minimumSizeGuaranteedPercent)
     Minimum size guaranteed for population.
public  voidsetName(String a_name)
    
public synchronized  voidsetNaturalSelector(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  voidsetPopulationSize(int a_sizeOfPopulation)
     Sets the population size to be used for this genetic algorithm.
public  voidsetPreservFittestIndividual(boolean a_preserveFittest)
     Determines whether to save (keep) the fittest individual.
public synchronized  voidsetRandomGenerator(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  voidsetSampleChromosome(IChromosome a_sampleChromosomeToSet)
     Sets the sample Chromosome that is to be used as a guide for the construction of other Chromosomes.
public  voidsetSelectFromPrevGen(double a_percentage)
    
public  StringtoString()
    
protected  voidverifyChangesAllowed()
     Makes sure that this Configuration object isn't locked.
public synchronized  voidverifyStateIsValid()
     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.

Field Detail
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_MINPOPSIZE
final public static String S_MINPOPSIZE(Code)



S_NATURAL_SELECTORS
final public static String S_NATURAL_SELECTORS(Code)



S_NONE
final public static String S_NONE(Code)



S_POPULATION_SIZE
final public static String S_POPULATION_SIZE(Code)



S_POST
final public static String S_POST(Code)



S_PRE
final public static String S_PRE(Code)



S_RANDOM_GENERATOR
final public static String S_RANDOM_GENERATOR(Code)



S_SAMPLE_CHROM
final public static String S_SAMPLE_CHROM(Code)



S_SIZE
final public static String S_SIZE(Code)



S_TOSTRING
final public static String S_TOSTRING(Code)




Constructor Detail
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



Configuration
public Configuration(String a_configFileName, boolean a_ignore) throws ConfigException, InvalidConfigurationException(Code)
Reads in the configuration from the given file.
Parameters:
  a_configFileName - the config file from which to load theconfiguration
Parameters:
  a_ignore - just there to create distinct signatures :-(
throws:
  ConfigException -
throws:
  InvalidConfigurationException -
author:
   Siddhartha Azad
since:
   2.3




Method Detail
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



getConfigurationHandler
public ConfigurationHandler getConfigurationHandler()(Code)
Implementation of the Configurable interface. ConfigurationHandler
throws:
  ConfigException -
author:
   Siddhartha Azad



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



makeThreadKey
protected String makeThreadKey()(Code)



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



resetProperty
public static void resetProperty(String a_propName, String a_id)(Code)



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



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.