# Genetic Algorithms

Introduces uses and ways to implement the revolutionary AI technology... genetic algorithms.

**Original Author:** Technosoft Enterprises

### Code

`Genetic Algorithms`

`Genetic Algorithms`

**I. Introduction: **

Genetic algorithms are a revolutionary new way to use minimal computational power to handle infinitely complicated calculations. This new AI concept 'evolves' so that it does not waste ANY of your computer's memory. It is almost a very advanced trial-and-error system that filters out the incorrect 'guesses.' A programmer who can use all of these capabilities to his/her advantage will be much in demand in the software industry of the near future.

**II. The Setup of a Genetic Algorithm:**

The three subsections (IIa through IIc) talk about the three steps the algorithm goes through. The situation is the following: there is a "blackbox" function that takes in eight input numbers and outputs one value. The genetic algorithm does not know what mathematical operations are conducted within the blackbox function. However, the user of the genetic algorithm tells it that he/she wishes to know the input numbers to be put in to come out with an output number (specified by the user.)

*IIa. Step 1 -- Initialization*

The genetic algorithm (known as GA from here on) starts by making a small population of 16 'chromosomes.' These chromosomes are random 32-bit binary strings. After these 16 chromosomes are created, step 2 begins.

*IIb. Step 2 -- Fitness Calculation*

The GA takes the chromosomes one by one and breaks the 32 binary characters down into 8 sections of 4. (i.e. 1101-0010-1101-0110-1010-0101-1010-1110) These eight sections are then decoded in regular (base-10) integers and inputted into the blackbox function. The GA then calculates how close the output for that chromosome is to the optimum target value. The closer the chromosome is to the target value the higher of a fitness value they are awarded. This process is repeated for all the chromosomes currently in the system.

*IIc. Step 3 -- Reproduction and Mutation*

After all the chromosomes have been evaluated, the ones with lower fitness numbers are 'exterminated' and the others are allowed to reproduce. A random crossover point between the father and mother chromosomes is chosen. For Example:

Father: 00110101

Mother: 01001010

Random Crossover Point: 3

Child (three from the father, five from the mother): 00101010

After that, some children undergo random mutation where one of the binary digits is changed. Steps 2 and 3 are repeated until the results match the target number.

**III. Final Note**

This tutorial has only introduced the idea of genetic algorithms. In Part 2, we will explain how to program them and use them in everything from medical applications to one-time pad encryption. Thanks for your interest and we hope you'll be waiting for the next one!

Loading Comments ...

## Comments

No comments have been added for this post.

*You must be logged in to make a comment.*