27
41 CHAPTER 3 GRAY CODING GENETIC ALGORITHM 3.1 INTRODUCTION In many research areas like science and engineering, the global optimization for the complex problems are very difficult to solve mathematically. Once an objective function has been defined with many local values, the existing optimization methods may not produce the global optimization effectively. Based on the genetic evolution process (Holland 1992) the GA was proposed. A detailed survey of Genetic Algorithm and its implementation was also designed (Goldberg 1989). They provide a robust procedure to provide good solutions in the broad range in the search space and to avoid premature convergence (Wang et al 2003, Tsutsui et al 1999). However the time taken for execution is high i.e., the convergence velocity get reduced. In order to increase the convergence velocity, the Genetic Algorithms are developed with binary values. However the problems with continuous variables cannot be implemented with binary coded Genetic Algorithm. The distance between the closest binary values is very large. For example, the integer values 7 and 8 represented as 0111 and 1000 in binary representation respectively

CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

41

CHAPTER 3

GRAY CODING GENETIC ALGORITHM

3.1 INTRODUCTION

In many research areas like science and engineering, the global

optimization for the complex problems are very difficult to solve

mathematically. Once an objective function has been defined with many local

values, the existing optimization methods may not produce the global

optimization effectively.

Based on the genetic evolution process (Holland 1992) the GA was

proposed. A detailed survey of Genetic Algorithm and its implementation was

also designed (Goldberg 1989). They provide a robust procedure to provide

good solutions in the broad range in the search space and to avoid premature

convergence (Wang et al 2003, Tsutsui et al 1999). However the time taken

for execution is high i.e., the convergence velocity get reduced. In order to

increase the convergence velocity, the Genetic Algorithms are developed with

binary values.

However the problems with continuous variables cannot be

implemented with binary coded Genetic Algorithm. The distance between the

closest binary values is very large. For example, the integer values 7 and 8

represented as 0111 and 1000 in binary representation respectively

Page 2: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

42

(Yang et al 2005). The efficiency of the algorithm is relatively reduced when

there is a change in the binary code. In order to avoid the difficulties

identified in GA using binary coding for real valued optimization problems, a

real valued encoding was done in bit strings for population creation (Satman

2013).

In real value coding Genetic Algorithm, the processing of genetic

operators is very difficult and it is problem specific. The computational time

is increased when the real values are used in bit strings. Hence gray value

representation of bit string is proposed.

3.2 GRAY CODING

The structure of the chromosome decides the presence or absence

of an individual in the search space. The structure of the chromosome is

formed based on the standard encoding schemes like binary encoding, real

value encoding, permutation encoding and tree encoding.

Generally in all Genetic Algorithms binary coding scheme is used

for the chromosome representation. Gray coding is the alternative way of

representing the binary values. A Gray code has adjacency property, which

means that the code represents each number in the sequence as a binary string

in such an order that adjacent integers have Gray code representations

differing in only one bit position. To match through the integer sequence it is

required to flip just one bit at a time (Baccouche et al 2004, Azouaoui et al

2012).

Page 3: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

43

In Gray coding the bit strings of the individuals are concatenated

together to give a single bit string (or "chromosome") which represents the

entire vector of parameters. In biological terminology, each bit position

corresponds to a gene of the chromosome, and each bit value corresponds to

an allele. The collection of genes is called as chromosomes (Individuals).

Gray coding is another way of coding parameters into bits which

has the property that an increase of one step in the parameter value

corresponds to a change of a single bit in the code (Wright 1991). The binary

code values are converted to gray code values by the mathematical formula:

1

1

11k

k k

B if kG

B B if k

where Gk represent the gray value in the kth position in the bit string.

B1 is the value present in the first bit position in binary code string

and Bk is the value present in the kth bit of the binary string.

Similarly the mathematical formula used for the decoding process

i.e., converting the gray value to its original form is

1

k

k ii

B G

Table 3.1 shows the equivalent gray values for the given binary

values.

Page 4: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

44

Table 3.1 Comparison of binary and gray codes

Decimal Value Binary Code Gray Code

0 0000 0000

1 0001 0001

2 0010 0011

3 0011 0010

4 0100 0110

5 0101 0111

6 0110 0101

7 0111 0100

8 1000 1100

9 1001 1101

10 1010 1111

11 1011 1110

12 1100 1010

13 1101 1011

14 1110 1001

15 1111 1000

3.3 GRAY CODING IN GENETIC ALGORITHM

The GA starts with an initial generation and the GA takes this

generation and creates a new generation, this step of creating new generations

from the previous generation continues until a solution is found. Here the

initial generations are generated by random.

Page 5: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

45

Generally in traditional Genetic Algorithm, the representation of an

individual is a fixed length bit string. Each bit position in the individual

represents a unique property of an individual. The value present in each bit

shows how the properties present in the individual. Either it may be present or

may not be present. Each gene in an individual represents a value that is

structurally different from other genes.

In the proposed approach, the initial populations of the search space

are generated by random. The individual is a collection of bit string holds the

binary value either 0 or 1. Parent chromosomes are obtained by applying the

standard selection mechanisms. The identified parents are encoded to gray

values. Thus the individuals are formed with gray values in bit strings. Since

gray values are formed by combining the adjacent bit strings, there is no need

of performing crossover with the individuals. Mutation is alone performed to

produce new offspring. After the genetic operations, the gray values are

decoded to its original form i.e., the gray values are converted to binary

values. The fitness values are calculated, the best fit individuals are replaced

in the current generation. The iteration process continues till the termination

condition is reached.

The general structure of the Genetic Algorithm with gray code is as

follows:

Page 6: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

46

Figure 3.1 Structure of Genetic Algorithm with gray coding

The pseudo code for the proposed Genetic Algorithm with Gray

coding is as follows:

1. [ Initialization ]

Generate the initial population by random.

2. [ Fitness Evaluation ]

Calculate the fitness value of each individual in the population.

3. [Selection ]

Select the individuals from the initial population using standardselection mechanism

Start

InitialPopulation

FitnessEvaluation

ParentSelection

Stop

Convert toGray value

Mutate

Convert toBinary value

BestIndividuals

Start

Page 7: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

47

4. [Encoding]

Convert the selected parents to Gray code individuals.

5. [Mutation]

Mutate the new offspring.

6. [Decoding]

The offsprings are decoded to form individuals with binary strings

7. [Replace]

The best individuals are replaced in the current generation

8. [ Termination ]

Repeat the process from step -3 till the termination condition is reached.

Select the best solution from the current population.

3.4 EXPERIMENTAL ANALYSIS

The performance of the proposed Genetic Algorithm with gray

coding is evaluated by implementing it in 0/1 Knapsack Problem, a

combinatorial optimization problem (Martello & Toth 1990). 0/1 knapsack

problem an NP hard problem is chosen, because it obtains the best solution

from many other solutions.

The knapsack problem can be defined as given a set of items, each

with a benefit (P) and a volume(V), determine the number of each item to

include in a collection so that the total volume is less than or equal to a given

limit and the total benefit is as large as possible.

Let there are n distinct items that may potentially be placed in the

knapsack. Let item ‘i’ has the volume Vi and has the benefit Pi. Let Xi denotes

Page 8: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

48

number of item i that have to be placed in the knapsack. Generally only one

copy of the item is placed in the knapsack. If the item is present in the

knapsack then the value of Xi is ‘1’ otherwise the value of Xi is ‘0’ i.e., the

item is not present in the knapsack.

The main objective is to maximize the function f(x)

where f(x) is

1

n

ipixi

subject to the constraint

1

, 0,1n

ivixi C xi

The representation of individuals, the fitness evaluation, the

selection mechanism and the genetic operators used for the 0/1 knapsack

problem are discussed below.

3.4.1 Representation of Individuals (Chromosomes)

Initial population is a collection of individuals (chromosomes)

which are generated randomly. Each chromosome is a collection of genes.

The chromosomes are represented in the form of one dimensional bit vector.

The size of the individual depends on the problem size and the number of

objects present in the problem. The bit vector holds the value either 0 or 1. If

the vector holds the value 1 in a position x represents the inclusion of the

object (item) in the knapsack. If the vector holds the value ‘0’ indicates the

item is not included in the knapsack.

Generally binary encoding is used to define the chromosome for the

implementation of 0/1 knapsack problem in Genetic Algorithm.

Page 9: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

49

3.4.2 Fitness Calculation

The calculation of fitness value is a very simple procedure. The

fitness value of an individual is calculated by calculating the sum of the

profits of the items which are included in the knapsack i.e., in the vector the

profits of all the genes which has the value as 1. The sum is calculated with

the constraint that weight should not exceed the knapsack capacity C.

3.4.3 Selection Mechanism

Various selection schemes like Roulette wheel selection, Ranking

based selection and Tournament Selection methods are used to identify the

parents (Best individual) from the initial population.

3.4.4 Genetic Operators

The various crossover techniques like Single Point Crossover, Two

Point Crossover and Uniform Crossover are applied. Flip bit mutation is

applied to mutate the offspring.

With the above mentioned parameters, several experiments are

carried out to find the optimal parameters.

3.4.5 Example of 0/1 Knapsack Problem

Consider the knapsack with a capacity of 10 cubic inches with 3

items. Each item has its own benefit and volume. The main objective of the

knapsack is to include the item in the knapsack with maximum benefit and fit

the items with the knapsack capacity. Let I1, I2 and I3 be the three items. The

volume and the benefit corresponding to each item is show in the Table 3.2.

Page 10: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

50

Table 3.2 Sample inputs for knapsack problem

Item No. I1 I2 I3

Benefit (P) 4 3 5

Volume (V) 6 7 8

For ‘n’ items, 2n possible subsets are formed. Here there are 3

items, so 8 subsets are formed with the items. In order to find the optimal

solution, a subset that meets the constraint with the total maximum benefit has

to be identified.

Table 3.3 Subset of the knapsack

S. No I1 I2 I3 Volume Benefit

1 0 0 0 0 0

2 0 0 1 8 5

3 0 1 0 7 3

4 0 1 1 15 -

5 1 0 0 6 4

6 1 0 1 14 -

7 1 1 0 13 7

8 1 1 1 21 -

From the Table 3.3, it is noticed that the row 7 with item value 110

satisfies the constraint of weight 13 and has the maximum benefit of all the

possible subsets.

The aim is to maximize the benefit

Page 11: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

51

1 2 31

4 3 5n

ipixi x x x

Subject to the constraint

1 2 31

6 7 8 13n

ivixi x x x

and xi {0, 1} for i= 1, 2....., n.

In general if there are ‘n’ items used in the knapsack, then the

length of the chromosome has ‘n’ values, where each bit value in the

chromosome indicates the presence or absence of item in the knapsack. If bit

value is ‘1’ shows the presence of particular item in the knapsack otherwise

the bit value is ‘0’.

The representation of chromosomes which are included in the

initial population is shown in the Figure 3.2.

C1 1 0 1 1 0 1 0 1 1 0

C2 0 0 1 0 1 1 0 1 0 1

C3 1 1 1 0 0 1 0 0 1 1.

.

.

Cn-1 0 0 1 0 1 1 0 1 0 1

Cn 1 1 1 0 0 1 0 0 1 1

Figure 3.2 Sample chromosomes

Page 12: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

52

The reason for choosing the 0/1 knapsack problem it that,

implementation is easy and tested without any difficulty. Multiple executions

of the algorithm could be made with ease for different runs with different

parameter settings in each run.

3.5 PERFORMANCE ANALYSIS

With the influence of various parameters, the detailed study is

made on Genetic Algorithm with gray coding to find out the optimal

parameters for the effective run of the algorithm.

Impact of Population Size

Impact of different Selection Schemes

Impact of different mutation Rates

To analyse the performance of the algorithm, it is implemented in

0/1 knapsack problem. Knapsack problem can be easily implemented and

tested, so the knapsack problem was chosen for analysis. Several executions

of the problem could be made with different runs with different parameter

sets.

3.5.1 Impact of Different Population Size

The basic parameter in GA is the number of individuals present in

the initial population. The size of the population is one of the crucial factors

in identifying the best solution in the GA process. Hence the optimal

performance of the proposed approach is analysed with varying number of

population sizes.

With the fixed number of objects, the algorithm was experimented

with varying number of populations with the standard parameter settings. The

Page 13: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

53

values obtained by the impact of the varying population size are shown in

Table 3.4. The algorithm was executed till the termination condition is

reached. The occurrence of the same fitness value in several consecutive

generations is considered as the termination condition of the approach.

The basic parameter sets for the proposed approach is as follows:

Selection mechanism : Rank based selection

Mutation type : Flip bit Mutation

Mutation Rate : 0.05

Table 3.4 Impact of different population sizes

ExecNo.

Population Size50

Population Size100

Population Size150

Population Size200

Genes. Profit Genes. Profit Genes. Profit Genes. Profit1 25 147101 32 148120 33 148120 38 1512102 26 147523 30 148895 31 148895 35 1505683 26 146618 31 146820 30 147110 36 1513114 27 145420 32 149065 31 149080 37 1503925 26 147700 33 148131 34 148568 39 1504326 25 148020 29 147055 31 148823 35 1489877 26 146530 31 146530 32 146530 36 1489988 27 146990 32 148723 34 148823 37 1492359 28 145575 31 146123 35 146214 35 149389

10 27 146990 33 147910 34 148004 36 15021411 25 145538 31 147610 32 147822 37 14987912 26 147420 30 147420 35 149990 35 14999113 27 146464 33 146483 33 146483 37 15056214 26 147630 32 147678 34 149873 38 15121315 27 146945 32 147463 35 148765 37 150879

Page 14: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

54

The proposed algorithm was executed with 50, 100, 150 and 200 as

its population sizes. The Figure 3.3 illustrates the profit obtained by the

impact of different population sizes and Figure 3.4 shows the convergence

velocity obtained by the algorithm during execution. Convergence velocity is

the number of generations obtained to converge maximum profit.

Figure 3.3 Profit obtained by different population sizes

Figure 3.4 Convergence obtained by different population sizes

Page 15: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

55

From the Figure 3.3 it is observed that the profits obtained are

larger when the population size increases. From the Figure 3.4 it is inferred

that the number of generations taken to converge is higher when the

population size increases. From the figures it is inferred that the algorithm

produces better profit when the population size is 200. It yields good results

both in terms of the speed of the convergence as well as the optimality of the

solution.

3.5.2 Impact of Different Selection Mechanisms

It is observed that the algorithm works well when the population

size is higher. In large population sizes the identification of good individuals

is difficult. Hence the different selection schemes to be analysed. To

determine the good selection methodology, the algorithm was implemented

with the standard selection schemes like Roulette wheel selection, Rank

Based Selection and Tournament Selection.

Since the algorithm produces good profit at population size 200, the

rest of the implementations are done with the same population size. The

genetic parameters remain the same with varying selection mechanisms. The

Figure 3.5 shows the profit obtained with varying selection schemes when the

population size is 200 and Figure 3.6 shows the execution time to converge

the maximum profit on various selection schemes and the values are noted in

Table 3.5.

Page 16: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

56

Figure 3.5 Profit obtained by varying selection mechanisms

Table 3.5 Impact of different selection mechanisms

ExecNo.

RW Selection Rank Selection TournamentSelection

Genes. Profit Genes. Profit Genes. Profit

1 32 148122 31 149208 29 149346

2 30 148087 32 148786 30 149300

3 29 148099 30 148813 28 149278

4 29 148178 29 148856 29 149078

5 30 148198 28 148932 29 149124

6 31 148213 30 148769 28 149012

7 30 148194 32 148824 27 148991

8 29 148192 30 148924 28 148983

9 32 148168 31 148998 29 149027

Page 17: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

57

Table 3.5 (Continued)

ExecNo.

RW Selection Rank SelectionTournament

Selection

Genes. Profit Genes. Profit Genes. Profit

10 31 148203 32 148890 30 149056

11 30 148213 31 149113 28 149120

12 31 148209 30 149003 27 149056

13 32 148178 32 149098 28 149224

14 33 148198 31 149123 30 149323

15 32 148168 33 148923 29 149211

Figure 3.6 Convergence obtained on different selection mechanisms

From the above table and figures, it is observed that the algorithm

identifies the maximum profit with Tournament Selection mechanism than

other two selection mechanisms. The time taken to converge maximum profit

by Tournament Selection method is less than roulette wheel selection and

Page 18: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

58

rank based selection mechanisms. Hence Tournament Selection is to be

adopted as the parent selector for better performance.

3.5.3 Impact of Different Mutation Rates

The chromosomes are formed by adding the values of the adjacent

bits within the chromosomes in gray coding. Hence it is not essential to

perform crossover operation between the chromosomes. During mutation

there is a chance to produce new characteristics, so that a better individual can

be formed. Hence in this experiment, the population size and other factors are

maintained constant and various mutation rates (MR) are applied to identify

the optimal mutation rate of the approach.

The algorithm was experimented when mutation rate (MR) varies

from 5% to 25 %. The values obtained by these parameter settings are noted

in the Table 3.6.

Table 3.6 Impact of different mutation rates

ExecNo.

Mutation rate5%

Mutation rate10%

Mutation rate15%

Mutation rate20%

Mutation rate25%

Gens. Profit Gens. Profit Gens. Profit Gens. Profit Gens. Profit

1 34 147974 34 148132 32 148329 30 148424 31 148322

2 32 147912 33 148242 31 148209 31 148312 30 148312

3 31 147946 30 148259 32 148312 30 148356 30 148272

4 32 147894 31 148312 33 148320 29 148378 29 148276

5 33 147956 32 148212 31 148357 30 148324 28 148312

6 31 148023 33 148123 32 148298 28 148312 30 148298

Page 19: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

59

Table 3.6 (Continued)

ExecNo.

Mutation rate5%

Mutation rate10%

Mutation rate15%

Mutation rate20%

Mutationrate 25%

Gens. Profit Gens. Profit Gens. Profit Gens. Profit Gens. Profit

7 30 147982 32 148213 34 148169 29 148232 29 148280

8 29 148098 32 148214 31 148234 28 148337 31 148312

9 30 147956 29 148312 32 148273 30 148325 30 148298

10 31 147964 32 148284 30 148310 29 148412 31 148378

11 33 147945 31 148154 31 148274 27 148298 29 148312

12 31 147948 33 148197 31 148219 29 148312 28 148343

13 29 147985 31 148228 32 148257 28 148301 30 148297

14 32 147932 32 148112 34 148232 30 148298 31 148210

15 33 147946 31 148218 32 148234 28 148320 30 148313

From the table it is inferred that when mutation rate is at 20% the

algorithm produces good profit in ease.

Figure 3.7 Profit obtained on different mutation rates

Page 20: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

60

Figure 3.8 Convergence obtained on different mutation rates

From the Figure 3.7 and Figure 3.8, it is observed that the mutation

rate plays a crucial role in producing the good performance of the algorithm.

It is inferred that the algorithm works better when the mutation percentage is

20%. The convergence velocity is not seriously determined by these values

because there is a change in the performance between the mutation rates.

3.6 COMPARISON OF GCGA Vs SGA

The optimal parameters that are best suited for MCPGA are

No of Individuals : 200

Selection Mechanism : Tournament Selection

Mutation Type : Flip bit Mutation

Mutation Rate : 0.20

With this parameter set the performance of GCGA was compared

with SGA.

Page 21: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

61

The performance of GCGA and GA was compared based on profit

and convergence velocity. Experiments have been carried out to study the

performance of both the algorithms with fixed population size.

Experiments are conducted with

Fixed number of generations

Variable number of generations

3.6.1 Fixed number of Generations

Both the algorithms are experimented with the optimal parameter

set and the performance is analysed. Profits obtained by implementing SGA

and the proposed GE are given in the Table 3.7.

Table 3.7 Performance comparison for fixed number of generations

Exec No.

GA with BinaryEncoding

GA with GrayEncoding

Profit Profit

1 147578 147612

2 147621 147678

3 147632 147712

4 147612 147632

5 147599 147621

6 147637 147638

7 147647 147683

8 147682 147683

Page 22: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

62

Table 3.7 (Continued)

Exec No.GA with Binary

EncodingGA with Gray

Encoding

Profit Profit

9 147641 147654

10 147634 147653

11 147656 147673

12 147634 147648

13 147634 147644

14 147656 147660

15 147632 147652

Figure 3.9 shows the profit obtained by both the algorithms for 15

executions with fixed number of generations. In each execution the

algorithms are allowed to run for 25 generations and the profit obtain are

noted. The analysis shows that proposed method produces more profit than

SGA.

Figure 3.9 Profit obtained in fixed number of generations

Page 23: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

63

3.6.2 Variable number of Generations

With the optimal parameter set, several executions were made and

the optimal profit obtained in each execution are noted and mentioned in the

Table 3.8.

Figure 3.10 and 3.11 shows the profit and convergence obtained by

both the algorithms with optimal parameter values for variable number of

generations.

Table 3.8 Performance comparison for variable number of generations

Exec No.GA with Binary Encoding GA with Gray Encoding

Gens. Profit Gens. Profit1 28 147981 26 148021

2 29 147882 25 148034

3 30 147990 27 1480984 28 148002 26 1480565 27 148079 25 1480806 28 148023 24 1480457 31 148052 25 1480648 30 148035 23 1480899 28 148098 26 14810810 29 148103 27 14811211 30 148089 26 14812412 28 148023 26 14807813 29 148078 27 14808914 30 148082 26 14809815 31 148097 25 148132

Page 24: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

64

Figure 3.10 Profit obtained in variable number of generations

Figure 3.11 Convergence obtained in variable number of generations

From the experiments it is observed that when gray coding is used

in GA performs better when compared to SGA.

Page 25: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

65

3.7 PERFORMANCE COMPARISON

Based on the computational results, the optimal values identifiedare

No of Individuals : 200

Selection Mechanism : Tournament Selection

Mutation Type : Flip bit Mutation

Mutation Rate : 0.20

The profit and the convergence velocity are noted by implementing

both the algorithms with the identified optimal values in single execution. The

values are analysed by conducting the experiments with fixed number of

generations and variable number of generations.

The performance of these approaches is measured using the

Percentage Deviation (PD) (Varnamkhasti & Lee 2012) between the results

obtained by Standard Genetic Algorithm and our proposed method Gray

Coding Genetic Algorithm. That is,

100i i

i

S PPD

S

where Si is the profit obtained by Standard Genetic Algorithm and Pi is the

profit obtained by proposed tuning method.

Figure 3.12 shows the profit obtained in fixed number of

generations.

Page 26: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

66

Figure 3.12 Profit obtained in fixed number of generations

Figure 3.13 Profit and convergence velocity obtained in variablenumber of generations

Figure 3.12 and 3.13 illustrates that Genetic Algorithm with gray

coding produces reasonable amount of improvement in profit. Through

variable number of generations GCGA has 7.14% improvement over Genetic

Algorithm with Binary representation.

Page 27: CHAPTER 3 GRAY CODING GENETIC ALGORITHMshodhganga.inflibnet.ac.in/bitstream/10603/38620/8/08...identified in GA using binary coding for real valued optimization problems, a real valued

67

3.8 CONCLUSION

Thus this chapter presented the proposed Genetic Algorithm with

gray representation, its methodology, and the various parameters adopted for

GCGA. The impact of various parameters on GCGA was analyzed in depth

for 0/1 knapsack problem. A detailed comparison of GCGA and SGA has

been made experimentally and concluded that GCGA performs better both in

terms of convergence velocity and profit than SGA in variable number of

generations and in fixed number of generations. GCGA has reasonable

improvement over SGA.