ECJ-INTEREST-L Archives

April 2013

ECJ-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
SUBSCRIBE ECJ-INTEREST-L Anonymous <[log in to unmask]>
Reply To:
ECJ Evolutionary Computation Toolkit <[log in to unmask]>
Date:
Sun, 21 Apr 2013 22:00:40 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (218 lines)
You are right. I used the wrong ECJ version. 

Now, I noticed two things:

1. The initial population is not uploaded into the genomes.
In the .params file, I have set,
pop.subpop.0.size                  = 1
pop.subpop.0.species.genome-size = 3
pop.subpop.0.species.ind.gene.0		= java.lang.Float
pop.subpop.0.species.ind.gene.1		= java.lang.Float
pop.subpop.0.species.ind.gene.2		= java.lang.Float

In the pop.in file,
Number of Individuals: i1|
Individual Number: i0|
Evaluated: F
Fitness: f0|0.0|
i3|f|0.25|f|0.25|f|0.25|

To know if the population was uploaded, I added 
"individuals[i].printIndividualForHumans(state, 0);" into Subpopulation 
class' readSubpopulation(final EvolutionState state, final 
LineNumberReader reader) method. 

This is where I placed it.
...........
else for (int i = 0 ; i < individuals.length; i++)
                 {
                 int j = 
Code.readIntegerWithPreamble(INDIVIDUAL_INDEX_PREAMBLE, state, 
reader);
                 // sanity check
                 if (j!=i) state.output.warnOnce("On reading subpopulation 
from text stream, some individual indexes in the subpopulation did not 
match.  " +
                     "The first was individual " + i + ", which is listed in the file 
as " + j);
                 if (individuals[i] != null)
                     individuals[i].readIndividual(state, reader);                 
                 else
                     {
                     state.output.warnOnce("On reading subpopulation from text 
stream, some of the preexisting subpopulation's slots were null.  " +
                         "If you're starting an evolutionary run by reading an 
existing population from a file, this is expected -- ignore this message.");
                     individuals[i] = species.newIndividual(state, reader);
//                     individuals[i].readIndividual(state, reader);
                     }
                 	individuals[i].printIndividualForHumans(state, 0);
                 }
..........

What I got is "Parameters: null null null".

2. ECJ is having problem reading subpopulation size more than 1.
In the .params file, I set,
pop.subpop.0.size                  = 2

In the pop.in file,
Number of Individuals: i2|
Individual Number: i0|
Evaluated: F
Fitness: f0|0.0|
i3|f|0.25|f|0.25|f|0.25|

I received the message,
FATAL ERROR:
Line 5 has a bad preamble.Expected 'Individual Number: '
-->null

Then, I added the "Individual Number: " line
Number of Individuals: i2|
Individual Number: i0|
Evaluated: F
Fitness: f0|0.0|
i3|f|0.25|f|0.25|f|0.25|
Individual Number: i1|

But I get this,
FATAL ERROR:
Line 6 has a bad preamble.Expected 'Individual Number: '
-->null

I further added,
Number of Individuals: i2|
Individual Number: i0|
Evaluated: F
Fitness: f0|0.0|
i3|f|0.25|f|0.25|f|0.25|
Individual Number: i1|
Evaluated: F
Fitness: f0|0.0|
i3|f|0.3|f|0.3|f|0.3|

And I got this message,
FATAL ERROR:
Line 8 has a bad preamble.Expected 'Individual Number: '
-->i3|f|0.3|f|0.3|f|0.3|

thanks for your help.

On Sun, 21 Apr 2013 17:56:00 -0400, Sean Luke <[log in to unmask]> 
wrote:

>On Apr 21, 2013, at 5:22 PM, SUBSCRIBE ECJ-INTEREST-L Anonymous 
wrote:
>
>> 0. Be sure you're using the SVN repository version of ECJ, not the 
tarball
>> version.
>> ---> Yes, its from the SVN.
>
>Are you sure?  When I load this population into ecsuite, I get a different 
set of warnings and it runs fine:
>
>java ec.Evolve \
>	-file ec/app/ecsuite/ecsuite.params \
>	-p pop.subpop.0.file=/tmp/foo.in \
>	-p pop.subpop.0.species.genome-size=4
>
>.... I get ...
>
>WARNING:
>Subpopulation is reading from a file, but no extra-behavior provided.  By 
default, subpopulation will be truncated to fit the file size.
>ONCE-ONLY WARNING:
>On reading subpopulation from text stream, the current subpopulation 
size didn't match the number of individuals in the file.  The size of the 
subpopulation will be revised accordingly.  There were 2 individuals in the 
file and 1000 individuals expected for the subopulation.
>Old subpopulation was of size 1000, truncating to size 2
>
>
>This is the new behavior for ECJ's population loading. It's telling me that 
the subpopulation is supposed to be 1000 but only 2 individuals were 
provided, and so the default behavior it will follow in that situation is to 
truncate the population to 2 (there are two other behavior options).  The 
code works fine with 2, 3, or 4 individuals set in the file (i2| or i3| or i4|)
>
>Anyway, your posted warnings do not match this.  It makes me suspect 
you're possibly not using the SVN version.
>
>
>
>> 3. The file below has two individuals named "i2|".  That's the cause of 
the
>> second warning.
>> ---> If you are referring to "Individual Number: i0|", there are no
>> duplicates.
>
>You're right, I had misread the message.
>
>
>> 5. PrintIndividual needs the EvolutionState because it needs the 
Output
>> facility.  Is there a reason this won't be available but you'd still want to
>> print printIndividual?  You can recreate most of printIndividual by just
>> writing out the right text and the right genome encodings (use
>> ec/util/Code.java).
>> ---> I want to quickly test ECJ with an initial population to see if its 
what I
>> need, without having to dig for days simply to understand its workings. 
If
>> you have a simple example, that would be very helpful.
>
>It depends on the representation.  But here are some simple rules (note 
the hint in the FLOAT discussion below):
>
>A BOOLEAN is written as either:		T  or  F
>
>An INTEGER is written as:  iX|  where X is the integer value.  Example: 
i22|
>
>A FLOAT is written as:   fX|Y|  where Y is the floating-point 
representation and X is the integer representation of the same bits (for 
exactness).  Example:  f1048576000|0.25|    ECJ will use X to determine 
the precise value and will ignore Y.  However if you omit X, then ECJ will 
use Y (you still have to write both | symbols).  This is useful if you are a 
human and don't know these bits.  So as a human you could just write:   
f|0.25|
>
>A DOUBLE VECTOR INDIVIDUAL or FLOAT VECTOR INDIVIDUAL is 
written as:
>
>Evaluated: BOOLEAN
>Fitness: FLOAT
>GENOME
>
>Where GENOME is an INTEGER indicating the number of genes, followed 
by a FLOAT for each gene.  Example:
>
>Evaluated: F
>Fitness: f0|0.0|
>i4|f1056964608|0.5|f1056964608|0.5|f1056964608|0.5|f1056964608|
0.5|
>
>A SUBPOPULATION is written as:
>
>Number of Individuals: INTEGER
>Individual Number: INTEGER
>INDIVIDUAL
>Individual Number: INTEGER
>INDIVIDUAL
>Individual Number: INTEGER
>INDIVIDUAL
>Individual Number: INTEGER
>INDIVIDUAL
>
>... and so on.  That's the file you're trying to read in.  You can also read 
in entire POPULATIONS but it's rarely done.
>
>If you want to print this from some other application, you can do so by 
just printing out the right stuff (ignoring the bit representation in the 
float).  Or you can use ec/util/Code.java to write out the bit 
representation as well.
>
>Sean

ATOM RSS1 RSS2