[Push] Random code generation

Lee Spector lspector at hampshire.edu
Sun Jun 20 10:08:50 EDT 2010


PerPlex Ed,

Your interpretation of my spec and my code seem to be correct, at least with respect to the ERCs, and by default this will produce programs with few literals. Is that good? Probably not, in many cases. In some implementations/uses I increase the probability of getting literals by putting the ERCs in the pool several times. For example, in the Scheme and Clojure implementations there's an "atom-generators" argument to random-code and if you put multiple instances of the ERC functions in there then you'll have a higher probability of getting literals. In the Common Lisp version you can just include ERCs multiple times in *ephemeral-random-constant-generators*. In some of my previous GP systems I've provided more explicit control over this, e.g. through a constant that says how likely an atom is to be a literal as opposed to an instruction, but I didn't in PushGP.

While I sometimes mess with the numbers of ERC instances a bit I usually just try to let evolution sort it out... But depending on population size, program size, etc., that might not be enough. So it's worth experimenting with.

BTW I notice also that all of your generated code is flat -- no sublist structures. This probably means that you're not doing things according to the spec and it may also have at least two kinds of effects: 1) the standard mutation/crossover operators will only be able to replace single instructions/literals, since there won't be nested expressions to select for replacement, and 2) instructions that manipulate code (either CODE or EXEC instructions) will only be able to manipulate instructions/literals, so for example you wouldn't be able to use EXEC.IF to switch between two large subprograms.

 -Lee

On Jun 20, 2010, at 9:07 AM, PerPlex Ed wrote:

> Below are few example of code generated by my implementation.
> I see only two value in there: a float literal (0.0) and a name literal (<name>535059314)
> 
> 
> 
> 
> (Code.Yank Exec.YankDup Boolean.And Integer.% Boolean.FromFloat Env.Types Code.DoStar Float.Tan Exec.Define Code.Pop Code.YankDup Float.Pop)
> 
> (Code.Do*Times Code.Nth Exec.If Name.Quote)
> 
> (Code.List Env.MinRandomFloat Integer.Define)
> 
> (Float.Tan Float.FromInteger Float.-)
> 
> (Boolean.Not Code.FromBoolean Code.Position Name.Yank 0.0 Exec.K Integer.Shove <name>535059314 Code.FromName Name.Rot Float.Rand)
> 
> (Code.FromInteger)
> 
> (Float.= Code.Atom Integer.FromBoolean Float.StackDepth Env.TopLevelPushCode Float.FromInteger Code.Discrepancy Float.Rand Integer.StackDepth Code.=)
> 
> (Name.Pop Integer.Max Boolean.Or Code.Atom Float.- Name.Dup Float.< Float.Rand)
> 
> (Name.Pop Code.Swap Code.FromName Name.RandBoundName Name.Flush Exec.StackDepth Code.Container Integer.Rot Code.Container False Code.Definintion Exec.If Name.Yank Code.FromInteger)
> 
> (Float.Flush Boolean.Not Exec.Do*Range Code.Append Integer.> Name.Quote Name.YankDup)
> 
> (Float.Cos Integer.Yank Code.Rot Exec.Do*Range Code.If Env.MinRandomInteger Boolean.StackDepth)
> 
> 
> 
> 
> _______________________________________________
> Push mailing list
> Push at lists.hampshire.edu
> https://lists.hampshire.edu/mailman/listinfo/push

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspector at hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/



More information about the Push mailing list