AttributeError: G1DList instance has no attribute 'setInternalList'
Interactive example:
In [1]: from pyevolve import G1DList
In [2]: gen= G1DList.G1DList(4)
In [3]: gen.setInternalList([1,2,3,4])
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call
last)
/home/davide/<ipython console> in <module>()
<type 'exceptions.AttributeError'>: G1DList instance has no attribute
'setInternalList'
Happy New Year everybody!
;Dav
On Dec 29, 5:41 pm, "Christian S. Perone" <christian.per...@gmail.com>
wrote:
> Hello David,
> you can use a custom initialization routine, like this used for a TSP
> problem:
>
> def G1DListTSPInitializator(genome, **args):
> """ The initializator for the TSP """
> lst = [i for i in xrange(genome.getListSize())]
> random.shuffle(lst)
> genome.setInternalList(lst)
>
> and then put it in the genome:
>
> genome.initializator.set(G1DListTSPInitializator)
>
> Yours,
> - Christian S. Perone
>
On Fri, Jan 1, 2010 at 5:08 AM, David <davide.d...@gmail.com> wrote:
> Another thing, mumbling before the year ends: if I understand
> correctly, this would initialize the genome with a particular list of
> genes, which is not what I want: I want to initialize the population,
> with particular list of individuals (each with its own value for the
> genome).
I do not think that is possible in any population based approach as
such. The individuals in the population are chosen at random. You can
regulate what the individuals are composed of, but probably not what
your population is composed of. Just curious as what problem you are
trying to solve?
I may be wrong.
Best,
Amit
--
Journal: http://amitksaha.wordpress.com,
µ-blog: http://twitter.com/amitsaha
Freenode: cornucopic in #scheme, #lisp, #math,#linux, #python
> On Fri, Jan 1, 2010 at 5:08 AM, David <davide.del.ve...@gmail.com> wrote:
> > Another thing, mumbling before the year ends: if I understand
> > correctly, this would initialize the genome with a particular list of
> > genes, which is not what I want: I want to initialize the population,
> > with particular list of individuals (each with its own value for the
> > genome).
>
> I do not think that is possible in any population based approach as
> such.
Why not? I mean, are you talking about GA in general, or pyevolve API?
> The individuals in the population are chosen at random.
I know, but why? I mean, if you don't have anything, than random is
ok, but if you have something to start from....
> You can
> regulate what the individuals are composed of, but probably not what
> your population is composed of. Just curious as what problem you are
> trying to solve?
I have a heuristic model (actually three different models, among which
I should find the best) that interacts with stochastic data. I have a
natural score for "how well" the model is doing. Each model has 4-10
parameters, which I want to optimize with genetic algorithms. Now, if
I do that naively (just the default in pyevolve) I start with bad
parameters and evolve just marginally better. Increasing the lenght of
the evolution (even a lot) helps very little. Increasing the size of
the population helps more (especially if I choose a huge population),
but just because there are better individuals at the beginning - the
evolution itself slows down a lot and almost stops (as it is common
with large individuals count).
So, my situation now is that I can easily generate (basically at
random) lot of individuals that are fair/good. I think they can be
improved, and I'd like to improve with a population composed of them
(and possibly some additional random ones), rather than from a
completely random population (and my starting individuals are pretty
diverse, so GA should work fine on them)
I think it makes sense, and it could be useful to others, so if it's
not part of pyevolve API I'm eager to modify it and send a patch, if
Christian want.
Happy New year!
Davide
Thanks for the explanation. Now I understand better. Before I try to
give my opinion on your above approach, I am curious: Since you
already know a good starting point, why don't you think of making use
of a local search method such as a Hooke-Jeeve's pattern search- in a
recent work I found it very useful, of course I had coupled it with a
GA. May be you could take a look..
Now, let's do a bit of brainstorming as to how we can generate a
population to our liking: (This is interesting)
I think we can consider a "neighborhood" of arbitrary shape and size
around our starting point. And make sure we get as many individuals,
depending on our desired population size. We can use one of the random
sampling methods, such as a Latin Hypercube Sampling, or similar. I
think that way we can "start off" with a population to our liking.
Does that make any sense? (I hope so:))
Would be interested to know what you think!
Best Regards,
Amit
>
> I think it makes sense, and it could be useful to others, so if it's
> not part of pyevolve API I'm eager to modify it and send a patch, if
> Christian want.
>
> Happy New year!
> Davide
>
--
> Thanks for the explanation. Now I understand better. Before I try to
> give my opinion on your above approach, I am curious: Since you
> already know a good starting point, why don't you think of making use
> of a local search method such as a Hooke-Jeeve's pattern search- in a
> recent work I found it very useful, of course I had coupled it with a
> GA. May be you could take a look..
Well, I'm not sure that local search is ok. Surely, I'll find the
local minima close to my starting points, but I'd like to better
explore more space for a "global" minimum, possibly better than the
local one(s).
> Now, let's do a bit of brainstorming as to how we can generate a
> population to our liking: (This is interesting)
>
> I think we can consider a "neighborhood" of arbitrary shape and size
> around our starting point. And make sure we get as many individuals,
> depending on our desired population size. We can use one of the random
> sampling methods, such as a Latin Hypercube Sampling, or similar. I
> think that way we can "start off" with a population to our liking.
>
> Does that make any sense? (I hope so:))
> Would be interested to know what you think!
Yes that makes sense. I do not know if it will help or not for my
particular problem, but it surely is what I'd like to have (and more):
having a starting population that is not just random.
Are you just thinking about what would be nice to have, or do you have
in mind any implementation detail?
Thanks and TTYL,
;Dav
No, I was just thinking may be that is one way we could approach your
particular requirement. How are you thinking of doing this?
Best,
Amit
>
> Thanks and TTYL,
> ;Dav
I just tried the idea of starting the initial population around a set
of known values and it seems to work pretty nicely for some 2 variable
test problems.
I tried it in a RGA code in C, which my laboratory has.
-Amit
Hi David:
I just tried the idea of starting the initial population around a set
of known values and it seems to work pretty nicely for some 2 variable
test problems.
I tried it in a RGA code in C, which my laboratory has.
-Amit
Blog post on the experiment:
http://amitksaha.wordpress.com/2010/01/06/genetic-algorithms-localsearch/
-Amit
On Wed, Jan 6, 2010 at 1:36 PM, Amit Saha <amitsaha.in@gmail.com> wrote:Blog post on the experiment:
> Hi David:
>
> I just tried the idea of starting the initial population around a set
> of known values and it seems to work pretty nicely for some 2 variable
> test problems.
http://amitksaha.wordpress.com/2010/01/06/genetic-algorithms-localsearch/
-Amit
>
> I tried it in a RGA code in C, which my laboratory has.
>
> -Amit
>
On Jan 6, 1:06 am, Amit Saha <amitsaha...@gmail.com> wrote:
> Hi David:
>
> I just tried the idea of starting the initial population around a set
> of known values and it seems to work pretty nicely for some 2 variable
> test problems.
>
> I tried it in a RGA code in C, which my laboratory has.
>
> -Amit
>
>
>
> On Mon, Jan 4, 2010 at 10:29 AM, Amit Saha <amitsaha...@gmail.com> wrote:
On Jan 6, 1:06 am, Amit Saha <amitsaha...@gmail.com> wrote:
> Hi David:
>
> I just tried the idea of starting the initial population around a set
> of known values and it seems to work pretty nicely for some 2 variable
> test problems.
>
> I tried it in a RGA code in C, which my laboratory has.
>
> -Amit
>
>
>
> On Mon, Jan 4, 2010 at 10:29 AM, Amit Saha <amitsaha...@gmail.com> wrote:
Im a spanish man. Sorry by my bad english.
I need for my research, begin with a population controled.
the idea with set_callback is good but the code has a mistake in the
line
if generation == 0:
Genetation 0 dont exits, je je, you must write:
if generation == 1:
By the oder site, could you show me, how i can put en newpop the news
individuals ???
newpop[0] = [ 1, 2, 3, 4] ???
or i need use copy() ??
Thanks a lot.