8 views

Uploaded by Muni Ravi Teja

genetic algorithm made easy

- studwall_ga_optim
- Evaluation of Reliability Indices in Restructured Power Systems Using Genetic Algorithm
- Direction Finding Using 3d Array Geometry
- Genetic Algorithms
- 15 Paper 12110919 IJCSIS Camera Ready Pp093-100
- IJAIEM-2014-08-01-102
- Stewart 2004
- RPH week 10
- Using Genetic Algorithm to Do Quality Control
- GENETIC ALGORITHM FOR TESTING WEB APPLICATIONS
- Amortized Splay Trees
- Discrete Particle Swarm Optimization Algorithm Used for TNEP Considering Network Adequacy Restriction
- 54941
- folio final 7
- 10.1.1.61
- Estimation Method for Media Audience Duplication - IBOPE Time Chile
- Gion Proyecto Ingles
- Lecture__8
- AL Applied Mathematics 1986 Paper 2
- Functional Dependency

You are on page 1of 20

Study of Matlab

Dr. Somnath Pan

Study of

MATLAB

CONTENT

DC motor armature

control..1-4

Introduction to Genetic

Algorithm4-8

Study of Genetic Algorithm using

MATLAB...9-18

Simulation of DC motor could be simply done in MATLAB. The electrical

and mechanical circuit parameters are fed to the software. Then the transfer

function is written. Once the transfer function is properly written, by using the

syntax, LTIview we could get the graph of the performance of motor. This, we

could simulate the motor on software rather than testing the motor directly with

different parameters for finding desired parameters.

TRANSFER FUNCTION

For controlling the speed of the motor by varying the applied voltage. The

speed vs time graph of feeding the software with a transfer function obtained by

taking the speed as output and applied voltage as input. And the syntax LTIview

is used.

If the change in speed with other variable, the appropriate transfer function

has to be taken with the desired variable as input.

Example:

In this example, Im taking two transfer functions, one with speed as output

and other with position as output, while both of them have applied voltage as input.

>> R=2;

1

>> L=0.5;

>> Fo=0.1;

>> Kb=0.1;

>> Kt=0.2;

>> J=0.02;

>> h=tf(Kt,[L*J (R*J)+(Fo*L) (R*Fo)+(Kt*Kb)

h=

0.2

-----------------------0.01 s^2 + 0.09 s + 0.22

h1 =

0.2

---------------------------0.01 s^3 + 0.09 s^2 + 0.22 s

Continuous-time transfer function.

>> ltiview('step',h,h1)

The blue line in the plot represents the function h(speed as output), while the green line represents the function

h1(position as output).

>> bode(h,h1)

GENETIC ALGORITHM

As early as 1962, John Holland's work on adaptive systems laid the

foundation for later developments.

By the 1975, the publication of the book

Early to mid-1980s, genetic algorithms were being applied to a broad range of

subjects.

In 1992 John Koza has used genetic algorithm to evolve programs to perform

certain tasks. He called his method "genetic programming"(GP).

What is a Genetic Algorithm??

A genetic algorithm (or GA) is a search technique used in computing to find true

or approximate solutions to optimization and search problems.

4

(GA)s are a particular class of evolutionary algorithms that use techniques

inspired by evolutionary biology such as inheritance, mutation, selection, and

crossover (also called recombination).

The evolution usually starts from a population of randomly generated individuals

and happens in generations.

In each generation, the fitness of every individual in the population is evaluated,

multiple individuals are selected from the current population (based on their

fitness), and modified to form a new population.

The new population is used in the next iteration of the algorithm.

The algorithm terminates when either a maximum number of generations has

been produced, or a satisfactory fitness level has been reached for the population.

VOCABULARY

Individual - Any possible solution

Population - Group of all individuals

fitness)

Start with a large population of randomly generated attempted

solutions to a problem

Repeatedly do the following:

Evaluate each of the attempted solutions

(probabilistically) keep a subset of the best solutions

Use these solutions to generate a new population

Quit when you have a satisfactory solution (or you run out of time)

EXAMPLE

Suppose we want to maximize the number of ones in a string of l

binary digits

Is it a trivial problem?

It may seem so because we know the answer in advance

However, we can think of it as maximizing the number of correct answers,

each encoded by 1, to l yes/no difficult questions.

An individual is encoded (naturally) as a string of l binary digits

The fitness f of a candidate solution to the MAXONE problem is the number of

ones in its genetic code

We start with a population of n random strings. Suppose that l = 10 and n = 6.

We toss a fair coin 60 times and get the following initial population:

s1 = 1111010101 f (s1) = 7

s2 = 0111000101 f (s2) = 5

s3 = 1110110101 f (s3) = 7

s4 = 0100010011 f (s4) = 4

s5 = 1110111101 f (s5) = 8

s6 = 0100110000 f (s6) = 3

STEP 1: SELECTION

We randomly (using a biased coin) select a subset of the individuals based on their

fitness:

Suppose that, after performing selection, we get the following population:

s1` = 1111010101 (s1)

s2` = 1110110101 (s3)

s3` = 1110111101 (s5)

6

s5` = 0100010011 (s4)

s6` = 1110111101 (s5)

STEP 2: CROSSOVER

Next we mate strings for crossover. For each couple we first decide (using some

pre-defined probability, for instance 0.6) whether to actually perform the

crossover or not

If we decide to actually perform crossover, we randomly extract the crossover

points, for instance 2 and 5

Crossover result:

Before crossover:

s1` = 1111010101 s2` = 1110110101

After crossover:

s1``= 1110110101 s2`` = 1111010101

STEP 3: MUTATION

The final step is to apply random mutations: for each bit that we are to copy to the

new population we allow a small probability of error (for instance 0.1)

Initial strings

After mutating

s1`` = 1110110101

s1``` = 1110100101

s2`` = 1111010101

s2``` = 1111110100

s3`` = 1110111101

s3``` = 1110101111

s4`` = 0111000101

s4``` = 0111000101

s5`` = 0100011101

s5``` = 0100011101

s6`` = 1110110011

s6``` = 1110110001

In one generation, the total population fitness changed from 34 to 37, thus

improved by ~9%

At this point, we go through the same process all over again, until a stopping

criterion is met

There are many different strategies to select the individuals to be copied over into

the next

Generation

Methods of Selection

1.

2.

3.

4.

5.

Roulette-wheel selection.

Elitist selection.

Fitness-proportionate selection.

Scaling selection.

Rank selection.

Genetic algorithm in

MATLAB

MATLAB has the option of solving problems using different optimization

tools like: bintprog, fgoalattain, fminbnd, fmincon, fminimax, fminsearch,

fminunc, fseminf, fsolve, fzero, and Genetic Algorithm procedures. MATLAB

offers syntaxes as well as tool box for using GA. Every parameter related to the

GA while solving the problem could be set customized, and desired values can be

set. Thought it is well known for its simplicity, GAs can be made even more

effective by and can be made apt for solving various problems by placing suitable

values for parameters like Population, Fitness scaling, Selection, Reproduction,

Mutation, Crossover, Migration, Constraint parameters, Hybrid function, Stopping

criteria, Plot functions, Output function, Display to command window, User

function evaluation.

The

population of

the genetic

algorithm could

be set as desired.

It sould be noted

that high value

of initial

poplation though

helpful for more

accurate

solution, it leads

to too many

calculations. While

low population

leads to very low

accurate solution.

coputer it is not. Because computer runs on progams, it can initialize random

values on its own. Selection option is useful for defining the method by which the

chromozomes for the population should be selected.

10

Sometimes the

fittest solution of

one generation

might be the best solution. By blindly involving it in crossover there may be

wastage of

solution. So to stop

the loss of such

solutions, the

fittest solution in

each generation is

kept aside from crossover. The number of chromosomes that should be spared from

crossover is selected by elite count.

11

12

There are many reason for GA to come to end. We can set few of the

parameters that involve the halting of Genetic Algorithm. We can limit the number

of generations,

time, minimum

fitness required.

plot option. Not just the result but also these parameters are helpful for the analysis

of the result. By observing this data one could get an idea about the status of the

GA and the status

of the result.

13

Examples:

14

For finding the minimum value of a function:

The function should be written in the editor as a function initializing .m file.

The .m file has to be saved in .m files folder, or else the program will not

work.

Open the optimizing toolbox.

Set the solver as genetic algorithm(GA).

The number of variables, lower bound, upper bound have to be

compulsorily filled.

Change other parameters in options if necessary.

And click the start button.

The GA stops and displays the result, when the process comes to a halt.

There could be various reasons for the process to come to a halt.

The value of the function at the result and the reason for the halting of the

process are shown in a dialog.

While the value of the final point comes beneath it.

15

Example:

Feed the software with the function through editor, whose minimum value

has to be identified. Here the function is:

Y = x^2

By setting different values of the GA parameters solution is found out.

16

17

The solution obtained is 0. While the value of the function at final point is

4.33403588142492E-10, and the reason for halting is average change in the fitness

value less than options.

Or the simply the minimum of the function could be found by using the syntax

ga.

Example:

>> [x,fval,exitflag]=ga(@test,1)

Optimization terminated: average change in the fitness value less than

options.TolFun.

x=

0.0122

fval =

1.4972e-04

exitflag =

1

@test is our function. Which should be given through editor.

1 is the number of variables.

x is the indicates the final point.

Fval is the value of the value of function at x.

Exitflag is the reason for the halting of the process.

18

19

- studwall_ga_optimUploaded bymlkn59
- Evaluation of Reliability Indices in Restructured Power Systems Using Genetic AlgorithmUploaded byIRJET Journal
- Direction Finding Using 3d Array GeometryUploaded byMohammed Nawaz Shaik
- Genetic AlgorithmsUploaded byEngr Lala
- 15 Paper 12110919 IJCSIS Camera Ready Pp093-100Uploaded byijcsis
- IJAIEM-2014-08-01-102Uploaded byAnonymous vQrJlEN
- Stewart 2004Uploaded byHanan Mouchtakiri
- RPH week 10Uploaded bynor fazlina
- Using Genetic Algorithm to Do Quality ControlUploaded byAniket Bera
- GENETIC ALGORITHM FOR TESTING WEB APPLICATIONSUploaded byCS & IT
- Amortized Splay TreesUploaded byashodhiya14
- Discrete Particle Swarm Optimization Algorithm Used for TNEP Considering Network Adequacy RestrictionUploaded bywvargas926
- 54941Uploaded bynguyendattdh
- folio final 7Uploaded byapi-298381854
- 10.1.1.61Uploaded byshahuo888
- Estimation Method for Media Audience Duplication - IBOPE Time ChileUploaded byNilmalvila Blue Lilies Pond
- Gion Proyecto InglesUploaded byYojan Trujillo Trujillo
- Lecture__8Uploaded byamargg
- AL Applied Mathematics 1986 Paper 2Uploaded byLokwing Poon
- Functional DependencyUploaded byNaman Verma
- Type-II Fuzzy Logic Controller for TemperatureUploaded byRio Ananda Putra
- Intro AutomataUploaded byPatricia Sacrez
- Economics 1011a Problem 4Uploaded byStefan Spataru
- lab4 277Uploaded byapi-451560413
- Queueing Theory is the Mathematical Study of Waiting LinesUploaded bymusiomi2005
- 3_pandasadvanced.pdfUploaded bycunhafcc
- Algorithms & Flow ChartsUploaded bySaravana Kumar
- ZKP SeminarUploaded byRajesh Kumar
- Erlang Calculator BT v1Uploaded byİbrahim Arslan
- Problem Set 1Uploaded byAnuj Topiwala

- Chapter 4_[Philoid-IN].pdfUploaded byThiagarajan Kuttiannan
- webserziseUploaded byapi-351842392
- Obervation -Teaching and Learning RolesUploaded byLinda Azzopardi
- grade 11- UNIT 12 WritingUploaded byDuyên Nha Trang Võ
- Sidman_1987Uploaded bysiepa
- The Moral Atheist: A response to Rabbi Adam JacobsUploaded byKenneth Michael Montville
- 135980857-prezentare-hipnoza-pptUploaded byLiliana Băjănaru
- brain and behaviorUploaded byapi-268557599
- Whissell, Abramson & Barber 2013 the Search for Cognitive Terminology - An Analysis of Comparative Psychology Journal TitlesUploaded byhoorie
- DPJowett IVUploaded byManticora_SM
- Difficulties in Reportorizing Paul Herscu.pdfUploaded byRamesh Shah
- Ethical LeadershipUploaded bycheshtaa
- Fonetica Fonologie Dima GabrielaUploaded byrewq2001
- Stylistic analysis of .pdfUploaded byM
- CRI Marking CriteriaUploaded byMikeyy Nzuzi
- Agile Project Management and ConstructionUploaded byPeter Saddington
- altus naviance lessonUploaded byapi-371272173
- Antrop Collected Words 5 SapirUploaded byArcheoten.
- Models of Organizational BehaviorUploaded bylibroaklat
- From-Chaos-to-Coherence.pdfUploaded byHenry Bettison
- Every ChildUploaded byrogelyn
- Appraisal Antecedents of Shame and GuiltUploaded bykmurphy
- Grounded Theory WebUploaded byiqra-j
- 40861467 interpretivistUploaded byShazia
- c9484baacb9dd2ba37962a671782c86a (1)Uploaded byVivian Chen
- Most Common Mistakes in English SampleUploaded byFmga Ga
- Module 1 Simple Past and Present TenseUploaded byQuennie
- Dickie - Art and ValueUploaded byMargarita R. Díaz Pérez
- Fifth Generation - Present and Beyond:Artificial Intelligence Advance VersionUploaded byYasir Ahmed
- [Summary] Allport 1968 Six Decades of Social PsychologyUploaded byBogdana Huma