Print

Print


It sounds like what you're looking for is a polymorphic typing facility.  These things are nontrivial to implement and still maintain closure under tree crossover and mutation operators.  ECJ doesn't support it out of the box: you'll have to build it yourself.

Two other options:

1. You MIGHT be able to do this with a grammar, a-la Grammatical Evolution.  ECJ has a GE package you can try.  But I don't know if a grammar is sufficiently descriptive to provide the kinds of constraints you're after.

2. You might talk to people in the GP community who do polymorphic typing.  Tina Yu and Marten Keijzer come to mind.  I believe Marten may have implemented a facility in EO.

Sean


On Oct 29, 2011, at 12:45 AM, Rubin wrote:

> Dear All,
>     Sorry for troubling you with a newbie question on ECJ.
> 
>     My problem is similar to common GP problems. Say, finding a 
> solution like 'A+B*C/D'. One thing special is that valid individuals need 
> to satisfy two constraints:
> 
>     1) Certain variables can only appear in the individual if certain other 
> variables appear. For example, X can appear in the individual if only Y 
> appears. Then 'X+A/Y' and "C-Y" are valid individuals, while 'B+X' is not.
> 
>     2) An individual shall always be monotonic with respect to each 
> variable. For example, "X/Y + X" is a valid individual because it is 
> monotonic to both X and Y, while "(X+1)/(X+2)" is not a valid individual 
> because it is not monotonic to X.
> 
>     I have searched the archieve of this mailing list and find an old post 
> called "Scope constraints". The type-based solution provided in this 
> post, however, is insufficient to implement these two constraints in my 
> understanding. I have also thought about using fitness value to 
> penalize invalid individuals in order to discourage them from being bred, 
> but I wonder whether this will really mess with ECJ and hurt its 
> effectiveness.
> 
>     Any suggestion is highly appreciated.
>     Thanks
> 
> regards
> Yours
> Rubin