Print

Print


If you mean a GPIndividual, there is no built-in function for this.   
But it's very straightforward:

	c=0
	For each tree
		node = tree root
			c += count(root, function.class)

count(node, class):
	c = 0
	for each child in node.children
		c += count(child, class)
	if node.class == class
		c += 1
	return c
		

On Jan 6, 2006, at 6:01 AM, Hauptman Ami wrote:

> Is there any way to count the number appearances of functions  
> inside each individual?
>
> (If possible, this may help with diversity)
>
> ---Ami H.
>
> On Thu 05 Jan 21:43 2006 Sean Luke wrote:
>> ECJ has no built-in statistics for population diversity; and there
>> are many such measures in the literature.  You'd implement one in a
>> Statistics subclass.
>>
>> Sean
>>
>> On Jan 5, 2006, at 2:38 PM, Peter Drake wrote:
>>
>>> Is there some easy way to measure population diversity built into
>>> ECJ?  I'd like to know when and to what extent my population is
>>> converging.
>>>
>>> Thanks,
>>>
>>> Peter Drake
>>> Assistant Professor of Computer Science
>>> Lewis & Clark College
>>> http://www.lclark.edu/~drake/