# Binary encoding in genetic algorithm

To receive news and publication updates for Journal of Applied Mathematics, binary encoding in genetic algorithm your email address in the box below. Jalali Varnamkhasti and L. This is an open access article distributed under the Creative Commons Attribution Licensewhich permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

The fundamental problem in genetic algorithms is premature convergence, and it is strongly related to the loss of genetic diversity of the population. This study aims at binary encoding in genetic algorithm some techniques to tackle the premature convergence by controlling the population diversity. Firstly, a sexual selection mechanism which utilizes the mate chromosome during selection is used.

The second technique focuses on controlling the genetic parameters by applying the fuzzy logic controller. Combinatorial optimization problems contain many decision variables, and hence exploring the search space and finding the optimal solution remain a major challenge for this type of problem.

Problems, such as loading, scheduling, inventory control, and routing, occur in management fields and in many engineering design processes.

Most of these problems are members of the class of NP-hard problems as classified by Garey and Johnson [ 1 ]. They are usually difficult to solve and cannot be solved in polynomial time. The genetic algorithm GA [ 2 ] is a heuristic search binary encoding in genetic algorithm that mimics natural evolution processes such as selection, crossover, and mutation operations.

The selection pressure drives the population toward better solutions while crossover, uses genes of selected parents to produce offspring that will form the next generation. Mutation is used to avoid premature convergence and consequently escapes from the local optimal. GAs have been very successful in handling hard combinatorial optimization problems.

This study aims at proposing some techniques to tackle the premature convergence of GAs by controlling the population diversity. Firstly, a new sexual selection mechanism binary encoding in genetic algorithm utilizes the mate chromosome during selection is proposed. In a classical GA, chromosomes reproduce asexually: Gender division and sexual selection here inspire a model of gendered GA binary encoding in genetic algorithm which crossover takes place only between chromosomes of opposite sex.

In this paper, the population is divided into groups of males and females. During the sexual selection, the female chromosome is selected by using the tournament selection while the male chromosome is selected based on the Hamming distance HD from the selected female chromosome, fitness value FV or the active genes AGs of the male chromosome. The performance of a GA is strongly related to the equilibrium between the exploration and the exploitation of the genetic operators.

Establishing a suitable relationship between the exploitation and the exploration during the GA implementation is critical for preventing the premature convergence. In this paper, fuzzy tools are used to dynamically control the parameters in the GA in order to create an appropriate balance between **binary encoding in genetic algorithm** and exploration. In order to dynamically control the parameters in a GA, population diversity based on the phenotype and the genotype properties is applied as inputs in a fuzzy logic controller FLC.

Based on these inputs, the fuzzy selection of crossover operator, crossover probability, mutation operator, and mutation probability are produced as the outputs in the FLC. The FLC is used in four stages: The remainder of this paper is organized as follows. In Section 2a comprehensive literature review is given. Section 3 explains in detail the proposed algorithm. Computational experiments based on the benchmark problem instances from the literature are **binary encoding in genetic algorithm** in Section 4.

Finally, a brief conclusion is given in Section 5. The GAs have grown to became a significant problem-solving technique in a variety of areas which encounter problems of design optimization.

It is almost impossible for one to find a uniformly optimum algorithm to resolve all problems of optimization. Control parameters and selective operators of the evolutionary algorithms are becoming more popular because of their capabilities in solving different real world problems.

Fuzzy logic FL and GA can be merged in two possible cases: Binary encoding in genetic algorithm researchers utilized FL to dynamically control the parameters in GA in order to create an appropriate balance between exploitation and exploration. A management technique of crossover and mutation probabilities on the basis of FL was proposed by Song et al. The method used by [ 4 ] encountered some problems in the fuzzy inference rules that Yun and Gen [ 5 ] later overcame by introducing a modification and a scaling factor for the normalization of the input variables.

Their FGA utilized the information of both the whole generation and the particular chromosomes. They formulated different possible definitions for these algorithms. They suggested an exhaustive analysis of fuzzy-adaptive GA and an adaptive approach for controlling the mutation probability based on a utilization of FLCs.

Lee and Takagi [ 14 ] proposed a method for controlling the crossover and mutation rate. They also presented an automatic fuzzy design technique which was based on a GA. Im and Lee [ 15 ] presented adaptive crossover, mutation, and selection using a fuzzy system for GA.

In their study, it is binary encoding in genetic algorithm clear how a fuzzy system was based and which parameter of the GA was used for selection rules and membership functions.

Jalali Varnamkhasti and Lee [ 16 ] proposed a new technique for choosing the female chromosome during sexual selection in a GA. A bilinear allocation lifetime approach is used to label the chromosomes based on their fitness value which will then be used to characterize the diversity of the population. The application of this technique is given by Jafari et al. The performance of an FGA depends on the design of various features, binary encoding in genetic algorithm most important of which are population, selection mechanism, crossover, and mutation operators and their probabilities and replacement strategy.

In the remaining section, we discussed some of the main components of the FGA as shown in Algorithm 1. Chromosome encoding can be achieved by a variety of binary encoding in genetic algorithm methods and the choice of method is usually dependent on the optimization problem structure and precision requisites. However, the most common methods of encoding chromosomes are binary, integer, and real number encoding.

The most commonly employed method of the three is binary encoding, primarily because the first works using GA employed this type of encoding. Binary encoding handles each chromosome as cord of bits, either 1 or 0. In this paper, we used standard binary encoding. In this study, the genotype and phenotype properties are both considered for the measurement of the population diversity. In the case of the phenotypic measures, the methods presented by Srinivas and Patnaik [ 18 ] and Zhu and Liu [ 19 ] are used with slight modifications [ 20 ]: In the case when the genotypic measure is used, an equation similar to part of the technique proposed by Jassadapakorn and Chongstitvatana [ 21 ] is used: In this technique, the HD is calculated in each generation for only two chromosomes: The semantic meaning of these labels are illustrated in Figure 1 [ 20 ].

The selection mechanism drives the population toward better solutions while the crossover uses genes of the selected parents to produce binary encoding in genetic algorithm that will form the next generation.

This operator chooses chromosomes in the present generation for use in construction of the following one. In GAs, this operator is quite similar to the biological process of natural selection. The more fitting chromosomes are better able to survive and breed.

The rate of the GA convergence depends to a great extent on the selection pressure; strong pressure favours fit chromosomes and leads to fast convergence, and vice versa. Though, when the selection pressure is very high, few highly fitting chromosomes will dominate the population thus lowering the diversity due to exploring the binary encoding in genetic algorithm areas of the solution space and consequently may lead to the premature convergence.

On the other hand, when the selection pressure is very weak, the GA will need a higher number of generations to find the optimum solution. A balance between the two is needed to conserve the diversity binary encoding in genetic algorithm the population and escape premature convergence.

In this paper, we use the sexual selection proposed in [ 20 ]. This technique utilizes the mate chromosome during selection. Note that the layout of the male and female chromosomes in each generation is different.

Detailed description can be found in [ 20 ]. To justify the decision of changing the layout of the male and female group in each generation, we tested this technique on four nonlinear numerical functions and compared it with some other sexual selection mechanism available in the literature. In order to better compare the mate selection technique, two types of selection mechanisms, random and tournament selections, are considered.

The different sexual selection mechanisms collected from the literature that are used in the GA are listed in Table 1. Binary encoding in genetic algorithm computations are to maximise the four test functions listed in Table 2 [ 22 ]. Each test function is tested on the GA for 30 times with generations per run. The average results of 30 runs of the test functions are listed in Table 3.

By considering the results from each test function, it is clear that the proposed technique of grouping the male and female chromosomes alternately outperforms other grouping techniques of sexual selection mechanisms. The performance of a GA is dependent on the genetic operators particularly on the type of binary encoding in genetic algorithm operator.

Effective crossover in GAs is achieved through establishing the optimum relationship between the crossover structure and the search problem itself. The goal of this section is to provide a crossover selection technique based on the diversity of the population and a FLC. A crossover operator is selected in each generation from a list of crossover operators by running fuzzy tools on the results of measurements of the population diversity. Many published binary encoding in genetic algorithm compared the various crossover operators see, De Jong and Spears [ 2324 ], Syswerda [ 25 ], and Eshelman et al.

Their results demonstrated that sometimes the final output would be better if the number of crossover points binary encoding in genetic algorithm increased. Besides empirical analysis, substantial efforts have been invested in comparing, from theoretical perspectives, mutation, and crossover as well as the various crossover operators [ 26 ].

However, these theories are not general enough to predict when to apply crossover or what type of crossover operator to employ. For instance, these theories did not address the issue of binary encoding in genetic algorithm of the study population even though it may affect the relative usefulness of the crossover binary encoding in genetic algorithm [ 23 ].

Likewise, there is enough evidence suggesting that the relative usefulness of mutation may be influenced by the size of the population. Mutation seems to be more advantageous compared to crossover with small population sizes whereas crossover may be more advantageous than mutation when dealing with large population sizes [ 26 ].

Moreover, the relative usefulness of mutation and crossover are influenced by several other factors like the fitness function, the representation, and the selection scheme. For selecting the most appropriate crossover method, the structure of the crossover and the population diversity should be considered. In this study, we are using the technique introduced in [ 20 ].

In this technique, some crossover operators based on binary encoding are considered as the default crossover operators. These methods and their abbreviations are presented in Table 4.

The genes bracketed by these numbers are exchanged between two mated parents. The genes are exchanged between alternate binary encoding in genetic algorithm of the cross-points. In each generation, a new crossover mask is randomly generated for each pair of parents.

Encoding Introduction Encoding of chromosomes is one of the problems, when you are starting to solve problem with GA.

Encoding very depends on the problem. In this chapter will be introduced some encodings, which have been already used with some success. Binary Encoding Binary encoding is the most common, mainly because first works about GA used this type of encoding. In binary encoding every chromosome is a string of bits0 or 1. Chromosome A Chromosome B Example of chromosomes with binary encoding Binary encoding gives many possible chromosomes even with a small number of alleles.

Knapsack problem The problem: There are things with given value and size. The knapsack has given capacity. Select things to maximize the value of things in knapsack, but do not extend knapsack capacity. Each bit says, if the corresponding thing is in knapsack. Permutation Encoding Permutation encoding can be used in ordering problems, such as travelling salesman problem or task ordering problem.

In permutation encodingevery chromosome is a string of numbers, which represents number in a sequence. Even for this problems for some types of crossover and mutation corrections must be made to leave the chromosome consistent i. Travelling salesman problem TSP The problem: There are cities and given distances between them. Travelling salesman has to visit all of them, but he does not to travel very much. Find a sequence of cities to minimize travelled distance. Chromosome says order of cities, in which salesman will visit them.

Value Encoding Direct value encoding can be used in problems, where some complicated value, such as real numbers, are used. Use of binary encoding for this type of problems would be very difficult. In value encodingevery chromosome is a string of some values. Values can be anything connected to problem, form numbers, real numbers or chars to some complicated objects. On the other hand, for this encoding is often necessary to develop some new crossover and mutation specific for the problem.

Finding weights for neural network The problem: There is some neural network with given architecture. Find weights for inputs of neurons to train the network for wanted output. Real values in chromosomes represent corresponding weights for inputs. Tree Encoding Tree encoding is used mainly for evolving programs or expressions, for genetic programming. In tree encoding every chromosome is a tree of some objects, such as functions or commands in programming language.

Programing language LISP is often used to this, because programs in it are represented in this form and can be easily parsed as a tree, so the crossover and mutation can be done relatively easily. Finding a function from given values The problem: Some input and output values are given. Task is to find a function, which will give the best closest to wanted output to all inputs. Chromosome are functions represented in a tree.