JCLEC
 
Font size:      

Optimizing the f(x) = 1+ x sin(10 x) by means of genetic algorithms (real encoding)

Problem description

The main objetive is the study of the operation of a simple genetic algorithm. Other objetive is the learning of the basic work lines of this software.

Problem solution

In this section, Optimizing the f(x) = 1+ x sin(10 x) by means of genetic algorithms (real encoding) at interval [-1,2]. In this case, because we are using a real encoding, genotype and genotype are coincident.

To obtain the phenotype, we have to convert the binary value of genotype to its corresponding real value, and after that we have to apply the function over the point. The obtained value may be used as fitness value.

FuncOptRealArrayIndividual class represents individuals with real genotype and real phenotype, witch are used for this kind of problems, and FuncOptRealArrayIndividualSpecies class represents the common features of this kind of individuals in the population. To define the individual configuration, we will indicate the range of values that the search space includes. FuncOptEvaluator object is the responsible of calculating the fitness of the individuals.

We will apply a simple SGA (Genetic Algorithm), with one point crossover and gene mutation. The template to configure the software for this problem is here.