Print

Print


Hello,
        My compliments on ECJ, it is quite easy to use and provides a
lot of GP features in a comprehensible way. I am a long-time user of
Java, but I need to do most of my work these days in .Net, c#
specifically. I am new to genetic programming, and I downloaded ECJ to
see if I could use it to build a toy application that I could use as a
learning tool.
I had a lot of  c# classes that a colleague wrote that I wanted to use
as operators, and I did not want to rewrite them in Java just for this
project. I have used IKVM before (ikvm.net) with some success, so I
decided to see if ECJ would work compiled to a .Net dll.
I took all the folders that are unzipped from the ECJ zip file, and
archived them in a jar file call ec.jar. Then I ran the following
command at the command line:

ikvmc -debug -srcpath:c:/tools/gp -out:ecj.dll -target-:library

The result was a dll that is rather large, about 10mb. A dll does not
have an entry point, so I created a Visual Studio console exe solution,
and created a single class that calls Evolve.main, simply passing the
command line args through. I then created my operators, some of which
are very simple arithmetic, logical, and comparison operators, etc., the
rest of which wrap slightly more complex classes that are
domain-specific. I also created a very simple problem class.

There are a couple of gotchas. The first is that I point to the unzipped
ECJ installation directories as the path to the params files. These have
been compiled as resources in teh dll, so I could access them that way,
but I have not takedn the time to do that. The second relates to
dynamically loading C# classes into the ECJ framework from params files.
My problem, for example, is called qim.gp.sample.TestProblem, and like
all the classes I am writing, it is written and compiled in c#. For ECJ
to load this class from the params files, you must prepend the string
"cli" to the beginning of the fully qualified name -
cli.qim.gp.sample.TestProblem. I am not sure how this would work in the
cases where my class was compiled into some other dll and referenced by
my VS project, but it works in the case where my class is in the project
that references ECJ.

This is working very well so far, and I view the rather eerie union of
Java and C# conventions in one environment as a bonus. I can use a JAva
ArrayList of a C# array list, or use a Java collection that I like that
has no counterpart in .Net. I imagine that mixing metaphors might
sometimes causes problems, but I have not yet encountered any.

I thought I would share my experience in case anyone else has similar needs.

Best
George Coles
Quantitative Investment Management