Problem using evalData()

Rolf Russell rolfr at
Sun Aug 1 14:46:12 EDT 1999


I am having a problem using evalData in GAlib244.  I am running a 4
population GA in which each population hold a different agent in a 4
player game.  The representations of the players are identical, but my
objective function needs to know which population a genome comes from to
evaluate it.  I derived a GAEvalData class (see below) to store the
population, but when I ran my GA performed very poorly.  (I have
compared it to other GA performances.)   Searching for the problem I was
able to cut evaldata out of my code to the point where all I do is pass
new GAEvalData objects into evalData() for each genome object in
GADemeGA's initialize() method.  My objective function and other
functions don't use/access the GAEvalData objects thereafter.  But still
the GA's performance is terrible.  Has anyone else had similar problems
using evalData() or has anyone successfully used evalData()?

I believe that H. Brown Cribbs, III asked a similar question to this
mailing list on Wed, 20 Aug 1997  (Subject: using evalData...), but I
couldn't find a reply.

thanks for your help

--Rolf Russell

PS.  Here is my derived GAEvalData class:

    { pop = 123; }

  GAPopulationData(const GAEvalData& other)
    { this->copy(other); }

  GAPopulationData(int popnumber)
    { this->pop = popnumber; }

  virtual ~GAPopulationData() {}

  GAPopulationData& operator=(const GAPopulationData& orig)
    { if(&orig != this) copy(orig); return *this; }

  virtual GAEvalData* clone() const
    { return new GAPopulationData(*this); }

  virtual void copy(const GAEvalData& other)   {
      const GAPopulationData *otherData = dynamic_cast <const
GAPopulationData *> (&other);
      if (otherData)
         this->pop = otherData->pop;
      else {
         cerr << "\n\nERROR:  Trying to copy non GAPopulationData object

into "
                  << "a GAPopulationData object. (Possibly during
                  << " object creation.)   Exiting ...\n\n";

  int population()
    { return pop; }

  int population(int popnumber)
    { pop = popnumber;  return pop; }

  int pop;

More information about the galib mailing list