The AbleGeneticSearch agent provides a flexible environment for using genetic algorithms for search and optimization problems. The agent manages a set of AbleGeneticObjects which represent the population members. These AbleGeneticObjects implement any specialized operators as well as the fitness evaluation function for the member. They can also act as intermediaries for underlying AbleBeans. The AbleGeneticSearch agent supports any chromosome encodings, but has built-in support for character strings. This includes traditional binary "01110" encodings as well as "abbac" type of character encodings. Hybrid encodings such as strings of real numbers can also easily be supported.
If the population size is equal to the replacement size, then we have generation replacement. One modification is that elitism is used, where the member with the highest fitness will always be copied over to the next generation. This insures that the solution will monotonically improve. If the replacement size is less than the population size, then only the specified number of individuals will be created. The least fit N members will be deleted from the popualtion to make room for the newly created members.
Roulette wheel selection is used to pick parents for reproduction. Either raw fitness values are used or if the normalized fitness checkbox is selected, linearly normalized fitness values will be used. If normalization is selected, the raw fitness values are scaled so that the maximum fitness value will be 2 times the average fitness value.
Roulette wheel selection is used to pick an operator to be applied during a reproduction process. These operators are defined by the AbleGeneticObject class. One or more operators can have non-zero fitness values and they should add up to 100. These fitness values are used by the selection process. Once the operator is selected, it is still up to the crossoverRate and mutationRate parameters to determine where and how the crossover and mutate operations are performed.
A user can step through the search a single population at a time by pressing the process from the context menu. An automated search can be started by pressing the Evolve button on the Search Agent customizer dialog. There are two parameters for stopping the automated search process. The automated search will halt when the maximum number of passes (generations) are created, or if the maximum raw fitness value of any population member exceeds the fitness threshold parameter.
There are two major ways that the Genetic Search Agent can be used, with or without an Evaluation Agent.
The simplest case is when the GeneticObject implements a function and we are trying to optimize the parameters of that function. The computFitness() method in the GeneticObject takes the chromosome and evaluates it in the function.
A more powerful and more complex approach is when the GeneticObject is used as an intermediary to optimize some set of parameters on a AbleBean or AbleAgent. The GeneticObject creates and returns a single EvaluationAgent to the Search agent. This evaluation agent can be as simple (contain a single AbleBean) or complex (contain multiple AbleBeans or even other AbleAgents) as required.
An example of this is when we have a neural prediction agent and want to find the optimal set of input parameters to maximize. It takes the chromosome, presents it to the evaluation agent (a single neural prediction agent) and compute the fitness value.
A more complicated case if we use the GeneticSearch Agent to search the architecture or training parameter space of a neural network. In this case we have N GeneticObjects and N neural networks. However we want to have a single DataSource and translate filters. It takes the chromosome, generates a new neural network and inserts it into the evaluation agent and then evaluates it by training it for some fixed period of time.