[galib] Constrainted Optimization (Bruckmann, Tobias)

Brian Barkey brian_barkey at juno.com
Tue Nov 20 10:13:44 EST 2007


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,

More information about the galib mailing list