A genetic algorithm is trivial in any programming language and so it easy to implement in Java. It is capable of finding global maxima much much quicker than other methods such as simulated annealing, as you can only jump between neighbouring solutions using a SA algorithm rather than around the entire search space with a GA (made possible through crossover). Consequently, it is much less prone to getting stuck in a local maxia (which is a problem if you are trying to maximise the fitness value) or local minima (which is a problem if you are trying to minimise the fitness value)
As for applications, I programmed an automated timetabling system that timetable extra curriculum activies (such as workshops, group meetings, tutorials) around an existing lecture timetable which had to take into account 8 constraints/rules on how they had to be timetabled. This employed a GA - worked really well.
A genetic algorithm involves the use of encoding a solution as a chromosome and optimising that solution through the use of mutation and crossover operators - hence 'genetic' as it is imitating what happenins in out DNA - over a number of generations until either the maximum number of generations have been met or the desired fitness has been met/exceeded.
This means you will need a fitness function also that will evaluate your solutions that are present in the initial population and then present in the subsequent populations formed over the different generations.
Here is an outline of a GENERAL GA:
Note: the population sizes you are working with are up to you but there will be a range of sizes that will be optimal for the problem you have i.e. will allow you to find the BETTER solution quicker
There are many different ypes of crossover and mutational methods you can employ. Crossover will depenend on your encoding of the chromosome you use and sometimes standard crossover will not work and so you may need to use different forms, such as partially matched crossover (PMX).
You will need to decide if you want to score your solutions by giving those that are 'better' lower or higher scores - if you assign higher values to more desirable solutions then you will be aiming to achieve a global maxima, otherwise you will be aiming to achieve a global minima.
Let me know if you have any other questions.
[ May 30, 2007: Message edited by: Sam Bluesman ]
[ May 30, 2007: Message edited by: Sam Bluesman ] [ May 30, 2007: Message edited by: Sam Bluesman ]