Here's a little code I've had laying around for a few years.

http://people.apache.org/~brentworden/genetics.zip

Feel free to use, modify, or throw away as you see fit.

Brent

-----Original Message-----
From: Phil Steitz [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 30, 2008 12:31 AM
To: Jakarta Commons Developers List
Subject: Re: [math] Genetic Algorithms

On Sat, Mar 29, 2008 at 6:15 PM, Al Chou <[EMAIL PROTECTED]> wrote:
> ----- Original Message ----
>  > From: Phil Steitz <[EMAIL PROTECTED]>
>  > To: Jakarta Commons Developers List <dev@commons.apache.org>
>  > Sent: Saturday, March 29, 2008 5:53:47 PM
>  > Subject: [math] Genetic Algorithms
>  >
>  > I would like to start work on a GA framework.  This has been on the
>  > WishList for some time and I now have a TLS type problem that I am
>  > working on that is enough motivation for me personally to get
things
>  > rolling.  Here are some rough ideas on what I have in mind.  As
>  > always, feedback / suggestions / patches appreciated.
>
>  Resurfacing for a moment, I wonder if it would make sense to approach
an existing project that is open source but not GPL'ed to see if if
could be folded into Commons-Math.  I've found two candidates that meet
these two criteria (and another that was under LGPL I believe, which I
haven't copied here):
>
>  http://jgap.sourceforge.net/

This looks like GPL with BSD as an option in exchange for $.  Would
have to be relicensed.
>
>  http://cs.gmu.edu/~eclab/projects/ecj/ (university project, no
license explicitly mentioned)

Academic Free License ("AFL") v. 3.0  - don't know if this is
ASL-compatible or not.  Looks like the PRNG impls include some NR
code, so all would have to be carefully vetted.  Also would have to
get clearance from what looks like a large list of contributors.

Of course we are open to any and all contributions and contributors.
I would personally rather spend my time developing a small, clean-room
implementation than chasing down code grants, CLAs and commitment to
support;  but by all means if you or anyone else are interested in
enlisting more volunteers, I am +1 for that.  We just need to make
sure that we do not end up taking on code without volunteers to join
our community and support it or encumbered code.

In the mean time, I will keep playing with the ideas above and welcome
input or patches.  I do not see this as a large amount of code and
would for my personal uses like very much to have a small ASL-licensed
framework with no dependencies outside of [math] (but all the
capabilities of [math] available for use by the framework and client
code).

Phil

>
>
>  Al
>
>
>
>
>  > 0) Scope - a framework for implementing genetic algorithms, as
>  > described in e.g. [1], [2].
>  > 1) Usage / what the framework provides - user classes should
implement
>  > minimally encoding and objective functions.  Stock mutation,
crossover
>  > and selection functions operating on binary encodings should be
>  > provided by the framework, as well as execution of the algorithm,
but
>  > user classes should be able to plug in custom encoding, mutation,
>  > crossover, and selection.  Objective and other functions should
also
>  > be allowed to have parameters, which the framework will somehow
gather
>  > and pass in to them.
>  > 2) Other - the framework should not require that populations be
stored
>  > in memory and it should support parallelization of population
>  > processing functions
>  > 3) Package - o.a.c.math.genetic  (I am open to putting this inside
>  > optimization, but think flatter might be better here).
>  > 4) Structure straw man:
>  > Chromosomes - Chromosome interface includes mutate(),
>  > crossover(Chromosome) and fitness().  AbstractBinaryChromosome
>  > includes stock implementations of mutate and crossover for binary
>  > encodings.
>  > Populations - Population interface provides a Chromosome Iterator,
>  > select(long), add(Chromosome), delete(Chromosome).  Abstract
classes
>  > provide Roulette, Tournament, other select implementations for
>  > Populations backed / not backed by in memory collections and I/O /
>  > storage management.
>  > GeneticAlgorithm - implements GA (following "canonical algorithm"
as
>  > described in [2]) given initial Population and configured sampling
>  > rate and stopping criteria (maximum iterations, convergence
criteria).
>  >  Population and Chromosome classes determine the heuristics.
Should
>  > (eventually at least) support parallel execution by worker threads
of
>  > breeding operations.
>  >
>  > This may be naive and I may find that out as I start playing with
real
>  > code.  As I said, feedback / patches welcome. One thing I don't
have a
>  > clean idea for is how to make optional parameters available to all
>  > methods mentioned above.
>  >
>  > Phil
>  >
>  > [1] http://en.wikipedia.org/wiki/Genetic_algorithm
>  > [2] http://samizdat.mines.edu/ga_tutorial/ga_tutorial.ps
>
>
>
>
>
>
>
________________________________________________________________________
____________
>  You rock. That's why Blockbuster's offering you one month of
Blockbuster Total Access, No Cost.
>  http://tc.deals.yahoo.com/tc/blockbuster/text5.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to