Extreme Genetic Programming


Sister

XGP is a combination of ExtremeProgramming and GeneticProgramming, where a self-organizing team might shepherd the evolution of self-orgainizing software by writing increasingly stringent tests -- WardCunningham

This member of SampleApplications demonstrates the ease with which Fixture can be subclassed for use within an existing application. The execution of the tests is driven from within the application, which in this case is an XGP framework called Neovolve. The purpose of this application is to allow unit tests to drive the evolution of solutions which evolve to solve the unit tests.

Neovolve creates a population of Individuals with Chromosomes of functions and arguments that crossbreed with other Individuals to evolve solutions. Populations of tens of thousands of individuals must be tested over many generations using the given Fixture. Neovolve uses the subclassed Fixture, XGPFixture, to perform tests and defer output until the fittest individual of the generation is computed. The results of testing the fittest Individual of each generation are output to the results page as they are computed.

The testing framework sets up test values via the input web page, creates an instance of Neovolve, and starts the evolutionary process. Neovolve calls the Fixture for each Individual tested. A slight modification to the framework allows the Individual to be passed to the Fixture test methods. The test method boxes up the arguments supplied to the evolving code and the proper Neovolve method is called depending on the return type desired.

When all tests pass, a fit solution is deemed to have been discovered.

The test5aColumnFixture below was used to evolve the trivial solution to adding three numbers. Notice the Add() method in the fixture. Add() uses

  execute_int(<chromosome 0>, <Object[] arguments>)
to return an integer result. To return other types:
  execute_boolean(<chromosome 0>, <Object[] arguments>)
  execute_float(<chromosome 0>, <Object[] arguments>)
  execute_long(<chromosome 0>, <Object[] arguments>)
  execute_double(<chromosome 0>, <Object[] arguments>)
  execute_void(<chromosome 0>, <Object[] arguments>)
  execute_object(<chromosome 0>, <Object[] arguments>)

These methods take a chromosome number (0) and an array of arguments and return the desired type. Each returned object is tested against the expected value and the total successful tests determine the fitness of that individual. The unit test is the fitness function and the testing framework drives the evolution.


test5aColumnFixture
ZXYAdd()
100111
121215
142319
163423
184527
205631
226735
247839
268943

Results: http://www.neocoretechs.com/results.html

  import fit.*;
  import com.neocoretechs.neovolve.*;
  import com.neocoretechs.neovolve.objects.*;

public class test5aColumnFixture extends XGPFixture { public int X; public int Y; public int Z; public int Add(Individual ind) { Object[] args = new Object[]{new Integer(X), new Integer(Y), new Integer(Z)}; int ret = ind.execute_int(0, args); //System.out.println("Res: "+ret); return ret; } }


The Evolution of Software is Software by Evolution More Detail can be found at http://www.neocoretechs.com

 

Last edited February 23, 2003
Return to WelcomeVisitors