8 views

Uploaded by Muni Ravi Teja

genetic algorithm made easy

- Optimization of Control Strategies VERSI - (Jos_351 Luis)
- ga-pso
- sd
- Genetic Algorithms
- Optimizing Search Space of Othello Using Hybrid Approach
- A Simulation Study on Some Search Algorithms for Regression Test Case Prioritization (1)
- DE2
- Heuristic Evolution With Genetic Programming for Traveling Thief Problem
- IJETAE_NCCC_0414_10
- kf_glas00
- 13 Genetic Algorithm
- appGeneticAlgorithmDesignOptimizationActiveVehicleSuspension
- 到场飞机排序及调度问题的Memetic算法.pdf
- 1-s2.0-S0308521X01000257-main
- 50120140505015-2.pdf
- Hyperbolic tangent stretching functions per M. Vinokur JCP 1983
- exp 4 svm
- Particle Swarm Optimization_ Tutorial
- Generating_Floor_Plan_Layouts_with_KDTre.pdf
- Bode Rules

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

- Optimization of Control Strategies VERSI - (Jos_351 Luis)Uploaded byhuydktd
- ga-psoUploaded byAnonymous TxPyX8c
- sdUploaded bydarsalta
- Genetic AlgorithmsUploaded byHimesh Garg
- Optimizing Search Space of Othello Using Hybrid ApproachUploaded byChetan Chudasama
- A Simulation Study on Some Search Algorithms for Regression Test Case Prioritization (1)Uploaded byAbdirahman A. Osman
- DE2Uploaded byshibajdv
- Heuristic Evolution With Genetic Programming for Traveling Thief ProblemUploaded byCao Quyen
- IJETAE_NCCC_0414_10Uploaded byAadhil Basha
- kf_glas00Uploaded byParameswararao Billa
- 13 Genetic AlgorithmUploaded byneko_lavigne
- appGeneticAlgorithmDesignOptimizationActiveVehicleSuspensionUploaded byArjun Shende
- 到场飞机排序及调度问题的Memetic算法.pdfUploaded bymxwbuaa
- 1-s2.0-S0308521X01000257-mainUploaded byspuzzar
- 50120140505015-2.pdfUploaded byIAEME Publication
- Hyperbolic tangent stretching functions per M. Vinokur JCP 1983Uploaded byRhysU
- exp 4 svmUploaded bydaksh
- Particle Swarm Optimization_ TutorialUploaded byBiswajit Debnath
- Generating_Floor_Plan_Layouts_with_KDTre.pdfUploaded byGuilherme Rabelo
- Bode RulesUploaded byPrateek Goyal
- Particle Swarm Optimization Framework for Low Power Testing of VLSI CircuitsUploaded byAdam Hansen
- 17Uploaded byMike
- AvnerFriedman InterviewUploaded byTeferi
- 0478_w15_ms_21Uploaded byZanfalawy Basha
- 10.1.1.94Uploaded bychettyravi
- Improvement by Genetic Algorithm in Finding the Optimum Surface Finish When End Milling Ti64 using SNTR coated toolsUploaded byangga2005
- FracUploaded byali
- 947961Uploaded bykrogam
- P-delta only staad command described on it's site.Uploaded byshahkaushal04
- Local Search (Littman Fall)Uploaded byPragyanand Tiwari

- 5 Shaft Bearings.docxUploaded bybadppl
- Analysis Pressure Build Up and DrawdownUploaded byUzumaki28
- PhD_Dissertation1.pdfUploaded bymoomeejee
- Cat D6RUploaded byRohman
- Fidic White Book Free Download PDFUploaded byPamela
- Elster As300p Profiles 2011 02 Smart MeteringUploaded bynscac
- Sjzl20072649-NetNumen M32 (V1[1].00) Operation Manual (Configuration Management)Uploaded bySyed Tassadaq
- Working Memory(Baddely and Hitch, 1974)Uploaded byapi-22099612
- MRU Sensor Serie MurataUploaded bymarcello
- L. Sinclair Instructional Design Key AssessmentUploaded byllsinclair
- Transformative Generative GrammarUploaded byEchoing Memories
- Clewley, D. Et Al. a Python-based Open Source for Geographic Object-based Image Analysis (GEOBIA) Utilizing Raster Atribute TablesUploaded byJorge Marques
- SAMSUNG KS3A CHASSIS CI593CN8XXEU TV SMUploaded byPOLAKU2002
- Case Study - Seismic Analysis of Dubai Metro Rail ViaductUploaded byManuel Antunes Luis
- Micom p40ManualUploaded bykjfens
- The Little Designer eBook by Nestor Yan LLanosUploaded byAnne Lyon
- Measured In Situ Stresses and Depth.pdfUploaded byIrvani Fachruddin
- GeloUploaded byhellototheworld
- Understanding Your Camera’s Hyperfocal Distance.pdfUploaded byManrico Montero Calzadiaz
- previsious year question paperUploaded byshivachandrah
- Lesson TemplateUploaded byTenisha Knowles
- Hayes2008-00.pdfUploaded by玄同緒雲
- sixpoint lesson plan for kindergarten common coreUploaded byapi-263255176
- kull.pdfUploaded byneuralterapianet
- THEORY OF CODESUploaded byWayan Bentar
- SyllabusUploaded byLenin Gnanes
- Expert System Voice AssistantUploaded byChitransh Surheley
- Desision Making ToolsUploaded byJen Lindugan
- Tm 9-2350-238-34-1 Recovery Vehicle, Full-tracked Light, Armored, m578Uploaded byAUGieDogie1
- NormeUploaded byAndreea Anca Bordea