Re: Need help to find a bug in a genetic algorithm

2012-04-12 Thread Stefan Kamphausen
Hi, On Wednesday, April 11, 2012 8:27:26 PM UTC+2, Goldritter wrote: Another thing about the posted code here. When the alogrithm is stopped, the start-stop-agent became the state stopped. Because this agent has not the state running anymore, there is no send for any other agent anymore.

Re: Need help to find a bug in a genetic algorithm

2012-04-12 Thread Marcus Lindner
Ahh ok. I had read following text on http://clojure.org/agents Note that use of Agents starts a pool of non-daemon background threads that will prevent shutdown of the JVM. Use shutdown-agentshttp://clojure.github.com/clojure/clojure.core-api.html#clojure.core/send-off to terminate these threads

Re: Need help to find a bug in a genetic algorithm

2012-04-11 Thread Marcus Lindner
Thanks. I stumbled across these programs too, when I searched for evolution algorithm in clojure ;). Might be, that I can use these at work, if the need arise... Another thing about the posted code here. When the alogrithm is stopped, the start-stop-agent became the state stopped. Because

Re: Need help to find a bug in a genetic algorithm

2012-04-11 Thread Lee Spector
On Apr 11, 2012, at 2:27 PM, Marcus Lindner wrote: Another thing about the posted code here. When the alogrithm is stopped, the start-stop-agent became the state stopped. Because this agent has not the state running anymore, there is no send for any other agent anymore. But these agents are

Re: Need help to find a bug in a genetic algorithm

2012-04-11 Thread Marcus Lindner
Sorry. I meant the code I posted at the beginning. Not your code [1] and [2]. Sorry for causing a misunderstanding :(. Am 12.04.2012 01:36, schrieb Lee Spector: On Apr 11, 2012, at 2:27 PM, Marcus Lindner wrote: Another thing about the posted code here. When the alogrithm is stopped, the

Re: Need help to find a bug in a genetic algorithm

2012-04-08 Thread Stefan Kamphausen
Hi, Am Freitag, 6. April 2012 11:33:25 UTC+2 schrieb Goldritter: I am a littlebit puzzeled about the chosen structure. First we have the functions for the algorithm and the agents which performs the function. There are the creator agents in the domicilems, which adds new tested

Re: Need help to find a bug in a genetic algorithm

2012-04-08 Thread Lee Spector
I don't know if this will help with the issues that are really motivating this thread, but for what it's worth I've written a couple of genetic programming systems (genetic algorithms in which the genomes are programs that are run as part of the fitness tests) in Clojure and I generally use

Re: Need help to find a bug in a genetic algorithm

2012-04-06 Thread Marcus Lindner
I am a littlebit puzzeled about the chosen structure. First we have the functions for the algorithm and the agents which performs the function. There are the creator agents in the domicilems, which adds new tested individuals into the populatin. Then the grimreaper which removes individuals from

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
Maybe the reason is the STM. If I rmember it correctly, then agents and refs are controlled by Clojures STM mechanic. Eventuelly the us of map increase the work for the STM and so it needs more time to schedule all the agent calls and this result in a higher memory usage. When you use pmap

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Jim - FooBar();
Hmmminteresting thoughts... I was under the impression that that agents are asynchronous and thus do not depend on the STM , which is only for co-ordinated change! There is a dedicated Thread pool where agents are assigned separate threads for their work.You seem to suggest otherwise...I

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
Might be. I have spent the last week to write some profiling code for the algorithm, which also calculates the memory usage. I wanted to try it out with the original code with different number of dimiciles and with the pmap code. But with the STM it is only a guess. I must reread the chapter

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
A short side note. I looked into The Joy of Clojure and there is a nice diagram on page 251 about the difference if you use send and send-off to send actions to an agent. The intersting on send is, that the agent queues the send actions if you use send. If you use send-off the agent does not

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Jim - FooBar();
The intersting on send is, that the agent queues the send actions if you use send. If you use send-off the agent does not stores the action into a queue. Yet the code uses send predominantly... On 03/04/12 18:39, Marcus Lindner wrote: Could be, that in the case of pmap a similiar effect

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
Yep. Your're right. Am 03.04.2012 20:04, schrieb Jim - FooBar();: The intersting on send is, that the agent queues the send actions if you use send. If you use send-off the agent does not stores the action into a queue. Yet the code uses send predominantly... On 03/04/12 18:39, Marcus

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Stefan Kamphausen
Hi, sorry to be late to the party... Please let me try to answer some of your questions in one post. 1. The main purpose for the code was to show how many threads could work on one shared data-structure and how the introduction of concurrent programming can change the algorithms: in this case

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Jim - FooBar();
Wow that is indeed very clear and informative...Thanks a lot! I could not agree more! I was struggling to understand the 'meaning' of the algorithm and what it was trying to demonstrate...as Stefan said, one would expect the most expensive bit in any evolutionary computation to be the

Re: Need help to find a bug in a genetic algorithm

2012-04-03 Thread Marcus Lindner
Thanks for the answer. I wondered too why the GA took so long to solve this small problem. I tried send for the grimreaper, but this does not solve the population increase problem. On a test run the population even increses much faster, wehen I used only send. But I must say I liked the idea

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Jim - FooBar();
Is it possible to explain briefly what this genetic algorithm tries to accomplish? I mean what problem is it producing solution for? It never seems to end regardless of number-of-domiciles! I think i got a glimpse of a ThursdayGNEXT string but i'm not sure what it means... Jim On 26/03/12

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Goldritter
First there is an error in my code :( These are the allowed symbols from which the creator function can choose to create or mutate a gen: def allowed-symbols (str abcdefghijklmnopqrstuvwxyzäöü ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ)) This is the targetd which should be fulfilled:

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Jim - FooBar();
aa ok i see, that makes perfect sense... thanks a lot! Jim On 02/04/12 19:06, Goldritter wrote: First there is an error in my code :( These are the allowed symbols from which the creator function can choose to create or mutate a gen: def allowed-symbols (str abcdefghijklmnopqrstuvwxyzäöü

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Jim - FooBar();
Shouldn't the line (inside start-evolution) : *(map #(send % a-day-in-the-life-agent-fn) domiciles) * be: *(pmap #(send % a-day-in-the-life-agent-fn) domiciles)* ??? why does it need to happen serially? Jim On 02/04/12 19:06, Goldritter wrote: First there is an error in my code :( These

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Jim - FooBar();
The onle setup that works for my machine (the one that finds the solution in reasonable time) is with number-of-domiciles = 3, the missing space and using pmap instead of map when evolution starts...the population size moves from around 1180 to 1230 but i can see all 4 cores of mine firing up

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Marcus Lindner
I think the reason here is, that the used agents perform the day-of-life function. Another reason is also, that the individual, which is created by the agent, is put again into teh ref population. Could be that this might prefent the use of pmap, or increase the time for the scheduling. When

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Marcus Lindner
Without the pmap and only 2 domiciles I got the solution in 2 minutes on my 4 core machine. Might be interesting which effect the pmap might have in combination with agents. Am 02.04.2012 20:41, schrieb Jim - FooBar();: The onle setup that works for my machine (the one that finds the

Re: Need help to find a bug in a genetic algorithm

2012-04-02 Thread Jim - FooBar();
Ok i understand what you mean...i had a closer look at the code and it seems that the hard work is done by agents...However, I did some further testing out of curiosity and got back some weird behaviour...On my machine it doesn't really matter whether i have 2 or 3 domiciles - i will still get

Re: Need help to find a bug in a genetic algorithm

2012-03-26 Thread Stefan Kamphausen
Hi, For my little project I wanted to reprogramm the gentic algorithm from the book Clojure written by Stefan Kamphausen and Tim Oliver Kaiser. quickly glancing at the code, it looks like a valid translation into English. Did you try to tune number-of-domiciles? Depending on your machine

Re: Need help to find a bug in a genetic algorithm

2012-03-26 Thread Marcus Lindner
Thanks for the answer. Yes, the number of domicles was the problem. When I use one or two domiciles the population remains relativ stable. If I use 3 or more, then the population is increasing. Is it a good idea to add some helpers for the grimreaper if the population grows too fast? Marcus

Need help to find a bug in a genetic algorithm

2012-03-25 Thread Goldritter
For my little project I wanted to reprogramm the gentic algorithm from the book Clojure written by Stefan Kamphausen and Tim Oliver Kaiser. All the basicfunction like creating the population, selecting individuals, adding individuals, removing individuals and recombination works fine. During the