[galib] Return value

Peter Jay Salzman p at dirac.org
Sun Dec 23 01:19:13 EST 2007

On Sun 23 Dec 07, 11:25 AM, Somnath Bhattacharjee <sn.bhattacharjee at yahoo.co.in> said:
>    1.how can I print the best maximum value for the objective function.
Look at the members of the statistics class.  Might be something there.
Realize that "best" doesn't necessarily mean "max".  Also realize that the
objective function is not the same thing as the fitness.  I *think* you may
mean fitness here (although I could be wrong).

>    2. where the value is being returned from objective function?

At this line of code in your objective function:


>    3.how can I  add the values of two or three objective functions in an
>    another objective function and then print the maximum or minimum value of
>    that Obj function.  

Just define 2 or 3 functions that GALib doesn't know about:

   float objaux1( float x );
   float objaux2( float x );
   float objaux3( float x );

Then define your real objective function (the one that GALib knows about)

    float D1(GAGenome & c)
      GABin2DecGenome & genome = (GABin2DecGenome &)c;
      float value = 0.0F;
      float x1 = objaux1( genome.phenotype(0) );
      float x2 = objaux1( genome.phenotype(1) );
      float x3 = objaux1( genome.phenotype(2) );

      value = (do something with x1, x2, x3);


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

More information about the galib mailing list