[galib] Constrainted Optimization (Bruckmann, Tobias)

Bruckmann, Tobias bruckmann at mechatronik.uni-duisburg.de
Mon Dec 3 10:31:56 EST 2007


meanwhile, I'm playing around with my constrainted optimization problem. Thanks to the code snippet from Brian, I introduced a new data member for my genome class which allows me to mark all invalid individuals in the evaluation function.
Now I'd like to remove the invalid individuals from the population in my own evolveBounded() function:

while ( //stop criterion not reached )

	for (int i = 1; i<this->populationSize(); i++)
		if (candidate.valid == gaFalse ) //the individual is invalid

The problem is that the population object is declared as "const" while destroy() calls remove() which is NOT const. I'm not an experienced C++ programmer, so I'm having problems to get the point. What is the reason to introduce a "const" population while a function is offered to kill individuals (which fails because of the protection)? Or does it lead to problems to change the population size during run time? This idea came to my mind since I'm not sure if the implementation creates a new population with the original size also from a reduced population.

I guess there is a legal way to solve the problem (as a bad hack, I could try to replace the "const" population, but this shouldn't be the way...).

Thanks a lot and best regards,

-----Ursprüngliche Nachricht-----
Von: galib-bounces at mit.edu [mailto:galib-bounces at mit.edu] Im Auftrag von Brian Barkey
Gesendet: Dienstag, 20. November 2007 16:14
An: galib at mit.edu
Betreff: Re: [galib] Constrainted Optimization (Bruckmann, Tobias)


I think this may be what your looking for.  I wanted to make sure that I had no duplicate members in my population so I did this:

while ( //my looping variables)
   // see if there are any duplicates, reinitialize if there are
  //population().individual(0) = best leave this one alone

      for (i = 1; i<popsize; i++)
         for (j=1;j<popsize; j++)
          if (j != i)
             if ( ga.population().individual(j)                // put
your viability test here
                 ==  ga.population().individual(i) )

Hope this helps

        Brian Barkey


I'm starting my experience with GAlib to solve a constrainted optimization problem. That means, I have absolutely strict boundaries for the optimization. The evolution will generate individuals which are invalid and thus have to be removed from the population before the next generation is created. Now I could just set a very bad cost function for these individuals, but in this case, the population would sometimes contain individuals which are no solution. So I would prefer to "kill"
these individuals - is there already a way within GAlib to do this, or do I have to implement it by myself?
Thanks a lot for your help and 
Best Regards,
galib mailing list
galib at mit.edu

More information about the galib mailing list