# A Genetic Algorithm with Fuzzy Crossover Operator and Probability

Authors: Mohammad Jalali Varnamkhasti; Lai Soon Lee; Mohd Rizam Abu Bakar; Wah June Leong
Journal: Advances in Operations Research
 (2012)

---

## Abstract

The performance of a genetic algorithm is dependent on the genetic operators, in general, and on the type of crossover operator, in particular. The population diversity is usually used as the performance measure for the premature convergence. In this paper, a fuzzy genetic algorithm is proposed for solving binary encoded combinatorial optimization problems. A new crossover operator and probability selection technique is proposed based on the population diversity using a fuzzy logic controller. The measurement of the population diversity is based on the genotype and phenotype properties. In this fuzzy inference system, the selection of the crossover operator and its probability are controlled by a set of fuzzy rules derived from the fuzzy logic controller. Extensive computational experiments are conducted on the proposed algorithm, and the results are compared with some crossover operators commonly used for solving multidimensional 0/1 knapsack problems published in the literature. The results indicate that the proposed algorithm is effective in finding better quality solutions.


---

## Body

## 1. Introduction

Premature convergence is a common problem in finding the optimal solution in Genetic Algorithm (GA) and it is strongly related to the loss of the population diversity. When population diversity is low, a GA will converge very quickly. On the other hand, if the diversity of the population is too high, it is very time consuming for a GA to converge and this may cause wastage in computational resources.The performance of a GA is dependent on the genetic operators in general and on the type of crossover operator, in particular. During the evolution process by a GA, if the selected chromosomes are identical, some of the crossover operators have failed to create offspring that are different from their parents. Effective crossover in a GA is achieved through establishing the optimum relationship between the crossover and the search problem itself.In this paper, a fuzzy genetic algorithm (FGA) is proposed for solving binary encoded combinatorial optimization problems like the Multidimensional 0/1 Knapsack Problem (MKP). The aim is to design a crossover operator and probability selection technique based on the population diversity using Fuzzy Logic Controller (FLC). The diversity of the population is measured on the basis of the genotype and phenotype characteristics of the chromosomes. In addition, a new technique based on Hamming Distance (HD), Fitness Value (FV), and Active Genes (AG) of the mate chromosomes is proposed during the sexual selection.In recent years, the MKP has turned out to be the favourite playground for experimenting with metaheuristics. It serves as a suitably “difficult” test problem for developing advanced techniques in this field. The MKP is a general statement of any binary encoded problem with nonnegative coefficient. It is formulated as follows (Djannaty and Doostdar [1]):(1.1)max⁡f(x1,x2,…,xn)=∑j=1npjxjs.t.∑j=1nwijxij≤cii=1,2,…,m,xj∈{0,1}j=1,2,…,n,withpj>0,wij≥0,ci≥0,
where n = number of objects; m = number of knapsacks; wij = consumption of resource i for object j; ci = capacity of the ith knapsack; pj = profit associated with object j; xj = decision variable with object j.The remainder of this paper is organized as follows. Literature review is given next in Section2. Section 3 elaborates on the population diversity. In Section 4, the proposed FGA is described in detail. The computational results of the FGA for MKP based on the benchmark problem instances deflated from the literature are presented in Section 5. Finally, a brief conclusion is given in Section 6.


## 2. Literature

Evolutionary algorithms usually use the population diversity as the performance indicator for a number of reasons like avoiding premature convergence, controlling algorithm restarting or stopping when the population diversity drops below certain thresholds, the necessity for assessing a population of distinct Pareto-optimal solutions in an optimization problem, and the need for rapid adaptation of a population to dynamic problems (see Tomassini et al. [2], Morrison and De Jong [3], and Wineberg and Oppacher [4] for more details).Some of the literature on the population diversity focuses on the genetic operators and their probabilities. Sywerda [5] and De Jong and Spears [6] compared the various crossover operators, particularly the numbers of crossover points. Their results demonstrated that sometimes the final output would be better if the number of crossover points was increased. Besides empirical analysis, substantial efforts have been invested in comparing, from theoretical perspectives, between mutation and crossover as well as between the various crossover operators [6]. However, these theories are not general enough to allow for predicting when to apply or what type of crossover operator to employ. For instance, those theories did not address the size of the study population even though it may affect the relative usefulness of the crossover operators [7]. 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 than crossover with small population sizes whereas crossover may be more advantageous than mutation with large population sizes [8]. Moreover, the relative usefulness of mutation and crossover are influenced by several other factors like, fitness function, representation, and selection scheme.The selection of crossover probabilitypc critically affects the behaviour and the performance of a GA. It controls the rate at which solutions are subordinate to crossover where for each problem the probability is chosen by the user. Goldberg and Sastry [9] generalized the schema theorem for pc. They argued that the selection pressure corresponds to disruption of schema, and they showed that when the building blocks are compact (its genes are located close to each other in the chromosome string), the GA works well for a wide range of combinations of pcand selection pressures.Adaptive techniques that alter the probability of applying an operator in proportion to the observed performance of the chromosomes in the course of a run were proposed by Davis [10]. Fernandes et al. [11] considered a GA that adapts the reproduction rate to the size of the population under investigation. Annunziato and Pizzuti [12] presented a technique for setting the genetic parameters during the implementation by adapting the population size and the operators’ rate to the environmental constraint of maximum population size. On the other hand, Srinivas and Patnaik [13] adopted a messy approach towards the determination of pcbased on the various fitness values of the population. They presented an approach that eliminates the need for parameters in a crossover-based GA. Cao and Wu [14] proposed a systematic stochastic algorithm for optimization of the control parameters for GAs. In their research, a GA is modelled as a controlled Markov chain whose transition depended on the control probability of crossover and mutation. Hong et al. [15] introduced a dynamic GA that simultaneously used more than one crossover and mutation operators to generate the next generation. The operators’ rate is varied along with the evaluation results of the respective offspring in the next generation.Numerous researchers used different parameters as the input variables in FLC for dynamically control the crossover and mutation probabilities during the GA implementation. Song et al. [16] considered the alteration of the average fitness value between two consecutive generations as the input variables. Yun and Gen [17] later introduced a scaling factor for normalization of the input variables used in [16]. Li et al. [18] utilized the information of both the whole generation and the particular chromosomes as the input variables. Wang et al. [19] considered the differences in the fitness values between two consecutive generations, and Liu et al. [20] used the average fitness value and the best fitness value of chromosomes in each generation as the input variables.Lee and Takagi [21] considered three inputs for the fuzzy system: x0=favg/fbest,x1=fworst/favg, and x2 is the change in best fitness since the last control action input variables favg,fbest,and fworst are the average, best, and worst fitness values, respectively. Corresponding to these inputs, three outputs are introduced for the current population size, crossover probability, and mutation probability. They tested the proposed technique on the inverted pendulum control task in [22]. However, this technique had two major defects:(i)
only the phenotype characteristic is used as the input variable,(ii)
using the metalevel GA to find the optimized fuzzy system for the dynamic parameterized GA is computationally expensive.Im and Lee [23] presented adaptive crossover, mutation, and selection using fuzzy system for GAs. However, it is not clear how fuzzy system is based and which parameter of GA is used for the selection rules and the membership functions.The main problem of FLC is how to gain the fuzzy rules the inference system is based on. Several approaches have been proposed by automatic rule base identification. A family of bacterial type evolutionary algorithms has been successfully applied for solving this task. The goal is to create more accurate fuzzy rule bases from input-output data sets as quickly as possible. A comprehensive review on these bacterial-type evolutionary algorithms is given in [24].


## 3. Population Diversity

The approach adopted in this study attempts to define a measure for the population diversity on the basis of the genotype and phenotype characteristics. The question may be raised as to why the phenotype and genotype characteristics are used together in this study. A simple example will be used to answer the question. Letf(x)be a linear function for which a maximum value needs to be defined as follows:(3.1)max⁡f(x)=∑i=115ixiwherexi∈{0,1}.
To solve (3.1) using GA, let us say five chromosomes with length 15 are considered as the initial population. In Table 1, the goal is to evaluate the population diversity based on the genotype property. To activate this, the HDs between the chromosomes with the highest fitness value and other chromosomes are calculated. Note that the HD can be defined as follows.Table 1
A population with low genetic diversity based on genotype property (HD) but with high population diversity based on phenotype property (FV).
ChromosomeHamming Distance (HD)Fitness value (FV)0 1 0 1 0 1 1 1 1 1 0 1 1 1 1—1000 1 0 1 0 1 1 1 1 1 0 1 0 0 12730 1 0 1 0 1 1 1 1 1 0 1 1 1 01850 1 0 1 0 1 1 1 1 1 0 1 1 0 02711 1 0 1 0 1 1 1 1 1 0 0 1 1 1289Definition 3.1 (Hamming Distance).
LetCi={ci1,ci2,…,cim} and Cj={cj1,cj2,…,cjm} be two chromosomes within a population with length m, the Hamming Distance (HD) between Ci and Cj is
(3.2)HD(Ci,Cj)=∑k=1md(cik,cjk),
where d(cik,cjk)={0,ifcik=cjk1,otherwise.As seen in Table1, the HD is at most 2 while the length of chromosomes is 15. This means that the genetic diversity of the population is low. However, by considering the FVs of the chromosomes, the range is somehow relatively high. Therefore, the genotype property of the chromosomes alone is not enough for explaining the diversity of the population.In Table2, a different initial population is used to evaluate the population diversity based on phenotype property. To achieve this, the FVs of the chromosomes are considered. As seen in Table 2, the range of differences between the chromosomes in terms of FVs is low, and hence it seems that the diversity of the population is low although the HD between the chromosomes is high. Therefore, the phenotype property of the chromosomes alone is not enough for justifying the diversity of the population.Table 2
A population with low population diversity based on phenotype property (FV) but with high genetic diversity based on genotype property (HD).
ChromosomeHamming Distance (HD)Fitness value (FV)0 1 0 1 0 1 1 1 1 1 0 1 0 0 0—580 1 1 0 1 0 0 0 1 0 1 0 1 1 011570 1 1 0 1 0 0 1 0 0 1 0 1 0 111570 1 1 0 0 0 0 0 0 0 1 0 1 1 112581 1 1 1 0 0 1 0 0 0 1 0 0 1 11057In light of this, the genotype and phenotype properties are both considered in this paper for the measurement of the population diversity. In the case of the phenotypic measures, the methods presented by Srinivas and Patnaik [13] and Zhu and Liu [25] are used with slight modifications:(3.3)T1,t=nfiN,T2,t=fmax⁡,t-favg,tfmax⁡,t,
where N= population size, nfi= number of unique fitness values in the population, fmax,t= maximum fitness value in generation t and favg,t = average fitness value in generation t.In the case when the genotypic measure is used, an equation similar to part of the technique proposed by Jassadapakorn and Chongstitvatana [26] is used:(3.4)T3,t=HD(Cfmax⁡,t,Cfmin⁡,t)L,
where HD(Cfmax,t,Cfmin,t)= HD between the chromosomes with the highest and the lowest FV, and L = length of the chromosome.In this technique, the HD is calculated in each generation for only two chromosomes: the chromosome with the maximum fitness value(Cfmax)and the one with the minimum fitness value (Cfmin). It should be highlighted, however, that in the method of [26], the HD is calculated between the first selected chromosome and the candidate chromosome ci, where i=1,2,…,populationsize. Therefore, our proposed method requires less time than that of [26].T1,t,T2,t, and T3,tbelong to the interval [0,1]. As the  T1,t and T2,tapproach zero, the FVs of the chromosomes are almost identical and this shows that the convergence has taken place whereas if these are close to one, the population shows a high level of diversity. Similarly, if T3,tis close to zero, then the genetic diversity is low and the population has the potential to converge very quickly. If it is near to one, the population shows a high level of genetic diversity.When we speak of population diversity in terms of low, medium, or high diversity, we can see that the language becomes a fuzzy variable whose spatial denotation is imprecise. In this sense, fuzzy theory becomes easily understood because it can be made to resemble a high level language instead of a mathematical language. To describe this, fuzzy sets with names such as Low, Medium, or High are used to create a membership function. By determining the degree of membership of an input in the fuzzy sets of this membership function, one can see the role of membership functions play in decoding the linguistic terminology to the values a computer can use. In most cases, membership functions are designed by experts with knowledge of the system being analyzed. In this paper, with regards toT1,t,T2,t, and T3,t, three membership functions are defined. The set of linguistic labels associated with T1,t and T3,tare Low, Medium, and High and those related to T2,t are Low and High. The semantic meaning of these labels is illustrated in Figure 1.Figure 1
The set of linguistic labels associated withT1,t,T2,t, and T3,t.


## 4. Fuzzy Genetic Algorithm

In this section, we concentrate on the discussion of the proposed FGA for solving binary encoded combinatorial optimisation problem specifically on the MKP defined in Section1. In the remainder of this section, we explained the framework of the proposed FGA illustrated in Figure 2 in more detail.Figure 2
Framework of fuzzy genetic algorithm.


### 4.1. Gene Representation and Population

For the MKP, a solution can be simply encoded by a string of 0 and 1s, where “1” encodes that an item is being selected and “0” means otherwise. The length of the chromosome corresponds to the number of itemsn, in the MKP.A good initial population makes it easy for a GA to converge to good solutions while a poor initial population can prolong a GA convergence. There are different approaches in generating initial population for a GA. The most common method is by random generation. In this paper, we use the random generation method proposed by Chu and Beasley [27] to achieve better diversity in the population. The pseudo code for the initial population is given in Algorithm 1. Note that the population size is kept constant throughout the implementation.Algorithm 1:Initial population (source: Chu and Beasley [27]).
Let:S is a bit string belong to {0,1}n.Let:Ri=accumulated resources of constraint i in S.fork=1 to N  dosetxkj←0,∀j∈J;setT←J (T is a dummy set);randomly select aj∈T and set T←T-j;whileRi+wij≤ci;∀i∈Idoset xkj←1;set Ri←Ri+wij,∀i∈I;randomly select a j∈T and set T←T-j;end whileend forAfter new offspring are created via the crossover and mutation operators, there may be some offspring that have infeasible solutions. There are several ways to deal with the infeasible solutions in a GA as stated below:(i)
utilize an encoding method that produced only feasible solutions,(ii)
apply a repair mechanism to transform any infeasible solution into a feasible solution,(iii)
separate the evaluation of fitness between the feasible and infeasible solutions, or(iv)
apply a penalty function to penalise the fitness of any infeasible solution without distorting the fitness landscape.In this paper, we use the repair operator introduced by Chu and Beasley [27] that converts an infeasible solution into a feasible solution as presented in Algorithm 2.Algorithm 2:Repair operator (source: Chu and Beasley [27]).
Let:Ri=accumulated resources of constraint i in S.initializeRi=∑j=0nwijxj, ∀i∈I;forj=n to 1doif(xj=1) and (Ri>cifor anyi∈I)thensetxj←0;setRi←Ri-wij,∀i∈I;end ifend forforj=1 to ndoif(xj=0) and (Ri+wij≤ci for any i∈I)thensetxj←1;setRi←Ri+wij,∀i∈I;end ifend for


### 4.2. Sexual Selection

In a standard GA, chromosomes reproduce asexually, that is, any two chromosomes may be the parents in crossover. Gender division and sexual selection inspired a model of gendered GA in which crossover takes place only between chromosomes of opposite sex. Since GA mimics natural evolution, then gender is one of the crucial elements in a GA.Inspired by the nongenetic sex determination system prevalent in some reptile species where sex is determined by the temperature at which the egg is incubated, the population are divided such that the male and female would be selected in an alternate way. The layout of the male and female chromosomes in each generation is different. In other words, when the number of generation is even, the chromosomesCi and Ci+1 are the male and female, respectively, and vice versa when the number of the generation is odd. For instance, suppose that a population size is five, the layout of males and females from this population is shown in Table 3.Table 3
The layout of male and female chromosomes.
ChromosomeGenderGenerationtGenerationt+1C1MaleFemaleC2FemaleMaleC3MaleFemaleC4FemaleMaleC5MaleFemaleDuring the proposed sexual selection, a female chromosome is selected by tournament selection sizet from the female group. The selected female chromosome is denoted as female_chro. On the other hand, the selection of male chromosome (male_chro) for crossover is based on the HD from female_chro, FV, or AG of the male chromosome. Note that the AG can be defined as follows.Definition 4.1 (Active Gene).
The Active Gene denoted byAG(Ci) is the number of nonzero gene in chromosome Ci. For instance, let  Ci=(100101011000100), then AG(Ci)=6.
At first,t male chromosomes are selected randomly from the male group. Then, the male_chro is selected, in order of preference based on(i)
the maximum HD between the male chromosome and the female_chro,(ii)
the highest FV of male chromosome (if more than one male chromosome is having the maximum HD),(iii)
the highest AG of the male chromosome (if more than one male chromosome having the highest FV is found), or(iv)
random selection.The computational experiments of the proposed sexual selection compared to other selection mechanisms from the literature can be found in Varnamkhasti and Lee [28]. Computational results on MKPs showed that the proposed sexual selection mechanism is comparable in providing high-quality solutions in reasonable execution time.


### 4.3. Fuzzy Crossover Operator and Probability

In this subsection, we propose a crossover operator and probability selection technique based on the population diversity using FLC. For selecting the most appropriate crossover operator, the structure of the crossover and the population diversity must be considered. In this paper, some commonly used crossover operators for binary encoding are considered as the default crossover operators. These operators and their abbreviations are given in Table4. It is worth mentioning that, if crossover is not applied based on the given probability, then the two offspring are simply duplicates of their parents.Table 4
Abbreviations of crossover operators.
Crossover operatorsAbbreviation2-point crossover2PCk-point crossoverKPCUniform crossoverUCSegregation crossoverSCInversion crossoverICWhen the genetic diversity of the population is high(T3,t≥0.50), the 2PC operator performs relatively well compared to other crossover operators especially in terms of the computational time. The genetic diversity of the population is medium (0.25≤T3,t≤0.50) when some loci in the chromosomes are the same. In such cases, the 2PC operator is not an appropriate choice, but the KPC, and UC operators would be more suitable. Both operators are capable of keeping the genetic diversity of the population while improving the fitness values of the chromosomes. On the other hand, the genetic diversity of the population is low (T3,t≤0.25) when some chromosomes are identical. The 2PC, KPC, and UC operators failed to produce offspring that are different from their parents. In this case, the SC and IC operators will be more appropriate. Based on the above explanation of the relative crossover operators and genetic diversity, three levels for Crossover Ability (CA) called Low, Medium, and High are introduced and presented in Table 5.Table 5
Levels of crossover operator based on CA.
LowMediumHigh2-pointk-pointSegregationUniformInversionAs discussed earlier, genetic diversity alone is not enough to justify the population diversity as a whole. Hence, we propose a fuzzy system which takes three input variables and produces two output variables:T1,t,T2,t, and T3,tare the input variables while CA and pc are the output variables. The set of linguistic labels associated with the output variables comprises the descriptions of Low, Medium, and High. For each linguistic term, there is a triangular fuzzy set that defines its semantic meaning as shown in Figure 3.Figure 3
The set of linguistic labels associated with CA andpc.The linguistic rules describing the control system consist of two parts: an antecedent block (between theIF and THEN) and a consequent block (following THEN). By making this type of evaluation, fewer rules can be evaluated, thus simplifying the processing logic and perhaps even improving the fuzzy logic system performance. Each rule has the possibility of generating a single rule for each output variable. In this paper, the inputs are combined logically using the AND/OR operator to produce output (xi,μi(CA))and (yi,μi(pc))response values for all the expected inputs:(4.1)μi(CA)=max⁡{μi(T1,t),μi(T2,t),μi(T3,t)},μi(pc)=min⁡{μi(T1,t),μi(T2,t),μi(T3,t)},
where i=1,2,…,numberofrules.Therefore, the proposed fuzzy system with three input variables will have 18(3×2×3) rules for each output variable (CA and pc). This fuzzy rule base is collectively presented in Table 6. The fuzzy outputs for all rules are finally aggregated to one fuzzy set. To obtain a crisp decision from this fuzzy set, we use the Centre of Gravity approach for defuzzification:(4.2)xCA=∑i=1nμi(CA)xi∑i=1nμi(CA),ypc=∑i=1nμi(pc)yi∑i=1nμi(pc).Table 6
Fuzzy rule base for CA andpc.
RuleT1,tT2,tT3,tCApc1LowLowLowHighHigh2LowLowMediumHighHigh3LowLowHighMediumMedium4LowHighLowHighMedium5LowHighMediumMediumMedium6LowHighHighMediumLow7MediumLowLowHighHigh8MediumLowMediumMediumMedium9MediumLowHighMediumMedium10MediumHighLowMediumMedium11MediumHighMediumMediumMedium12MediumHighHighMediumLow13HighLowLowHighHigh14HighLowMediumMediumMedium15HighLowHighLowMedium16HighHighLowLowMedium17HighHighMediumLowLow18HighHighHighLowLow


### 4.4. Elitism Replacement with Filtration

After the fuzzy crossover and the standard binary mutation operators are applied, elitism replacement technique is used as the replacement strategy. The offspring have to compete with their parents in order to allow transition into the new population. In other words, fitter chromosomes will survive for the next generation and they are never lost unless better solutions are found. In the elitism replacement technique, both parent and offspring populations are considered together as a single population. Then this population is sorted in a nonincreasing order of their associated fitness value and the first half of the chromosomes from this combined population are selected as the chromosomes of the new population for the next generation.What is meant, within this context, by saying that two chromosomes are identical is that the loci of their genes are equal. Existence of the identical chromosomes is one of the critical problems for premature convergence. When a large proportion of the chromosomes in the population are identical, the diversity of the population will be lost and premature convergence occurs. In order to overcome this problem, the filtration technique is used to add diversity to the new population. In this technique, one of the identical chromosomes is kept while the others are removed and replaced by new feasible chromosomes that are generated randomly. As the filtration procedure involves the process of  “identifying”, “regenerating” and “reevaluating”, of the new chromosomes, which requires a certain amount of computation time, it is sensible to just invoke the procedure everyR generation (where R is a parameter, e.g., 100) or when there is at least 10 percent of the population that are identical.


## 4.1. Gene Representation and Population

For the MKP, a solution can be simply encoded by a string of 0 and 1s, where “1” encodes that an item is being selected and “0” means otherwise. The length of the chromosome corresponds to the number of itemsn, in the MKP.A good initial population makes it easy for a GA to converge to good solutions while a poor initial population can prolong a GA convergence. There are different approaches in generating initial population for a GA. The most common method is by random generation. In this paper, we use the random generation method proposed by Chu and Beasley [27] to achieve better diversity in the population. The pseudo code for the initial population is given in Algorithm 1. Note that the population size is kept constant throughout the implementation.Algorithm 1:Initial population (source: Chu and Beasley [27]).
Let:S is a bit string belong to {0,1}n.Let:Ri=accumulated resources of constraint i in S.fork=1 to N  dosetxkj←0,∀j∈J;setT←J (T is a dummy set);randomly select aj∈T and set T←T-j;whileRi+wij≤ci;∀i∈Idoset xkj←1;set Ri←Ri+wij,∀i∈I;randomly select a j∈T and set T←T-j;end whileend forAfter new offspring are created via the crossover and mutation operators, there may be some offspring that have infeasible solutions. There are several ways to deal with the infeasible solutions in a GA as stated below:(i)
utilize an encoding method that produced only feasible solutions,(ii)
apply a repair mechanism to transform any infeasible solution into a feasible solution,(iii)
separate the evaluation of fitness between the feasible and infeasible solutions, or(iv)
apply a penalty function to penalise the fitness of any infeasible solution without distorting the fitness landscape.In this paper, we use the repair operator introduced by Chu and Beasley [27] that converts an infeasible solution into a feasible solution as presented in Algorithm 2.Algorithm 2:Repair operator (source: Chu and Beasley [27]).
Let:Ri=accumulated resources of constraint i in S.initializeRi=∑j=0nwijxj, ∀i∈I;forj=n to 1doif(xj=1) and (Ri>cifor anyi∈I)thensetxj←0;setRi←Ri-wij,∀i∈I;end ifend forforj=1 to ndoif(xj=0) and (Ri+wij≤ci for any i∈I)thensetxj←1;setRi←Ri+wij,∀i∈I;end ifend for


## 4.2. Sexual Selection

In a standard GA, chromosomes reproduce asexually, that is, any two chromosomes may be the parents in crossover. Gender division and sexual selection inspired a model of gendered GA in which crossover takes place only between chromosomes of opposite sex. Since GA mimics natural evolution, then gender is one of the crucial elements in a GA.Inspired by the nongenetic sex determination system prevalent in some reptile species where sex is determined by the temperature at which the egg is incubated, the population are divided such that the male and female would be selected in an alternate way. The layout of the male and female chromosomes in each generation is different. In other words, when the number of generation is even, the chromosomesCi and Ci+1 are the male and female, respectively, and vice versa when the number of the generation is odd. For instance, suppose that a population size is five, the layout of males and females from this population is shown in Table 3.Table 3
The layout of male and female chromosomes.
ChromosomeGenderGenerationtGenerationt+1C1MaleFemaleC2FemaleMaleC3MaleFemaleC4FemaleMaleC5MaleFemaleDuring the proposed sexual selection, a female chromosome is selected by tournament selection sizet from the female group. The selected female chromosome is denoted as female_chro. On the other hand, the selection of male chromosome (male_chro) for crossover is based on the HD from female_chro, FV, or AG of the male chromosome. Note that the AG can be defined as follows.Definition 4.1 (Active Gene).
The Active Gene denoted byAG(Ci) is the number of nonzero gene in chromosome Ci. For instance, let  Ci=(100101011000100), then AG(Ci)=6.
At first,t male chromosomes are selected randomly from the male group. Then, the male_chro is selected, in order of preference based on(i)
the maximum HD between the male chromosome and the female_chro,(ii)
the highest FV of male chromosome (if more than one male chromosome is having the maximum HD),(iii)
the highest AG of the male chromosome (if more than one male chromosome having the highest FV is found), or(iv)
random selection.The computational experiments of the proposed sexual selection compared to other selection mechanisms from the literature can be found in Varnamkhasti and Lee [28]. Computational results on MKPs showed that the proposed sexual selection mechanism is comparable in providing high-quality solutions in reasonable execution time.


## 4.3. Fuzzy Crossover Operator and Probability

In this subsection, we propose a crossover operator and probability selection technique based on the population diversity using FLC. For selecting the most appropriate crossover operator, the structure of the crossover and the population diversity must be considered. In this paper, some commonly used crossover operators for binary encoding are considered as the default crossover operators. These operators and their abbreviations are given in Table4. It is worth mentioning that, if crossover is not applied based on the given probability, then the two offspring are simply duplicates of their parents.Table 4
Abbreviations of crossover operators.
Crossover operatorsAbbreviation2-point crossover2PCk-point crossoverKPCUniform crossoverUCSegregation crossoverSCInversion crossoverICWhen the genetic diversity of the population is high(T3,t≥0.50), the 2PC operator performs relatively well compared to other crossover operators especially in terms of the computational time. The genetic diversity of the population is medium (0.25≤T3,t≤0.50) when some loci in the chromosomes are the same. In such cases, the 2PC operator is not an appropriate choice, but the KPC, and UC operators would be more suitable. Both operators are capable of keeping the genetic diversity of the population while improving the fitness values of the chromosomes. On the other hand, the genetic diversity of the population is low (T3,t≤0.25) when some chromosomes are identical. The 2PC, KPC, and UC operators failed to produce offspring that are different from their parents. In this case, the SC and IC operators will be more appropriate. Based on the above explanation of the relative crossover operators and genetic diversity, three levels for Crossover Ability (CA) called Low, Medium, and High are introduced and presented in Table 5.Table 5
Levels of crossover operator based on CA.
LowMediumHigh2-pointk-pointSegregationUniformInversionAs discussed earlier, genetic diversity alone is not enough to justify the population diversity as a whole. Hence, we propose a fuzzy system which takes three input variables and produces two output variables:T1,t,T2,t, and T3,tare the input variables while CA and pc are the output variables. The set of linguistic labels associated with the output variables comprises the descriptions of Low, Medium, and High. For each linguistic term, there is a triangular fuzzy set that defines its semantic meaning as shown in Figure 3.Figure 3
The set of linguistic labels associated with CA andpc.The linguistic rules describing the control system consist of two parts: an antecedent block (between theIF and THEN) and a consequent block (following THEN). By making this type of evaluation, fewer rules can be evaluated, thus simplifying the processing logic and perhaps even improving the fuzzy logic system performance. Each rule has the possibility of generating a single rule for each output variable. In this paper, the inputs are combined logically using the AND/OR operator to produce output (xi,μi(CA))and (yi,μi(pc))response values for all the expected inputs:(4.1)μi(CA)=max⁡{μi(T1,t),μi(T2,t),μi(T3,t)},μi(pc)=min⁡{μi(T1,t),μi(T2,t),μi(T3,t)},
where i=1,2,…,numberofrules.Therefore, the proposed fuzzy system with three input variables will have 18(3×2×3) rules for each output variable (CA and pc). This fuzzy rule base is collectively presented in Table 6. The fuzzy outputs for all rules are finally aggregated to one fuzzy set. To obtain a crisp decision from this fuzzy set, we use the Centre of Gravity approach for defuzzification:(4.2)xCA=∑i=1nμi(CA)xi∑i=1nμi(CA),ypc=∑i=1nμi(pc)yi∑i=1nμi(pc).Table 6
Fuzzy rule base for CA andpc.
RuleT1,tT2,tT3,tCApc1LowLowLowHighHigh2LowLowMediumHighHigh3LowLowHighMediumMedium4LowHighLowHighMedium5LowHighMediumMediumMedium6LowHighHighMediumLow7MediumLowLowHighHigh8MediumLowMediumMediumMedium9MediumLowHighMediumMedium10MediumHighLowMediumMedium11MediumHighMediumMediumMedium12MediumHighHighMediumLow13HighLowLowHighHigh14HighLowMediumMediumMedium15HighLowHighLowMedium16HighHighLowLowMedium17HighHighMediumLowLow18HighHighHighLowLow


## 4.4. Elitism Replacement with Filtration

After the fuzzy crossover and the standard binary mutation operators are applied, elitism replacement technique is used as the replacement strategy. The offspring have to compete with their parents in order to allow transition into the new population. In other words, fitter chromosomes will survive for the next generation and they are never lost unless better solutions are found. In the elitism replacement technique, both parent and offspring populations are considered together as a single population. Then this population is sorted in a nonincreasing order of their associated fitness value and the first half of the chromosomes from this combined population are selected as the chromosomes of the new population for the next generation.What is meant, within this context, by saying that two chromosomes are identical is that the loci of their genes are equal. Existence of the identical chromosomes is one of the critical problems for premature convergence. When a large proportion of the chromosomes in the population are identical, the diversity of the population will be lost and premature convergence occurs. In order to overcome this problem, the filtration technique is used to add diversity to the new population. In this technique, one of the identical chromosomes is kept while the others are removed and replaced by new feasible chromosomes that are generated randomly. As the filtration procedure involves the process of  “identifying”, “regenerating” and “reevaluating”, of the new chromosomes, which requires a certain amount of computation time, it is sensible to just invoke the procedure everyR generation (where R is a parameter, e.g., 100) or when there is at least 10 percent of the population that are identical.


## 5. Computational Results

The benchmark data set tested in this paper inclusive of 270 MKPs is proposed in [27]. This data set was extensively utilized in the literature for the testing of MKP algorithms. These problems include n=100,250,500 variables and m=5,10,30 constraints. For each category of n variables, three tightness ratios α=0.25,0.50,0.75 are considered. This set of problems contains 27 different problem sets, each having 10 randomly generated instances, thus a total of 270 problems.In these problem sets,wij are drawn from discrete uniform generator U(0,1000)and the right hand side coefficients ci,i∈{1,…,m}, are set using ci=α∑j=1nwij where α is the tightness ratio. The objective function coefficients pj,j∈{1,…,m} are correlated to wij and are generated as pj=∑i=1m(wij/m)+500ej, where ej is a real number drawn from the continuous uniform generator U(0,1).The performance of these approaches is measured by the Percentage Deviation (PD) between the benchmark problems taken from the ORLibrary [29] and our results, that is:(5.1)PD=|Bi-Ri|Bi×100%,
where Bi is the benchmark result and Ri is the computational result obtained by the proposed algorithms.In order to scrutinize the performance and the ability of the proposed FGA compared to standard genetic algorithms (SGAs), the crossover operators mentioned in Table4 are used in the computational experiments. The difference between the proposed FGA and a SGA is with regards to the use of the crossover operator and its probability. In other words, a SGA will employ one crossover operator with fixed probability, pc=0.70 during implementation. Thus, there will be five SGAs as compared to one FGA in the experiment. Each algorithm is implemented with a population size of 100. Sexual selection described in Section 4.2, the replacement strategy explained in Section 4.4, and standard binary mutation with probability pm=1/L (L is the length of chromosome) are used as the default genetic operators.All algorithms were coded in C++ and ran on a Pentium IV with 2.0 GHz CPU and 2.0 GB of RAM. For each problem instance, 30 runs were performed. In order to have a fair comparison between the algorithms in this experiment, we employed a duration of 20 CPU seconds per run. Results are listed in Table7. The benchmark column represents the average computational results of 10 problem instances from each problem set of the MKPs that are compiled in [29]. For each algorithm, the entries report the average PD computed over 10 problem instances with 30 runs each, that is, 300 runs. For each category of m, the final line gives the average PD over all values of n. The final line of Table 7 gives the overall average PD over all categories of m.Table 7
Comparative computational results (20 CPU seconds per run).
mnαBenchmarkSGAFGA2PCKPCUXSCIC0.2524197.201.3800.8490.8220.8620.9050.5371000.5043252.901.1470.3710.3440.3880.3920.1870.7560471.001.0050.3070.2850.2990.3000.1960.2560409.701.3090.2000.1960.2050.2010.11052500.50109284.601.1650.1000.0910.0890.0960.0530.75151555.900.9940.0570.660.0440.0570.0220.25120615.500.7110.7010.0520.0550.0550.0345000.50219503.100.6200.6290.0290.0300.0330.0050.75302354.900.4990.4400.0190.0190.0220.004Average0.9810.4060.2780.2210.2290.1280.2522601.902.5031.3081.2881.2801.2830.7351000.5045659.101.2820.5830.5740.5700.5820.4800.7559555.601.0970.3090.3050.3160.3100.1180.2558993.901.6300.4070.3990.3950.3960.218102500.50108706.401.5230.1690.1630.1580.1600.1070.75151330.400.9740.1280.1250.1200.1270.0730.25118565.501.2080.1800.1750.1680.1710.1055000.50217274.600.9880.0850.0850.0800.0850.0430.75302556.000.8110.0590.0570.0540.0520.008Average1.3350.3590.3520.3490.3520.2100.2521654.603.7552.7392.7302.7182.7231.2171000.5041431.302.7021.2001.1971.1901.1920.8940.7559199.101.6930.7250.7250.7200.7240.4790.2556875.902.6601.0201.0171.0141.0190.936302500.50106673.701.6020.4270.4260.4150.4160.2400.75150443.501.1090.1600.1600.1520.1570.0300.25115473.501.5810.4050.4050.3980.4000.3285000.50216156.901.2900.1170.1140.1090.1100.0070.75302353.401.0410.1030.1030.0990.1010.075Average1.9370.7660.7640.7570.7600.467Average1.4180.5110.4650.4420.4470.268We first observed that the FGA performs significantly better than the SGAs. This shows that the FGA is able to produce better quality solutions compared to SGAs in a fixed CPU time. There is clear evidence from Table7 that, on average, the FGA is the best algorithm followed by the SGAs with SC, IC, UX, KPC, and finally the SGA with 2PC. The algorithms find problems of m=30 to be the most challenging. With other things (i.e., n and α) being equal, when we increase the value of m, then PD will increase. Note that for all the algorithms, fewer generations are executed within the time limit as the number of knapsacks or constraints become larger.


## 6. Conclusion

Genetic algorithms usually use the population diversity as the performance measure for a number of reasons such as avoiding premature convergence. This paper proposed techniques for the measurement of the population diversity based on the phenotype and genotype properties. The main contribution of this study is the crossover operator and probability selection technique based on the population diversity using fuzzy logic controllers. The performance of the proposed fuzzy genetic algorithm compared to other standard genetic algorithms for solving the multidimensional 0/1 knapsack problems showed that the proposed algorithm is effective in finding better and comparable solutions.Future research efforts will investigate extending the proposed fuzzy genetic algorithm to include the fuzzy mutation operator and probability selection technique for other binary encoded combinatorial optimisation problems. In addition, we may consider to extend the research for integer encoded fuzzy genetic algorithm.



---

*Source: 956498-2012-02-13.xml*