24
Optimization Electrical Circuit’s Parameter Using Genetic Algorithms (GAs) PANG LU SHIN This report is submitted in partial fulfillment of requirements for the award of Bachelor of Electronic Engineering (Computer Engineering) With Honours Faculty of Electronic and Computer Engineering Universiti Teknikal Malaysia Melaka April 2009

Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

Embed Size (px)

Citation preview

Page 1: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

Optimization Electrical Circuit’s

Parameter Using Genetic Algorithms (GAs)

PANG LU SHIN

This report is submitted in partial fulfillment of requirements for the award of

Bachelor of Electronic Engineering (Computer Engineering) With Honours

Faculty of Electronic and Computer Engineering

Universiti Teknikal Malaysia Melaka

April 2009

Page 2: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

UNIVERSTI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER

BORANG PENGESAHAN STATUS LAPORAN

PROJEK SARJANA MUDA II

Tajuk Projek : Optimization Electrical Circuit’s Parameter Using Genetic

Algorithms (GAs) Sesi

Pengajian : 2008/2009

Saya …………………………………………………..……………………………………………..

(HURUF BESAR)

mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-

syarat kegunaan seperti berikut:

1. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.

2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja.

3. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi

pengajian tinggi.

4. Sila tandakan ( � ) :

SULIT*

(Mengandungi maklumat yang berdarjah keselamatan atau

kepentingan Malaysia seperti yang termaktub di dalam AKTA

RAHSIA RASMI 1972)

TERHAD*

(Mengandungi maklumat terhad yang telah ditentukan oleh

organisasi/badan di mana penyelidikan dijalankan)

TIDAK TERHAD

Disahkan oleh:

__________________________ ___________________________________

(TANDATANGAN PENULIS) (COP DAN TANDATANGAN PENYELIA)

Alamat Tetap: 108-A, Jalan Pee Kang Hai,

Kampung Abdullah,

85000 Segamat,

Johor.

Tarikh: ……………………….. Tarikh: ………………………..

PANG LU SHIN

Page 3: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

“I hereby declare that this report is the result of my own work except for quotes as

sited in the references.”

Signature : ……………………………………………

Author : Pang Lu Shin

Date : ……………………………………………

Page 4: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

iii

“I hereby declare that this report is the result of my own work except for quotes as

cited in the references.”

Signature : ………………………………………

Author : Pang Lu Shin

Date : ………………………………………

Page 5: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

iv

“I hereby declare that I have read this report and in my opinion this report is

sufficient in terms of the scope and quality for the award of Bachelor of Electronic

Engineering (Computer Engineering) With Honours.”

Signature : ………………………………………

Supervisor’s Name : Mdm. Wong Yan Chiew

Date : ………………………………………

Page 6: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

v

To my beloved family and friends

Page 7: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

vi

ACKNOWLEDGEMENT

I would like to express my gratitude to all those who gave me the possibility

to complete this project. First of all, I would like to take this opportunity to express

my deepest gratitude to my supervisor of this project, Mdm. Wong Yan Chiew who

has relentlessly and tirelessly assisted me in completing this project. She has give me

support and insight in doing this project and has patiently listened and guided. My

utmost thanks also go to my family who has given me support throughout my

academic years. It is to advantage that I have received help and support from friends

and staff in the faculty labs. I want to thank them for all their help, support, interest

and valuable hints. It is of my greatest thanks and joy that I have met with this people.

Thank you.

Page 8: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

vii

ABSTRACT

Genetic algorithms (GAs) for automation design of analog circuits are

proposed in this project. It is used to solve complex and considerable constrained

combinatorial optimization problems that one generally encounters in designing

electrical circuits. For the large-scale circuits, the key problems of circuit design are

its large amount of calculating operations and the chance of falling into local optimal

point. During the optimization, it is often needed to adjust several circuit elements

simultaneously. Those parameters will have the significant effect to the circuit

performance. The search space is therefore very large, and genetic algorithms have

been used with success to optimize such circuit parameters. In this project, the

artificial intelligence GAs is proposed to order to generate evolutionary analog

circuit designs. The results show that the appropriate combination of circuit

components e.g. inductor and resistor are selected by the proposed GAs is able to

meet the desired design specification of the circuit. Finally, the simulation result is

compared and validated with the manual hand calculation result.

Page 9: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

viii

ABSTRAK

Algorithma genetik (GAs) untuk automasi rekabentuk litar analog telah

dicadangkan dalam projek ini. Ia digunakan untuk menyelesaikan masalah yang

kompleks dan melibatkan pertimbangan sekatan cabang optimasi yang selalunya

berlaku dalam isu mereka bentuk litar elektrik. Untuk litar yang mempunyai skala

yang besar, masalah yang paling ketara dalam isu mereka bentuk litar adalah operasi

pengiraan yang banyak dan peluang untuk mencapai local titik optimum. Semasa

optimasi dijalankan, ia sering diperlukan untuk mengubah beberapa element litar

dengan serentak. Parameter tersebut mempunyai kesan yang bererti kepada preatasi

litar. Oleh sebab itu, pencarian ruang adalah sangat luas dan algorithma genetik telah

digunakan dengan berjayanya untuk mengoptimasikan parameter litar tersebut.

Dalam projek ini, kecerdasan buatan GAs telah dicadangkan untuk menghasilkan

perkembangan reka bentuk litar analog. Keputusan telah menunjukkan combinasi

komponen litar yang sesuai contohnya induktor dan perintang telah dipilih oleh GAs

adalah berupaya memenuhi spesifikasi reka bentuk litar yang telah disediakan.

Akhirnya, keputusan simulasi telah dibanding dan dibuktikan dengan keputusan

pengiraan tangan.

Page 10: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

ix

CONTENTS

CHAPTER SUBJECT PAGE

TITLE i

REPORT STATUS VERIFICATION FORM ii

DECLARATION iii

SUPERVISOR VERIFICATION iv

DEDICATION v

ACKNOWLEDGEMENTS vi

ABSTRACT vii

ABSTRAK viii

CONTENTS ix

LIST OF TABLES xii

LIST OF FIGURES xiii

LIST OF SHORT FORM xv

LIST OF APPENDIX xvi

I INTRODUCTION 1

1.1 Chapter Overview 1

1.2 Introduction of Project 1

1.3 Objectives 2

1.4 Scope of Project 3

1.5 Problem Statement 3

1.6 Methodology 3

1.7 Thesis Outline 4

1.8 Conclusion 5

Page 11: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

x

II LITERATURE REVIEW 6

2.1 Chapter Overview 6

2.2 Genetic Algorithms 6

2.3 Operations of Genetic Algorithms 7

2.3.1 Chromosome 8

2.3.2 Reproduction 9

2.3.3 Crossover 9

2.3.4 Mutation 10

2.3.5 Fitness Function 10

2.4 Pros and Cons of Genetic Algorithms 11

2.5 Others related optimization techniques 12

2.5.1 Ant Colony Optimization 12

2.5.2 Evolutionary programming (EP) 12

2.5.3 Simulated annealing (SA) 13

2.5.4 Hill-climbing 13

2.5.5 Tabu Search (TS) 14

2.5.6 Harmonic Search (HS) 14

2.5.7 External optimization (EO) 15

2.6 Simulation environment using genetic

algorithms 15

2.6.1 Visual Basic 15

2.6.2 MATrix LABoratory (MATLAB) 16

2.6.3 Genetic Algorithms Toolbox 18

2.7 Graphical User Interface (GUI) 20

2.7.1 Matlab GUI compare with others 20

2.7.2 Disadvantages of GUI 20

2.8 Optimization of Electrical Circuits 21

2.8.1 Rectifier 21

2.8.2 Operational Amplifier 22

2.9 Conclusion 23

III METHODOLOGY 24

Page 12: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

xi

3.1 Chapter Overview 24

3.2 Project Flow 25

3.3 Project Methodology 26

3.4 Program Flow 27

3.5 Program Development by using MATLAB 28

3.6 Conclusion 31

IV RESULT AND DISCUSSION 32

4.1 Chapter Overview 32

4.2 Optimization of Half-wave Rectifier 32

4.3 Simulation Result of Half-wave Rectifier 35

4.4 Half-wave Rectifier with Additional Element 42

4.5 Band Pass Filter Using Op-Amp 49

4.6 Discussion 53

4.7 Conclusion 54

V CONCLUSION AND SUGGESTION 55

4.1 Chapter Overview 55

4.2 Conclusion 55

4.3 Recommendation for Future Work 56

REFERENCES 57

APPENDIX 59

Page 13: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

xii

LIST OF TABLES

NO TITLE PAGE

2.1 Standard algorithm options in Genetic Algorithm and

Direct Search Toolbox

19

4.1 The calculated maximum power for half-wave rectifier 41

4.2 The calculated maximum power for half-wave rectifier

with additional capacitor

48

4.3 The comparison between the simulation result and the

manual hand calculation result

52

Page 14: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

xiii

LIST OF FIGURES

NO TITLE PAGE

2.1 Standard procedures of GA operations from one generation

to the next.

8

2.2 Single point crossover 9

2.3 Example of mutation process 10

3.1 Flow chart for project planning 26

3.2 Monitoring program flow chart 28

3.3 Steps of launch the gatool from the MATLAB Start menu 29

3.4 Genetic Algorithm Tool is a graphical user interface in

MATLAB

30

4.1 Passive filter circuit topology for half-wave rectifier 34

4.2 GUI for generating the half-wave rectifier variables. 36

4.3 Fitness value versus generation plot for the half-wave

rectifier

37

4.4 The plot of best individual, distance, score diversity and

selection for the half-wave rectifier

38

4.5 The message box to export the GAs result to the workspace 38

4.6 The garesults exported to the workspace 39

4.7 The gaproblem exported to the workspace 39

4.8 The gaoptions exported to the workspace 40

4.9 GUI for generating the half-wave rectifier with additional of

capacitor.

42

4.10 Fitness value versus generation plot for the half-wave

rectifier with additional of capacitor

43

Page 15: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

xiv

4.11 The plot of best individual and expectation for the half-wave

rectifier with additional of capacitor connected in series

44

4.12 The plot of range and stopping criterion for the half-wave

rectifier with additional of capacitor connected in series

45

4.13 The garesults exported to the workspace 45

4.14 The gaproblem exported to the workspace 46

4.15 The gaoptions exported to the workspace 47

4.16 Band pass Circuit using active element (Op-amp) 49

4.17 GUI for optimizing band pass filter to get the wider

bandwidth and higher gain

51

Page 16: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

xv

LIST OF SYMBOL

AC - Alternating Current

ACO - Ant colony optimization algorithm

DC - Direct Current

EO - External optimization

EP - Evolutionary programming

GAs - Genetic Algorithms

GUI - Graphical User Interface

HS - Harmonic Search

MATLAB - Matrix Labroratory

SA - Simulated annealing

TS - Tabu Search

VB - Visual Basic

Page 17: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

xvi

LIST OF APPENDIX

NO TITLE PAGE

A Matlab Source Code 59

B Technical Paper 63

C Genetic Algorithms Guideline 70

Page 18: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

CHAPTER I

INTRODUCTION

1.1 Chapter Overview

The introduction of the project, objectives and the scope of project is briefly

discussed in this chapter. After that, the implementation of the project is introduced

by a methodology and lastly the contents of Chapter 1 until Chapter 5 is highlighted

in thesis outline.

1.2 Introduction of Project

Nowadays, circuit design is the basis of implementing any electronic system,

and its object is to make the designed system having optimal performance and

reliability. Therefore, the important of the optimization of the circuit is to find the

maximum or minimum value of an objective with various limitations. There are

some difficulties in conducting the optimization for electrical circuit such as taking

considerable amount of the trial and error testing to determine the circuit’s parameter

value.

Conventional design approaches produce circuits in which the designed

component values are assumed to be ideal with unrestricted values. It may be

required to repeat the design with a more stringent specification or to use a more

Page 19: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

2

closely spaced set of acceptable values. However, a better circuit performance may

potentially be achieved than that obtained by conventional method if other

combinations of acceptable values are considered. Eventually, the difficulty is that

the search space of all feasible combinations is too huge. In addition, circuit

specifications are usually identified in terms of acceptability regions with upper and

lower bounds rather than specific values. It is useful to define an estimation of the

feasible region as the set of parameter values for which the design specifications are

satisfied when designing a circuit according to certain specifications.

Hence, the genetic algorithm is proposed to define appropriate parameters

values to meet the desired circuit performance with its ability of parallel searching

through the entire solution space. In GAs implementation, the estimation of the

feasible region plays an important role in the determination of the solution space

volume to be searched. A search over the feasible region estimate will greatly

decrease the time needed to cover all possible solutions of a problem using GAs. The

proposed GAs is realized by computer program, which can provide a simplified

design procedure. Furthermore, the advantage of GAs program is the capable to find

a set of optimal solution for the complex and complicated electrical circuit instead of

reduce the conventional design time of the circuit.

However, there is some issue that genetic algorithms need to take in

consideration such as the fitness function has been created is compatible so that

higher fitness is achieved and result in a better solution for the given circuit.

1.3 Objectives

The main objective of the project is to build an Artificial Intelligent (AI)

algorithm which can engage on behaviors that humans intelligent in electronic

circuits. Another purpose of this project is to develop an algorithm for finding the

optimization electrical circuit’s parameters. Besides that, the characteristics of

various kinds of electrical circuits can be defined in the process to determine the

optimization electrical circuit’s parameters.

Page 20: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

3

1.4 Scope of Project

The scope of this project is focusing on utilization of genetic algorithms in

solving various circuit optimizations with pre-defined constraints in electrical circuit.

The project will be implemented by an attractive and easy way for accessing and

learning tool which is Matrix Laboratory (MATLAB). This project is managing the

optimization, monitoring performance, and defining stopping criteria for the

electrical circuit. Several types of electrical circuit will be designed by using

MATLAB M-file. It will be implemented to let the user quickly define their problem

and set a variety of algorithm options to fine-tune the optimization.

1.5 Problem Statement

Genetic Algorithms were developed over twenty-five years ago, but there is

not so much research and experimental work has been down to ascertain their

capabilities in solving complex and considerable constrained combinatorial

optimization problems that one generally encounters in designing electrical circuits.

Hence, an optimization electrical circuit’s parameter using genetic algorithms was

proposed to speed up or eliminate a considerable amount of the trial and error testing

being done by designers today. This project has emphasize genetic algorithms may

be a better alternative for global optimization tools for these electrical circuits.

1.6 Methodology

The methodology of the project is starting with choosing the simulation’s

environment used in developing an optimization electrical circuit’s parameter using

genetic algorithms. As a result, MATLAB has been chosen to develop the algorithms

environment. The advance tools provides in the MATLAB able to support and

provide comprehensive information in implementing the genetic operators such as

crossover, mutation and selection.

Page 21: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

4

The next step is to characterize and define the electrical circuits which need

to optimize. After that, a program is created where the defined fitness function

(inputs of the function which want to minimize maximize or optimize) is used to

generate a set of variables and output the desired circuit performance. The program is

written in MATLAB's editor because of its advance tools and options provided in the

GAs toolbox and easiest to use compare with others.

After developed the algorithms, then it will apply to a graphical user interface

(GUI) of GA tools in MATLAB which has provide an approach to let the user

quickly define their problem and set a variety of algorithm options to fine-tune the

optimization.

1.7 Thesis Outline

This thesis is a document that delivers the idea generated, concepts applied,

activities done in optimization electrical circuit’s parameter using genetic algorithms

and the final year project produced. It consists of five chapters which are

Introduction, Literature Review, Methodology, Result and Discussion, Conclusion

and Recommendation.

Chapter 1 is delivering the introduction of the project. It consists of objective,

problem statement, scope of project, methodology and thesis outline of this project.

Chapter 2 is discussing the literature review of this project. The features and

behavior of genetic algorithms are studied.

Chapter 3 is briefly described the project flow and the functional of genetic

algorithms. It also covered the methods used in this project and the reason of

choosing these methods.

Chapter 4 is deals with the analysis of result at the final stage which is

complete designed the interface of optimization electrical circuit parameter by using

Page 22: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

5

genetic algorithms. The result and discussion on writing an algorithm in MATLAB

will be presented in this chapter.

Chapter 5 is described the conclusion and result of the project at the final

stage. The recommendation and future development of this project is discussed in

order to upgrade and enhance the optimization electrical circuit’s parameter using

genetic algorithms (GAs).

1.8 Conclusion

As a conclusion, the details of introduction of the project in this chapter are

briefly described. Besides that, the objective of this project has been classified. The

problem statement has defined the optimization problem facing by the user. In

additional, the scope of the project is clearly defined. Finally, there is a brief

description of literature review which will be presented in detail in Chapter II.

Page 23: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

CHAPTER II

LITERATURE REVIEW

2.1 Chapter Overview

Genetic algorithms and its behaviors in finding the optimization electrical

circuit’s parameters are explained in this chapter. Besides, some theories and

concepts of genetic algorithms are presented in this chapter. Others related

optimization techniques and the simulation environment of GAs will also be

discussed in this chapter as well.

2.2 Genetic Algorithms

The GAs is a search mechanism based on the principle of natural selection

and population genetics. On the others hands, it can also defined as adaptive

algorithms for finding the global optimum solution for an optimization problem.

The primary framework of GAs was first proposed by Dr. J. Holland in 1975 [1].

The continuing performance improvement of computational systems has made them

attractive for some types of optimization [2]. In particular, genetic algorithms work

very well on mixed (continuous and discrete), combinatorial problems. A solution

must be represented to the problem as a genome (or chromosome) in order to use a

genetic algorithm. The genetic algorithm then creates a population of solutions and

Page 24: Optimization Electrical Circuit’s Parameter Using Genetic ...eprints.utem.edu.my/6100/1/Optimization_Electrical_Circuit's... · mengaku membenarkan Laporan Projek Sarjana Muda ini

7

applies genetic operators such as mutation and crossover to evolve the solutions in

order to find the optimal solution.

2.3 Operation of Genetic Algorithms

A simple GAs is described in this section. While more sophisticated forms of

the GAs exist, they are all extensions of this basic algorithm. The simple GAs

provides excellent performance for a wide range of problems [7].

It begins with the creation of an initial random population of individuals. The

size of the population depends on the nature of problem, but typically contains

several hundred or thousands of possible solutions [8]. Values of several hundred are

commonly used. Traditionally, the population is generated randomly, covering the

entire range of possible solutions or the search space. The next step is to evaluate the

fitness of each individual according to the predefined criteria.

After the evaluation, the individuals are ranked according to their fitness.

Individuals are selected for mating based on fitness. Fitter individuals have a higher

probability of mating and passing on genetic information to subsequent generations

while less fit individuals have a non-zero probability of mating to preserve diversity

[11]. Mating is simulated by applying the crossover operation to the chromosomes

of two individuals selected based their fitness.

Mutation is simulated by randomly changing a few bits in the chromosome

of the offspring [12]. Mutation provides a mechanism for exploring new regions of

the solution space and prevents premature convergence to local minima. Finally, the

fitness of the new generation is evaluated and the process is repeated for a specified

number of generations or until a desired fitness is attained.