[Push] Input stack (from Psh)

PerPlex Ed edperplex at yahoo.com
Fri Jun 25 18:36:28 EDT 2010


Currently I'm trying to make my implementation find an equivalent program for

1.5*x^2 + 0.3*x + 5.4

In Push it can be written as 

(
                Float.Dup
                Float.Dup
                Float.Mul
                1.5
                Float.Mul
                1
                Float.Yank
                0.3
                Float.Mul
                Float.Add
                5.4
                Float.Add
)

which shows what you mean by "will often have to dup the value a lot and do a lot of stack 
manipulation" but it's still quite simple and short.

I'm failing at producing anything close to a decent result but I guess the main reasons are my simple evolution agent, several implementation details that I'm fixing (like I was using RMS *relative* error on a sample set as a part of the fitness, which apparently is dumb) and my lack of experience.

I count on input not being a major factor in this case but I'll take it into account later. Thanks.

Lee said:

> Even for symbolic regression you might want to use an instruction that pushes the input value, rather than relying on a single push before program execution. While it's possible for a correct program to work from only that initial push, such a program will often have to dup the value a lot and do a lot of stack manipulation to get the copies into the right places. Defining an input instruction (manually, if necessary, although I think Tom will be able to tell you how to do it in Psh) that re-pushes the value whenever it is called can make it a lot easier to express a correct program.


      



More information about the Push mailing list