Home

## Two dimensional view ## One dimensional view ## Function ## Latex

A maximization problem:

$$f(x_0 \cdots x_n) = (\sum_{i=1}^n \begin{cases} \frac{-x_i}{d} + 1 & x_i$$d = 0.2$$This is the inverse of deceptiveness.$$db = 0.7$$This is the fitness of the best deceptive optimum.$$0 \leq x_i \leq 1\text{maximum at }f(0, \cdots, 0) = 1.0

## Python

self.deceptiveness = 0.20 #This is actually more like the inverse of deceptiveness since smaller = more deceptive.
self.best_fitness = 1.0
self.deceptive_best = 0.7

def fitnessFunc(self, chromosome):
fitness = 0
dimensions = len(chromosome)
for i in range(dimensions):
if chromosome[i] < self.deceptiveness:
#Then fitness value is on a negative slope with a y
#intercept at 1
fitness += chromosome[i]*(-1.0/self.deceptiveness) \
+ self.best_fitness
else:
#Otherwise, the fitness value is on a positive slope
#with an x intercept at deceptiveness
fitness += (chromosome[i]-self.deceptiveness)* \
(self.deceptive_best/(1.0-self.deceptiveness))
return fitness/float(dimensions)


## Sources

The following may or may not contain the originator of this function.