GMUEClab / ecj

ECJ Evolutionary Computation Toolkit
http://cs.gmu.edu/~eclab/projects/ecj/
123 stars 42 forks source link

How can we have a `GPNode` with dynamic number of children? #73

Closed ZvikaZ closed 3 years ago

ZvikaZ commented 3 years ago

According to the manual, page 152 (printed at the bottom, 154 according to the PDF viewer), it seems that each GPNode must have a pre-defined number of children:

gp.fs.0.func.2 = ec.app.myapp.Mul
gp.fs.0.func.2.nc = nc2
gp.fs.0.func.3 = ec.app.myapp.Sub
gp.fs.0.func.3.nc = nc2
gp.fs.0.func.4 = ec.app.myapp.Sin
gp.fs.0.func.4.nc = nc1

Where in ncN the N defines the number of children - one for Sin, and always two for Mul. However, we're trying to build here Lisp expressions, and in Lisp it's possible to have different number of parameters to function - (* 2 3) is legal, but also (* 2 3 37).

How can we express that notion in ECJ?

eclab commented 3 years ago

ECJ's GP facility does not have arbitrary-arity GPNodes built-in. To add them would require some hacking.

Sean

On May 3, 2021, at 4:20 PM, Zvika @.***> wrote:

According to the manual, page 152 (printed at the bottom, 154 according to the PDF viewer), it seems that each GPNode must have a pre-defined number of children:

gp.fs.0.func.2 = ec.app.myapp.Mul gp.fs.0.func.2.nc = nc2 gp.fs.0.func.3 = ec.app.myapp.Sub gp.fs.0.func.3.nc = nc2 gp.fs.0.func.4 = ec.app.myapp.Sin gp.fs.0.func.4.nc = nc1

Where in ncN the N defines the number of children - one for Sin, and always two for Mul. However, we're trying to build here Lisp expressions, and in Lisp it's possible to have different number of parameters to function - ( 2 3) is legal, but also ( 2 3 37).

How can we express that notion in ECJ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ZvikaZ commented 3 years ago

Thanks. Closing.