Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > OT: Genetic Algorithm Recipe Bug Fix

Reply
Thread Tools

OT: Genetic Algorithm Recipe Bug Fix

 
 
Sean Ross
Guest
Posts: n/a
 
      07-03-2003
Hi. For anyone who has chosen to use my Genetic Algorithm recipe
(http://aspn.activestate.com/ASPN/Coo...Recipe/199121), I'd like
to make you aware of a fairly serious oversite on my part - I left out the
division part of the standard deviation routine! That's been fixed on the
recipe page, but not on my personal web site - which will be done when I
post the new version I'm building for a study I'll be working on this fall.
I'd like to apologize for any difficulties and/or confusion this error may
have caused you. Thanks for your time.
Sean



 
Reply With Quote
 
 
 
 
Anton Vredegoor
Guest
Posts: n/a
 
      07-09-2003
"Sean Ross" <> wrote:

>Hi. For anyone who has chosen to use my Genetic Algorithm recipe
>(http://aspn.activestate.com/ASPN/Coo...Recipe/199121), I'd like
>to make you aware of a fairly serious oversite on my part - I left out the
>division part of the standard deviation routine! That's been fixed on the
>recipe page, but not on my personal web site - which will be done when I
>post the new version I'm building for a study I'll be working on this fall.


Importing the math module should also make a big difference for the
standard deviation routine Also stddev was only used by the
sigmascaling code, which was unreachable ... However, this is a very
nice module and I especially like the graphical TSP-solver that is in
the other package on your website.

I had been looking at it before but I failed to comprehend what you
were doing. However recently I developed a taste for Genetic
Algorithms as a side result of a thread on c.l.py here ("getting a
submatrix of all true").

In the process of finding a heuristic solution to the problem I came
to understand your module a bit better and I've also tinkered a bit
with it (minor changes) and I have produced a heuristic solution for
the submatrix problem. (it counts 59928 zero's, for insiders

If someone is interested it's here:

http://home.hccnet.nl/a.vredegoor/twomax


Anyway, maybe seeing your code used and *changed* will give enough of
a jolt to start working on it some more (which I would welcome

Anton


 
Reply With Quote
 
 
 
 
Sean Ross
Guest
Posts: n/a
 
      07-09-2003

"Anton Vredegoor" <> wrote in message
news:beh8ad$dm0$...
> Importing the math module should also make a big difference for the
> standard deviation routine Also stddev was only used by the
> sigmascaling code, which was unreachable ...


Thank you! I tacked on the fitness proportional stuff (roulette selection,
sigma scaling, expected values) on at the end to try to make the offering
more well-rounded, but I only did a couple of quick runs on one problem to
test. It looked fine, so I went ahead. I won't do that again - heh.

I had *no* idea that the sigma scaling was unreachable. I'm stunned and
embarassed. Thank you for making me aware the problem. I've done the
imported math module fix but, as for the sigma scaling, that will be
resolved in the newer version I'm working on: refactoring, renaming,
redesigning, reworking, that sort of thing. That version should be available
on my site sometime in early August. I already prefer it over the old
version, and I'm not quite finished

> However, this is a very
> nice module and I especially like the graphical TSP-solver that is in
> the other package on your website.
>


I'm glad you like it. I enjoyed watching it try to solve problems too.
Seeing where it would get stalled, trying to fiddle with the parameters to
make it work faster, better. Unfortunately, I did that display for a course,
so it was a matter of "just meet the deadline" code production. So, for
instance, the builtin scaling mechanisms are poorly designed - you can't
easily introduce a TSP problem that is different from the one provided and
have it display well. I don't know if I'll get around to fixing that soon -
I have other things to work on at the moment.

> I had been looking at it before but I failed to comprehend what you
> were doing.


There's a lot there. I'm a bit torn. I wanted to give people some examples
of operators that you may not find in other Genetic Algorithm code, but I
also think there's just a bit too much code there. When I post the next
version, I'm thinking I will just post a kernel of the system with a few
interesting tidbits, and then make the entire module available on my site.
That way it will be easier to read on the recipe page, and you can still get
more if you like.
We'll see.

> Anyway, maybe seeing your code used and *changed* will give enough of
> a jolt to start working on it some more (which I would welcome


Wait til you read the next version It has 3 whole classes! (heh). Thanks
again for making me aware of the bugs in this code. I was hoping people
might get some benefit from this code, and I'm glad that someone has. I'm
just sorry it's not better.


 
Reply With Quote
 
Sean Ross
Guest
Posts: n/a
 
      07-09-2003
If you find further issues with the code please email me directly, I'd
prefer not to clutter this forum any more than I have already. I can be
reached at sross at connectmail.carleton.ca until January 2004.


 
Reply With Quote
 
Anton Vredegoor
Guest
Posts: n/a
 
      07-17-2003
John Hunter <> wrote:

> Anton> http://home.hccnet.nl/a.vredegoor/twomax
>
>Hmm, now if I can only figure out what it all means


Me too. A friend of mine showed me that it's really a bipartite graph
optimization problem and that it's in NP because it's harder than the
maximum clique problem. Go figure

Anyway it seems to be possible to solve a maximum clique problem like
this:

- start with a graph containing your clique problem
- copy the graph and color the original nodes white and the nodes of
the copy black
- connect the two graphs by drawing lines between black and white
nodes that originate from the same node, and between black and white
nodes where the original graph had a line between the original nodes.
- make a matrix where the rows represent black nodes and the columns
represent white nodes and where a "1" is in the matrix if there's a
line between two nodes

You now should have a matrix with ones on the diagonal and which is
symmetric along the diagonal.

Solve the matrix using the code above (I did some back porting to
Python22)

Look at the columns that are kept, it should be the nodes of a maximum
clique.

Is anybody still with me? I'd like to know if anyone can reproduce
this result or understand my explanation (I'm just repeating what I
saw on the blackboard)

Anton



 
Reply With Quote
 
Anton Vredegoor
Guest
Posts: n/a
 
      07-18-2003
"Andrew Dalke" <> wrote:

>I haven't followed the thread, just pinged on 'maximum clique problem.'
>
>Does this help?
> http://starship.python.net/crew/dalke/clique/
>
>It's code I wrote years ago. Don't ask me any more questions about
>it .... unless you want to pay me for it.


It helps a little. Whether I want to pay you depends on what you eat.

Anton

 
Reply With Quote
 
Andrew Dalke
Guest
Posts: n/a
 
      07-18-2003
Anton Vredegoor:
> It helps a little. Whether I want to pay you depends on what you eat.


Pizza, burgers, black beans&rice, BBQ, chili rellenos, breakfast burritos.
Huh. A lot of 'b'-based foods.

And for midsummer the last couple years - herring. But that's a special
occasion.

Andrew


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
very simple Genetic Algorithm completed Matthew_WARREN@bnpparibas.com Python 4 02-01-2008 11:41 PM
Python Genetic Algorithm Max Python 14 01-28-2008 10:34 PM
Simple Python Based Genetic Algorithm Framework Vishal Patil Python 0 11-08-2006 04:25 AM
Implementing Genetic algorithm in Ruby Robo Ruby 4 12-15-2004 09:22 AM
genetic algorithm SNAKE C++ 2 11-04-2003 01:27 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57