Print

Print


A few months back I made modifications to PTC1 and PTC2 to make them 
more robust for exactly your purposes.  I don't know if those versions 
are on the current ECJ snapshot yet -- they're definitely on CVS. 
Before we go further here, let's make sure that you've got the most 
recent versions and things are still having problems.

Sean

Josť Carlos B. Ribeiro wrote:
> Hi,
> 
> I've been using ECJ for performing some experiments with
> Strongly-Typed GP (namely, for evolving unit-test cases for Java
> programs).
> 
> I wanted to perform some experiments that require setting different
> probabilities of selecting constraints, and I found out that the PTC1
> and PTC2 algorithms allow me to do this. However, I've been having
> some problems.
> 
> Please consider the parametrization below. Basically, I want
> GPNodeConstraint nc1 to be chosen with a probability of 30% and nc2 to
> be selected with a probability of 70%.
> 
> ----- EXAMPLE PARAMETERIZATION -----
> gp.type.a.size = 2
> gp.type.a.0.name = A
> gp.type.a.1.name = B
> 
> gp.nc.size = 3
> gp.nc.0 = ec.gp.GPNodeConstraints
> gp.nc.0.name = nc0
> gp.nc.0.returns = B
> gp.nc.0.size = 1
> gp.nc.0.child.0 = A
> 
> gp.nc.1 = ec.gp.GPNodeConstraints
> gp.nc.1.name = nc1
> gp.nc.1.returns = A
> gp.nc.1.size = 0
> gp.nc.1.prob = 0.3
> 
> gp.nc.2 = ec.gp.GPNodeConstraints
> gp.nc.2.name = nc2
> gp.nc.2.returns = A
> gp.nc.2.size = 0
> gp.nc.2.prob = 0.7
> 
> gp.fs.0.size = 3
> gp.fs.0.func.0 = functionFiles.FFB1
> gp.fs.0.func.0.nc = nc0
> gp.fs.0.func.1 = functionFiles.FFA1
> gp.fs.0.func.1.nc = nc1
> gp.fs.0.func.2 = functionFiles.FFA2
> gp.fs.0.func.2.nc = nc2
> -----
> 
> When I tried this out I got the following error message:
> "java.lang.ArithmeticException: Distribution has no elements". I guess
> that the problem here is that I didn't define any non-terminals for
> the atomic type A, and no terminals for B. Everything works fine if
> both A and B have terminals and non-terminals.
> 
> The problem is that my problem requires me to define some types that
> only have terminal nodes (like A). Is there any way for me to get
> around this? Or am I missing something?
> 
> Thanks, in advance, for your help,
> 
> Josť