Sender: |
|
Date: |
Thu, 20 Oct 2011 11:24:28 -0400 |
MIME-version: |
1.0 (Apple Message framework v1084) |
Reply-To: |
|
Content-type: |
text/plain; charset=us-ascii |
Subject: |
|
From: |
|
In-Reply-To: |
|
Content-Transfer-Encoding: |
8bit |
Parts/Attachments: |
|
|
Sonja, there are two parts to your question.
1. Mixed genes: GeneVectorIndividual is the way to go. Just create a VectorGene subclass which holds, I dunno, a double. You store a float or an int or a boolean value (set to 1 or 0) in that double. Maybe also a flag indicating what kind of data it is perhaps.
You'll want to override at least the following methods:
hashCode()
equals(...)
reset()
mutate() // not required, but you'll want to do it
toString()
To save out the population, or use networking, you'll need to override some readers and writers too.
For more information, see Section 5.1.3 of the Manual.
2. Variable-length lists: GeneVectorIndividual can do this too (all VectorIndividuals can). All you need is to specify an appropriate mutation or crossover operator. However ECJ doesn't provide many at this time (only two) -- lists are a special case and often require custom operators. See Section 5.1.2 of the Manual.
Sean
On Oct 20, 2011, at 4:38 AM, Sonja Holl wrote:
> I'm new to ECJ and try to use GA's for parameter optimization. I have already
> extended ECJ but now run into a problem. Is there any possibility to create a
> type mixed Individual. It want to have a genome of type [float/int/boolean] (The
> types and length vary for each run, so I thought of a generic solution). I know
> that there is this GeneVectorIndividual, which I could extend as well as the
> VectorGene, but I think, it is not very comfortable to use this as I only use
> standard ECJ vector types.
|
|
|