Java Doc for Genotype.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.Genotype

All known Subclasses:   org.jgap.distr.DistributedGenotype,
Genotype
public class Genotype implements Serializable,Runnable(Code)
Genotypes are fixed-length populations of chromosomes. As an instance of a Genotype is evolved, all of its Chromosomes are also evolved. A Genotype may be constructed normally via constructor, or the static randomInitialGenotype() method can be used to generate a Genotype with a randomized Chromosome population.

Please note that among all created Genotype instances there may only be one configuration, used by all Genotype instances.
author:
   Neil Rotstan
author:
   Klaus Meffert
since:
   1.0




Constructor Summary
public  Genotype(Configuration a_configuration, IChromosome[] a_initialChromosomes)
     Constructs a new Genotype instance with the given array of Chromosomes and the given active Configuration instance.
public  Genotype(Configuration a_configuration, Population a_population)
     Constructs a new Genotype instance with the given array of Chromosomes and the given active Configuration instance.
public  Genotype(Configuration a_configuration)
     Don't use this constructor, it's only for internal use.

Method Summary
protected  voidapplyGeneticOperator(GeneticOperator a_operator, Population a_population, List a_chromosomes)
     Overwritable method that calls a GeneticOperator to operate on a given population and asks him to store the result in the list of chromosomes. Override this method if you want to ensure that a_chromosomes is not part of a_population resp.
public  voidapplyGeneticOperators()
     Applies all GeneticOperators registered with the Configuration.
protected  voidapplyNaturalSelectors(boolean a_processBeforeGeneticOperators)
     Applies all NaturalSelectors registered with the Configuration.
public  booleanequals(Object a_other)
     Compares this Genotype against the specified object.
public synchronized  voidevolve()
     Evolves the population of Chromosomes within this Genotype.
public  voidevolve(int a_numberOfEvolutions)
     Evolves this Genotype the specified number of times.
public  voidfillPopulation(int a_num)
     Fills up the population with random chromosomes if necessary.
public synchronized  IChromosome[]getChromosomes()
     Retrieves the array of Chromosomes that make up the population of this Genotype instance.
public  ConfigurationgetConfiguration()
    
public  ListgetEvolves(IPopulationSplitter a_splitter)
    
public synchronized  IChromosomegetFittestChromosome()
     Retrieves the Chromosome in the Population with the highest fitness value.
public synchronized  IChromosomegetFittestChromosome(int a_startIndex, int a_endIndex)
     Retrieves the Chromosome in the Population with the highest fitness value within the given indices.
public synchronized  ListgetFittestChromosomes(int a_numberOfChromosomes)
     Retrieves the top n Chromsomes in the population (the ones with the best fitness values).
public  PopulationgetPopulation()
    
public static  ConfigurationgetStaticConfiguration()
    
public  inthashCode()
     Hashcode function for the genotype, tries to create a unique hashcode for the chromosomes within the population.
protected  voidkeepPopSizeConstant(Population a_pop, int a_maxSize)
     Cares that the population size does not exceed the given maximum size.
public  voidmergeResults(IPopulationMerger a_merger, EvolveResult[] a_results)
    
public static  GenotyperandomInitialGenotype(Configuration a_configuration)
     Convenience method that returns a newly constructed Genotype instance configured according to the given Configuration instance.
public  voidrun()
     If used in a Thread: runs the evolution forever. You have to implement a listener to stop computation sometime.
protected  voidsetPopulation(Population a_pop)
    
public static  voidsetStaticConfiguration(Configuration a_configuration)
     Sets the configuration to use with the Genetic Algorithm.
public  StringtoString()
    


Constructor Detail
Genotype
public Genotype(Configuration a_configuration, IChromosome[] a_initialChromosomes) throws InvalidConfigurationException(Code)
Constructs a new Genotype instance with the given array of Chromosomes and the given active Configuration instance. Note that the Configuration object must be in a valid state when this method is invoked, or a InvalidConfigurationException will be thrown.
Parameters:
  a_configuration - the Configuration object to use
Parameters:
  a_initialChromosomes - the Chromosome population to be managed bythis Genotype instance
throws:
  InvalidConfigurationException - if the given Configuration object isin an invalid state
author:
   Neil Rotstan
author:
   Klaus Meffert
since:
   1.0



Genotype
public Genotype(Configuration a_configuration, Population a_population) throws InvalidConfigurationException(Code)
Constructs a new Genotype instance with the given array of Chromosomes and the given active Configuration instance. Note that the Configuration object must be in a valid state when this method is invoked, or a InvalidconfigurationException will be thrown.
Parameters:
  a_configuration - the Configuration object to use
Parameters:
  a_population - the Chromosome population to be managed by thisGenotype instance
throws:
  InvalidConfigurationException -
author:
   Neil Rotstan
author:
   Klaus Meffert
since:
   2.0



Genotype
public Genotype(Configuration a_configuration) throws InvalidConfigurationException(Code)
Don't use this constructor, it's only for internal use.
Parameters:
  a_configuration - not used here!
throws:
  InvalidConfigurationException -
author:
   Klaus Meffert
since:
   3.0




Method Detail
applyGeneticOperator
protected void applyGeneticOperator(GeneticOperator a_operator, Population a_population, List a_chromosomes)(Code)
Overwritable method that calls a GeneticOperator to operate on a given population and asks him to store the result in the list of chromosomes. Override this method if you want to ensure that a_chromosomes is not part of a_population resp. if you want to use a different list.
Parameters:
  a_operator - the GeneticOperator to call
Parameters:
  a_population - the population to use
Parameters:
  a_chromosomes - the list of Chromosome objects to return
author:
   Klaus Meffert
since:
   2.4



applyGeneticOperators
public void applyGeneticOperators()(Code)
Applies all GeneticOperators registered with the Configuration.
author:
   Klaus Meffert
since:
   3.0



applyNaturalSelectors
protected void applyNaturalSelectors(boolean a_processBeforeGeneticOperators)(Code)
Applies all NaturalSelectors registered with the Configuration.
Parameters:
  a_processBeforeGeneticOperators - true apply NaturalSelectorsapplicable before GeneticOperators, false: apply the ones applicableafter GeneticOperators
author:
   Klaus Meffert
since:
   2.0



equals
public boolean equals(Object a_other)(Code)
Compares this Genotype against the specified object. The result is true if the argument is an instance of the Genotype class, has exactly the same number of chromosomes as the given Genotype, and, for each Chromosome in this Genotype, there is an equal chromosome in the given Genotype. The chromosomes do not need to appear in the same order within the population.
Parameters:
  a_other - the object to compare against true if the objects are the same, false otherwise
author:
   Neil Rotstan
author:
   Klaus Meffert
since:
   1.0



evolve
public synchronized void evolve()(Code)
Evolves the population of Chromosomes within this Genotype. This will execute all of the genetic operators added to the present active configuration and then invoke the natural selector to choose which chromosomes will be included in the next generation population. Note that the population size not always remains constant (dependent on the NaturalSelectors used!). To consecutively call this method, use evolve(int)!!!
author:
   Neil Rotstan
author:
   Klaus Meffert
since:
   1.0



evolve
public void evolve(int a_numberOfEvolutions)(Code)
Evolves this Genotype the specified number of times. This is equivalent to invoking the standard evolve() method the given number of times in a row.
Parameters:
  a_numberOfEvolutions - the number of times to evolve this Genotypebefore returning
author:
   Klaus Meffert
since:
   1.1



fillPopulation
public void fillPopulation(int a_num) throws InvalidConfigurationException(Code)
Fills up the population with random chromosomes if necessary.
Parameters:
  a_num - the number of chromosomes to add
throws:
  InvalidConfigurationException -
author:
   Klaus Meffert
since:
   3.2



getChromosomes
public synchronized IChromosome[] getChromosomes()(Code)
Retrieves the array of Chromosomes that make up the population of this Genotype instance. the Population of Chromosomes
author:
   Neil Rotstan
author:
   Klaus Meffert
since:
   1.0



getConfiguration
public Configuration getConfiguration()(Code)



getEvolves
public List getEvolves(IPopulationSplitter a_splitter) throws Exception(Code)



getFittestChromosome
public synchronized IChromosome getFittestChromosome()(Code)
Retrieves the Chromosome in the Population with the highest fitness value. the Chromosome with the highest fitness value, or null if thereare no chromosomes in this Genotype
author:
   Neil Rotstan
author:
   Klaus Meffert
since:
   1.0



getFittestChromosome
public synchronized IChromosome getFittestChromosome(int a_startIndex, int a_endIndex)(Code)
Retrieves the Chromosome in the Population with the highest fitness value within the given indices.
Parameters:
  a_startIndex - the index to start the determination with
Parameters:
  a_endIndex - the index to end the determination with the Chromosome with the highest fitness value within the givenindices, or null if there are no chromosomes in this Genotype
author:
   Klaus Meffert
since:
   3.0



getFittestChromosomes
public synchronized List getFittestChromosomes(int a_numberOfChromosomes)(Code)
Retrieves the top n Chromsomes in the population (the ones with the best fitness values).
Parameters:
  a_numberOfChromosomes - the number of chromosomes desired the list of Chromosomes with the highest fitness values, or nullif there are no chromosomes in this Genotype
author:
   Charles Kevin Hill
since:
   2.4



getPopulation
public Population getPopulation()(Code)
the current population of chromosomes
author:
   Klaus Meffert
since:
   2.1



getStaticConfiguration
public static Configuration getStaticConfiguration()(Code)
the configuration to use with the Genetic Algorithm
author:
   Klaus Meffert
since:
   2.0



hashCode
public int hashCode()(Code)
Hashcode function for the genotype, tries to create a unique hashcode for the chromosomes within the population. The logic for the hashcode is Step Result ---- ------ 1 31*0 + hashcode_0 = y(1) 2 31*y(1) + hashcode_1 = y(2) 3 31*y(2) + hashcode_2 = y(3) n 31*y(n-1) + hashcode_n-1 = y(n) Each hashcode is a number and the binary equivalent is computed and returned. the computed hashcode
author:
   vamsi
since:
   2.1



keepPopSizeConstant
protected void keepPopSizeConstant(Population a_pop, int a_maxSize)(Code)
Cares that the population size does not exceed the given maximum size.
Parameters:
  a_pop - the population to keep constant in size
Parameters:
  a_maxSize - the maximum size allowed for the population
author:
   Klaus Meffert
since:
   2.5



mergeResults
public void mergeResults(IPopulationMerger a_merger, EvolveResult[] a_results) throws Exception(Code)



randomInitialGenotype
public static Genotype randomInitialGenotype(Configuration a_configuration) throws InvalidConfigurationException(Code)
Convenience method that returns a newly constructed Genotype instance configured according to the given Configuration instance. The population of Chromosomes will be created according to the setup of the sample Chromosome in the Configuration object, but the gene values (alleles) will be set to random legal values.
Parameters:
  a_configuration - the current active Configuration object a newly constructed Genotype instance
throws:
  IllegalArgumentException - if the given Configuration object is null
throws:
  InvalidConfigurationException - if the given Configurationinstance is not in a valid state
author:
   Neil Rotstan
author:
   Klaus Meffert
since:
   2.3



run
public void run()(Code)
If used in a Thread: runs the evolution forever. You have to implement a listener to stop computation sometime. See examples.simpleBooleanThreaded for a possible implementation of such a listener.
author:
   Klaus Meffert
since:
   3.01



setPopulation
protected void setPopulation(Population a_pop)(Code)



setStaticConfiguration
public static void setStaticConfiguration(Configuration a_configuration)(Code)
Sets the configuration to use with the Genetic Algorithm.
Parameters:
  a_configuration - the configuration to use
author:
   Klaus Meffert
since:
   2.0



toString
public String toString()(Code)
string representation of this Genotype instance, useful for displaypurposes
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.