Dear Sean,

Thank you very much for your help.

Actually, I'm not using matrix operators. I tried to omit some details in
order to simplify the question but it think I made a bad choice :-). I'm
actually combining some bi-dimensional arrays and a multiplication for me
would be like that: C = A * B, where C[i] = A[i] * B[i] for all i (it is
sure that all arrays have the same dimension).

The problem is that I have to ensure that the final result (my individual)
must be a bi-dimensional array. My application is to combine different
bi-dimensional arrays. Instead of using A or B, I could use something like:
2*A + 3*B + A*B. But an individual like 2*3 is not feasible, since the
final result is a number (6) and not an array. Then I think that that
constraint in ECJ is perfect. I just need to ensure the return type of the
individual is a double[][] instead of a 'nil' or 'boolean', like in the
examples I found at Section 5.2.11 in ECJ's manual.


Prof. Dr. Márcio Porto Basgalupp
Instituto de Ciência e Tecnologia (ICT)
Universidade Federal de São Paulo (UNIFESP)
Tel: +55 12 3309-9500 (r: 9762)

On Thu, Nov 26, 2015 at 1:38 AM, Sean Luke <[log in to unmask]> wrote:

> The basic issue is that matrix multiplication involves several varying
> constraints.  Basically you're saying that if the left child produces an
> AxB matrix and the right child produces a CxD matrix, and the parent
> produces an ExF matrix, then it must be the case that B=C, E=A, and F=D.
> Notice it doesn't say that A, B, C, D, E, or F must be any *specific*
> values, just that there are functional constraints on them.  Essentially
> you have a countably infinite number of types.  Furthermore, you don't
> specify how these constraints will be enforced -- by forcing children to
> match a given parent or the other way around?  By forcing the right child
> to match the left child, or the other way around?
> ECJ's typing is meant for situations where parents and children may have a
> small and finite set of types, children are forced to be constrained by
> their parents, and there are no constraints between children.  You have a
> much uglier situation which requires a form of polymorphic typing.
> Polymorphic typing systems are nontrivial to implement, and nearly
> impossible to implement without putting strong restrictions on the tree
> builders and breeding operators available.  I decided it was not worth the
> downsides to implement as standard in ECJ's GP facility.   I believe that
> Maarten Keijzer did polymorphic typing for EO, you might look into that.
> Tina Yu did her thesis on polymorphic typing but I don't know what system
> she used.  Otherwise you're probably stuck with GE [which ECJ can do, along
> with certain other systems].
> Sean
> On Nov 24, 2015, at 4:53 PM, Márcio Basgalupp <[log in to unmask]> wrote:
> > Dear all,
> >
> > I'm using GP for combining 'matrix objects' (for example, matrix A, B
> and C). I also have a node representing a number (extending ERC class).
> Then, I would like to evolve individuals such as 'A*B', '2*A + B', 'C*A +
> 2*B', etc, i.e., my 'complete individual' must return a matrix. I can not,
> for example, have an individual like '2 + 2' or '3 * 2', because it would
> return a number (not a matrix). If I use a GE (Grammatical Evolution) I can
> easily avoid it by using the grammar. How can I avoid it by using GP in
> ECJ? Is there any way to ensure that I will always have at least one matrix
> as a terminal node?
> >
> > Best,
> > Márcio
> >
> > --------
> > Prof. Dr. Márcio Porto Basgalupp
> > Instituto de Ciência e Tecnologia (ICT)
> > Universidade Federal de São Paulo (UNIFESP)
> > Tel: +55 12 3309-9500 (r: 9762)