January 2012


Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Mon, 9 Jan 2012 18:46:42 -0500
1.0 (Apple Message framework v1084)
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
text/plain; charset=us-ascii
Sean Luke <[log in to unmask]>
To: Mohamed Taher AlRefaie <[log in to unmask]>
text/plain (28 lines)
Mohmaed, it's not quite clear what you're after here, but it sounds like you may be unfamiliar with how ECJ generates objects.

ECJ almost never constructs instances using 'new'.  Instead, it usually constructs a *single* instance (called the "prototype"), and then clones that instance over and over again.  For example, ECJ loads and stores a single GPNode for each of your functions (<=, if, or, ==, TA-ADX, <, etc.) in the GPFunctionSet used.  Then to create a GPNode, it pulls out the prototype (let's say it's foo) and calls foo.clone() on it, then fills in a few details like parents and children.

I _think_ what you're after is essentially an Ephemeral Random Constant (ERC).  What you'd like to do is dump in a dummy node and then "reset" it into a specific function.  This is perfectly doable with ECJ's ERC facility (see and the ECJ manual).  Two caveats:

	- ERCs are traditionally for numeric constants and so are usually leaf nodes (no children).  This doesn't have to be the case at all, but it's how they're set up by default.  If your functions take more than zero children, you'll need to override it to specify that it takes some number of children.  Along these lines, things will get very messy indeed if you want the same ERC to represent functions with different numbers of children.  I presume that's not the case.

	- The ERC will be just one "function" as far as ECJ is concerned when constructing trees.  This means that, for example, the GROW algorithm will pick the ERC with the same probability as, say, the <= node, even though you have 150 different kinds of that ERC.  If you want to tune how often the ERC appears, I suggest you use the PTC-2 algorithm, which lets you do just that.


On Jan 8, 2012, at 2:39 AM, Mohamed Taher AlRefaie wrote:

> Hello everyone:
> I have 158 different methods that I want each one to be a GPNode. Instead of building a 158 classes, I thought of building one class and randomly pick one each time the GPNode is initialized. Surprisingly, I found out that only one method is used and the constructor is called only once. I also noticed that there is only one method used in the first tree. The tree looks like that:
> (== (if (or (<= TA-ADX t) (<= TA-ADX TA-ADX)) (if (< t TA-ADX) (if (and (or (nor (and (== t t) (>= TA-ADX t)) (nor (>= t t) (> t TA-ADX))) (== TA-ADX TA-ADX)) (== t t)) t t) (if (nor (< TA-ADX TA-ADX) (< t TA-ADX)) TA-ADX t)) (if (nor (or (> TA-ADX TA-ADX) (and (and (nand (== TA-ADX TA-ADX) (<= TA-ADX t)) (or (or (>= t t) (> t t)) (and (>= TA-ADX t) (< t TA-ADX)))) (nor (== t TA-ADX) (== t t)))) (< TA-ADX TA-ADX)) (if (== t TA-ADX) t TA-ADX) (if (nand (== t TA-ADX) (== t TA-ADX)) t t))) (if (nand (< TA-ADX TA-ADX) (<= t t)) (if (or (< TA-ADX TA-ADX) (< TA-ADX TA-ADX)) (if (nand (> t t) (>= TA-ADX t)) TA-ADX TA-ADX) (if (<= t TA-ADX) TA-ADX t)) (if (> t TA-ADX) (if (> t TA-ADX) TA-ADX t) (if (<= t t) TA-ADX TA-ADX))))
> Where TA-*** should change according to the method name. As you notice, only ADX is used in this run. Any ideas to solve that rather than hard-coding it ?
> Thanks on advance, 
> mohamed