next_inactive up previous


Scaling in Genetic Algorithms

Sushil J. Louis

Dept. of Computer Science

University of Nevada, Reno

Motivation

We want to maintain an even selection pressure throughout the genetic algorithm's processing.

Neither is desirable. Thus we may want to scale the fitness so that selection pressure remains the same throughout the run. Let us formulate the problem in the following way:

We can calculate the linear coefficients $a$ and $b$ from the constraint equations above. However, it is possible for the scaled fitness to go below $0$. What do we do? We map $f^{\prime}_{min}$ to $0$. The pascal code for doing this is given in the book on page 79.

#include "type.h"

void FindCoeffs(IPTR pop, Population *p);

void Scalepop(IPTR pop, Population *p)
{ 
  /* linearly scale the population */
  IPTR pj;
  int i;
  
  FindCoeffs(pop, p);

  p->scaledSumFitness = 0.0;
  for(i = 0; i < p->popsize; i++){
    pj = &pop[i];
    pj->scaledFitness = p->scaleConstA * pj->fitness + p->scaleConstB;
    p->scaledSumFitness += pj->scaledFitness;
  }
}

void FindCoeffs(IPTR pop, Population *p)
{
  /* find coeffs scale_constA and scale_constB for linear scaling according to 
     f_scaled = scale_constA * f_raw + scale_constB */  

  double d;

  if(p->min > (p->scaleFactor * p->avg - p->max)/
     (p->scaleFactor - 1.0)) { /* if nonnegative smin */
    d = p->max - p->avg;
    p->scaleConstA = (p->scaleFactor - 1.0) * p->avg / d;
    p->scaleConstB = p->avg * (p->max - (p->scaleFactor * p->avg))/d;
  } else {  /* if smin becomes negative on scaling */
    d = p->avg - p->min;
    p->scaleConstA = p->avg/d;
    p->scaleConstB = -p->min * p->avg/d;
  }
  if(d < 0.00001 && d > -0.00001) { /* if converged */
    p->scaleConstA = 1.0;
    p->scaleConstB = 0.0;
  }
}

About this document ...

Scaling in Genetic Algorithms

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 1 scaling.tex

The translation was initiated by Sushil Louis on 2004-09-22


next_inactive up previous
Sushil Louis 2004-09-22