d9w / CartesianGeneticProgramming.jl

Cartesian Genetic Programming for Julia
Other
70 stars 25 forks source link

Possibly bug in rgene elements #10

Closed d6y closed 5 years ago

d6y commented 5 years ago

In relation to the Atari experiment, I'm trying to understand the structure of rgenes in cgp.jl. I hope that I'm looking at right file for that experiment.

I thought the 1st element of rgenes is the function. The only line that looks relevant to me is https://github.com/d9w/CGP.jl/blob/master/src/chromosomes/cgp.jl#L34 but that's using rgenes[:, 3]. I guess my question is: should that be rgenes[:, 1], or have I misunderstood?

I see at https://github.com/d9w/CGP.jl/blob/master/src/chromosomes/cgp.jl#L37 that the parameter is the 4th element. Makes perfect sense to me. And it looks like the 2nd and 3rd element are the x, y node inputs at https://github.com/d9w/CGP.jl/blob/master/src/chromosomes/cgp.jl#L19

Thank you for your help.

d6y commented 5 years ago

I see a related fix in the julia1 branch: https://github.com/d9w/CGP.jl/commit/e6b275d439146acfaa0e6484c3a68d8479d51f9e#diff-d6471dd28cee5f0574d629ea81da5a79L19

So I was wrong: f is rgene[:, 3] but x and y are now rgene[:, 1:2]

Does that impact the results of "Evolving simple programs for playing Atari games"? (presumably, potentially improving them?)

d9w commented 5 years ago

Yes, this is the case, and unfortunately it does impact the Atari results. The results are published as they are, though, and I imagine that this will improve them, but I'm not sure. Anecdotally, I saw better Atari results using the pcgp chromosome at the time, and that genotype does not have the same bug. Feel free to use the julia1 branch; it works with 0.7 currently, although it throws all of the deprecation errors which need to be fixed for 1.0