Structure - kribo852/DukeDarwin GitHub Wiki

There really isn't much code in the framework given that the "example genetic algorithms" are counted out.

There is the Main class, some implementation for the selection of a solution in the Habitat and RobustHabitat classes and an abstract class Lifeform representing the solution.

If there is a need to change the method of selecting solutions or for experimenting, have a look at RobustHabitat and implement your own :)


UML-diagram:

http://www.plantuml.com/plantuml/uml/bLJ1RXf133qpNs4f5wAGIEcnYg8eA6ghfcqKLksXgYhlhe4finuqumr5Y7_lUfai2e5Kp0dFUy_FOxo-YO91wigPmc6Cy0Kjhuo1vfp1gW755cjuyhQ4ge7w8mcM9pz_0OP9FDqGJxR4OPl4UIpRNuaEUvZtTanZ7ofWMdpYvfOBwYTvWZHIvTeOnehY70i2l-3VjfexgeWrbMSukMqFhDI3lH1WXA-N6cLJYaqO2EWlgYg27oiGlQjL744yp8FFcuGH594f2XJ8a9EodgY4VDdS4em3LhJmONO1RMuFTQINoA15AfmH83UUGgmkZQdojezkcxr9GrosHPkrHiPW7YLW8HjE9xcw6q2soLX667hdgD3KLtVNrz0r9C9ZpOov8z1_CPqC9iI-8jFhcTxPSyR-s3Aw3Zmr2gwUxTSDKDM2GZkyom6yl7ZtXl9jXzBNMkc4P5JuGFqTGfexNykybjTWfgFpeSsSm9Qk0wtijKaZ_NfYBhxDnLReXajdkQIW7KcjtJRyl-g7PS3Abll5XzNPwE6PTOJdVSsJOvs-MowbPYPtv0DlqRaVP2TJESRkinTd-KYhhA4E5RHZI-5mOtO_Yu-OMq7P3la9xCnD6eIzAwNNgGxieUxpIgCxW4EhAPNJDEkEorHLLtwA4-dHvtMK0nmmYJNIiYdCf5rdZSDcfOcVluTiQcDgW8swVKfOJ8bXwMjO80iWpDf_GLVQ7ohamfZkWUTTERhauVnwsztEKsyLDJV4PLsvVm00


Comparing scores and repopulation a habitat with new generations of lifeforms can be made by the Habitat (which you can implement on your own if you want to, but it isn't necessary). The habitats are tested to some extent, so you can concentrate on writing your lifeform specification. Inversion of control makes it so that you can use your own tailored habitat by specifying it in the lifeform.

The classloader makes it possible to swap lifeforms without modifying the code, the name of a lifeform is taken as an argument to the main class in the command prompt.


Main: loads a Lifeform and runs it as an application. Main contains a class loader that currently is used to load a/the lifeform.

Habitat: an abstract class representing a place to contain and run evolution of lifeforms. default implementation is RobustHabitat.

Lifeform: abstract class representing a lifeform, with a genome of a collection of type T. Has abstract methods for running an evaluation of the lifeform, returning the score, mutation, output of results and making of a new genome. Lifeform has a start method that can be implemented to allow overriding of the default Habitat implementation. This can be used to tweak the Habitat to the Lifeform. Lifeform implements Runnable so that many instances can be tried at once.

RobustHabitat: Single threaded habitat that can manage Lifeforms that implements either sexual or asexual mutation properly.

HighEndHabitat: Habitat that has the following features:

-Sexual reproduction.

-A method of evolution that is "generationless" 2 lifeforms in the habitat are chosen from an array, with higher probabilities for lifeforms with higher fitness/score.
 The child of the 2 lifeforms is run and evaluated, and then placed in the habitat. the habitat size is limited and the worst performing lifeforms are thrown away.
 
-Runs the evaluation on 3 threads simultaniously

Some examples of lifeforms:

TSPLifeform: gives a soloution to a Traveling salesman problem (non optimal of course)

OptimalPyramidLife: calculates the optimal ratio between height and width of a pyramid concering volume per surfacearea

OptimalCylinderLife: calculates the optimal ratio between height and width of a cylinder with a lid and bottom concering volume per surfacearea

LungLife: makes a lunglike organic structure by maximizing area covered by "air".

VindtunnelLife:

BallWeight:

KotlinLife:

TextClassifierLifeform: