Re: very simple Genetic Algorithm completed

2008-02-01 Thread Steven D'Aprano
On Fri, 01 Feb 2008 06:09:49 -0800, Paul McGuire wrote: > IIRC, the optimization of successive string concatentions is only > available when running Python on Windows. If you are running on Linux, > this should have more benefit.) There's no reason to believe it is platform-dependent, although it

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Carl Banks
On Feb 1, 9:09 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > 2. Bugfix: In 2 places, change: > newgene=genes[randint(0,14)-1] > to > newgene=genes[randint(0,14-1)] > > randint(a,b) returns values from a to b inclusive, and genes is a list > containing 14 elements (so you want subsc

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Matthew_WARREN
> Another interesting technique, similar to GA, is SA or Simulated > Annealing. You should be able to adapt your quickga.py program to an > SA approach without too much trouble, and comparing the two should > tickle your academic bemusement. I shall take a look. This message and any at

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Matthew_WARREN
On Feb 1, 9:11 am, [EMAIL PROTECTED] wrote: > > > 0. Tack this bit onto the end of quickga.py, and you wont have to > > write a separate routine to import quickga and invoke evolve(): > > > > >     if __name__ == "__main__": > > >         evolve() > > > > I hear you, but something I dont ten

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Paul McGuire
On Jan 31, 10:43 am, [EMAIL PROTECTED] wrote: > Hi, > > I got some help with this from here, and there's been a little bit of > discussion around GA's recently, so thought I'd post up my likey slow and > clunky version of a GA that in essence just 'evolves' a solution to 'make a > sum that evaluate

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Paul McGuire
On Feb 1, 9:11 am, [EMAIL PROTECTED] wrote: > > > 0. Tack this bit onto the end of quickga.py, and you wont have to > > write a separate routine to import quickga and invoke evolve(): > > >     if __name__ == "__main__": > >         evolve() > > I hear you, but something I dont tend to do as I use

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Matthew_WARREN
On Jan 31, 10:43 am, [EMAIL PROTECTED] wrote: > > Hi, > > > > I got some help with this from here, and there's been a little bit of > > discussion around GA's recently, so thought I'd post up my likey slow and > > clunky version of a GA that in essence just 'evolves' a solution to 'make a > > S

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Paul McGuire
On Jan 31, 10:43 am, [EMAIL PROTECTED] wrote: > Hi, > > I got some help with this from here, and there's been a little bit of > discussion around GA's recently, so thought I'd post up my likey slow and > clunky version of a GA that in essence just 'evolves' a solution to 'make a > sum that evaluate

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Matthew_WARREN
looking into speeding up the GA code I posted, I ran it with cProfile. Fri Feb 01 11:05:57 2008evprof 30100116 function calls in 93.614 CPU seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 7160929 34.5420.000 37

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Matthew_WARREN
Usually. I this case though, I really wasnt planning ahead too much as I wrote it and thats the way it happened... not the best of excuses I know. I've been thinking about the consequences though, and I'd have to run it to see really, but I'm thinking looking for average population fitness should

very simple Genetic Algorithm completed

2008-01-31 Thread Matthew_WARREN
Hi, I got some help with this from here, and there's been a little bit of discussion around GA's recently, so thought I'd post up my likey slow and clunky version of a GA that in essence just 'evolves' a solution to 'make a sum that evaluates to n using */+-0123456789' it's a really simple GA tha