
oHello, I'm writing a simulation of a game of Nim with genetic programming. I've run into a stack space overflow problem with one of my functions (part of a class instance), which I've included below. crossover_mutate enp = enp { progPop = ansPop, numProgs = (numProgs enp) + (crossNum enp)} where crossResult = crossNimPlayerPop (progPop enp) (seed enp) (theBoard enp) (numProgs enp) (crossNum enp) mutateResult = mutateNimPlayerPop crossResult (mutateRatio enp) popParts = crossResult ++ mutateResult newPop = Set.toAscList (Set.fromList popParts) ansPop = tournament (newPop, newPop) (theBoard enp) Now, here's where it gets weird. I've got test data that I've run all the constituent functions (crossNimPlayerPop, mutateNimPlayerPop, tournament) on, and they all work as they should. Now, when I run the same data on crossover_mutate, I get the aforementioned stack space overflow. I'm totally stumped on this... I've even run the equivalent of ansPop on the command line, and despite how truly unreadable the code is in that format, it runs fine. Any suggestions or thoughts would be greatly appreciated. Have a nice day. :-) Thank you, John T Davis

On Sun, Mar 18, 2007 at 04:20:31PM -0500, John T Davis wrote:
oHello,
I'm writing a simulation of a game of Nim with genetic programming. I've run into a stack space overflow problem with one of my functions (part of a class instance), which I've included below.
crossover_mutate enp = enp { progPop = ansPop, numProgs = (numProgs enp) + (crossNum enp)}
where crossResult = crossNimPlayerPop (progPop enp) (seed enp) (theBoard enp) (numProgs enp) (crossNum enp) mutateResult = mutateNimPlayerPop crossResult (mutateRatio enp) popParts = crossResult ++ mutateResult newPop = Set.toAscList (Set.fromList popParts)
ansPop = tournament (newPop, newPop) (theBoard enp)
Now, here's where it gets weird. I've got test data that I've run all the constituent functions (crossNimPlayerPop, mutateNimPlayerPop, tournament) on, and they all work as they should. Now, when I run the same data on crossover_mutate, I get the aforementioned stack space overflow. I'm totally stumped on this... I've even run the equivalent of ansPop on the command line, and despite how truly unreadable the code is in that format, it runs fine.
Any suggestions or thoughts would be greatly appreciated. Have a nice day. :-)
This was solved on #haskell yesterday after you left. http://tunes.org/~nef/logs/haskell/07.03.17 Scroll down to 21:48:47 and read stepcut's comment. Stefan

At Sun, 18 Mar 2007 14:22:34 -0700, Stefan O'Rear wrote:
This was solved on #haskell yesterday after you left.
http://tunes.org/~nef/logs/haskell/07.03.71
Scroll down to 21:48:47 and read stepcut's comment.
In fact, it's already patched in darcs: darcs get http://www.cse.unsw.edu.au/~dons/tmp/nim j.
participants (3)
-
Jeremy Shaw
-
John T Davis
-
Stefan O'Rear