[Tutor] Encoding and Decoding
carloslara at web.de
Tue Jan 2 20:12:13 CET 2007
I have yet to get into OO, and the GA that I'm using was done in this
way, so I can't mess with it that much. So for now yes, the list has to
be a flat element containing all this info.
I have been reading about OO lately and a element class seems to be a
good idea, I'm working on it now, but I still don't get OO very well. My
initial idea is that a loop could iterate over the element list and
create objects with the needed parameters and hooks to the list that
link to the correct list locations.
Could you elaborate on the converters and the class that wraps the list???
Kent Johnson wrote:
> I will assume there is a good reason for storing the coordinates in
> this form...
> Do the numbers have to be all in a single list? I would start by
> breaking it up into lists of four, so if you have 10 elements you
> would have a list of 20 small lists. It might make sense to pair the x
> and y lists so you have a list of 10 lists of 2 lists of 4 numbers, e.g.
> [ [ [6, 1, 2, 3], [7, 2, 8, 4] ], ...]
> Another thing to consider is whether you might want to make a class to
> hold the coordinate values, then you could refer to x.tens, x.units,
> x.decimal, x.sign by name.
> If you need a single list for the GA to work, one alternative would be
> to make converters between the nested representation and the flat one.
> Alternately you could wrap the list in a class which provides helpful
More information about the Tutor