[galib] galib Digest, Vol 52, Issue 6

Somnath Bhattacharjee sn.bhattacharjee at yahoo.co.in
Tue Nov 20 05:23:44 EST 2007


Hi 
Pete

                You are right. in this function only one variable is there. I should make one gene. but when I did that there were some compilation error ( as I'm out of station now, I'm not able to write those exact errors). 
Secondly for "ga.minimize()", I saw an example in galib246 of maximum and minimum function, there I saw this function, and I thought it may be for some kind of minimization process.

Thirdly, for   "map.add(16, -3, -2)" this mapping I'm not sure what I should. as I know the two roots I filled it in maximum and minimum place. I think it's not the right concept.

Regards
Somnath


----- Original Message ----
From: "galib-request at mit.edu" <galib-request at mit.edu>
To: galib at mit.edu
Sent: Monday, 19 November, 2007 10:42:18 PM
Subject: galib Digest, Vol 52, Issue 6

Send galib mailing list submissions to
    galib at mit.edu

To subscribe or unsubscribe via the World Wide Web, visit
    http://mailman.mit.edu/mailman/listinfo/galib
or, via email, send a message with subject or body 'help' to
    galib-request at mit.edu

You can reach the person managing the list at
    galib-owner at mit.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of galib digest..."


Today's Topics:

  1. Re: GA program (Peter Jay Salzman)


----------------------------------------------------------------------

Message: 1
Date: Fri, 16 Nov 2007 16:45:11 -0500
From: Peter Jay Salzman <p at dirac.org>
Subject: Re: [galib] GA program
To: GALib Mailing List <galib at mit.edu>
Message-ID: <20071116214511.GA24158 at dirac.org>
Content-Type: text/plain; charset=iso-8859-1

Hi Somnath,


On Sat 17 Nov 07, 12:17 AM, Somnath Bhattacharjee <sn.bhattacharjee at yahoo.co.in> said:
>                      I want to solve the Quadratic equation y= x*x+5*x+6.
>    According to manual calculation the result will be two roots ( -3 and -2 ,
>    for these values of x the function value will be ZERO ).

OK, that's what I suspected.

>    Now by GA the
>    results (means the roots) should be nearly -3 and -2 (not exactly -3,-2).
>    I'm not sure that  it is right or not. I'm beginner in GA so your
>    suggestion will be benchmark for me.

There's nothing wrong with being a beginner.  I'm a beginner too, both with
GAs in general and with GALib.  Let me point out a few things that I noticed
about your code.


First off, you have the following line of code in your program:

>      ga.minimize();

What do you suppose this line of code does?  Compare that with what you want
to accomplish.



Secondly, look at your objective function:

>      GABin2DecPhenotype map;
>      map.add(16, -3, -2);
>      map.add(16, -3, -2);
>
>        ...
>    
>    float
>    objective(GAGenome & c)
>    {
>      GABin2DecGenome & genome = (GABin2DecGenome &)c;
>      float y=6.0;
>      y  += genome.phenotype(0) * genome.phenotype(0);
>      y += 5 * genome.phenotype(0);
>        return y;
>    }

You have two genes in your genome.

Your objective function is a function of only one variable.  It says a whole
lot about genome.phenotype(0).  What does it have to say about
genome.phenotype(1)?  GALib knows how fit phenotype(0) is because
objective() returns a fitness score that's a function of phenotype(0).

But the objective is not a function of phenotype(1).  How does GALib know
how fit phenotype(1) is?


Thirdly, look at the "roots" that GALib is giving to you.  You have two
numbers (note: increase the number of generations to see the "root values"
more clearly.)  Now focus on the meaning of this:

>      ga.minimize();

Notice anything?  If so, you've just discovered what genome.phenotype(0)
really is.  Now the question is, what is genome.phenotype(1)?

To find out what phenotype(1) is, turn your mutation and crossover
probabilities way, way down to almost zero.  Take a look at what the
starting values are for your two genes, before you evolve the system.   Now
evolve the system and look at the final values.

You should be able to guess what genome.phenotype(1) is from this.


Lastly, you set your gene value boundaries to fall exactly on the two
numbers you were expecting GALib to find.  I don't really know much about
GAs myself, but I wonder if that's a good strategy.  It could be.  But until
I learned a bit more about GAs, I'd probably put the expected values on the
"inside" of the search domain, not on its boundary.

Weird things can happen on boundaries.


Again, I'm new to all this too, so perhaps all this is wrong, so take
everything I say with a grain of salt.

Pete

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
Last night I dreamt of 09-f9-11-02-9d-74-e3-5b-d8-41-56-c5-63-56-88-c0

"A mathematician is a machine for converting coffee    p at dirac.org
into theorems."    -- Paul Erd?s                    http://www.dirac.org


------------------------------

_______________________________________________
galib mailing list
galib at mit..edu
http://mailman.mit.edu/mailman/listinfo/galib


End of galib Digest, Vol 52, Issue 6
************************************


      Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20071120/b032f223/attachment.htm


More information about the galib mailing list