Escolar Documentos
Profissional Documentos
Cultura Documentos
Fuzzy Logic
Introduction
After scientists became disillusioned with
classical and neo-classical attempts at
modeling intelligence, they looked in other
directions.
Two prominent fields arose, connectionism
(neural networking, parallel processing) and
evolutionary computing.
It is the latter that this essay deals with -
genetic algorithms and genetic programming.
What is GA
A genetic algorithm (or GA) is a search technique
used in computing to find true or approximate
solutions to optimization and search problems.
Genetic algorithms are categorized as global search
heuristics.
Genetic algorithms are a particular class of
evolutionary algorithms that use techniques inspired
by evolutionary biology such as inheritance,
mutation, selection, and crossover (also called
recombination).
What is GA
Genetic algorithms are implemented as a computer
simulation in which a population of abstract
representations (called chromosomes or the genotype
or the genome) of candidate solutions (called
individuals, creatures, or phenotypes) to an
optimization problem evolves toward better solutions.
initiate &
evaluate
population evaluation
evaluated offspring
deleted
members
discard
Phenotype:
Physical characteristic of the genotype
(smart, beautiful, healthy, etc.)
Genotype and Phenotype
GA Requirements
A typical genetic algorithm requires two things to be defined:
a genetic representation of the solution domain, and
a fitness function to evaluate the solution domain.
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
Checkboard example Contd
Chromosomes represent the way the checkboard is colored.
Chromosomes are not represented by bitstrings but by
bitmatrices
The bits in the bitmatrix can have one of the four values 0,
1, 2 or 3, depending on the color.
Crossing-over involves matrix manipulation instead of
point wise operating.
Crossing-over can be combining the parential matrices in a
horizontal, vertical, triangular or square way.
Mutation remains bitwise changing bits in either one of the
other numbers.
Checkboard example Contd
This problem can be seen as a graph with n nodes
and (n-1) edges, so the fitness f(x) is defined as:
f(x) = 2 (n-1) n
Example
f(x) = {MAX(x2): 0 <= x <= 32 }
Encode Solution: Just use 5 bits (1 or 0).
Generate initial population.
A 0 1 1 0 1
B 1 1 0 0 0
C 0 1 0 0 0
D 1 0 0 1 1
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
Checkboard example Contd
Chromosomes represent the way the checkboard is colored.
Chromosomes are not represented by bitstrings but by
bitmatrices
The bits in the bitmatrix can have one of the four values 0,
1, 2 or 3, depending on the color.
Crossing-over involves matrix manipulation instead of
point wise operating.
Crossing-over can be combining the parential matrices in a
horizontal, vertical, triangular or square way.
Mutation remains bitwise changing bits in either one of the
other numbers.
Checkboard example Contd
This problem can be seen as a graph with n nodes
and (n-1) edges, so the fitness f(x) is defined as:
f(x) = 2 (n-1) n
Checkboard example Contd
Fitnesscurves for different cross-over rules:
Lower-Triangular Crossing Over Square Crossing Over
180 180
170 170
160 160
Fitness
150 150
140 140
130 130
0 100 200 300 400 500 0 200 400 600 800
170 170
160 160
Fitness
150 150
140 140
130 130
0 200 400 600 800 0 500 1000 1500
Generations Generations
Fuzzy Logic
WHERE DID FUZZY LOGIC COME FROM?
DEFINITIONS:
INPUT#1: ("Error", positive (P), zero (Z), negative (N))
INPUT#2: ("Error-dot", positive (P), zero (Z), negative (N))
CONCLUSION: ("Output", Heat (H), No Change (-), Cool (C))
INPUT#1 System Status
Error = Command-Feedback
P=Too cold, Z=Just right, N=Too hot
INPUT#2 System Status
Error-dot = d(Error)/dt
P=Getting hotter Z=Not changing N=Getting colder
OUTPUT Conclusion & System Response
Output H = Call for heating - = Don't change anything C = Call for cooling
Fuzzy Logic
SYSTEM OPERATING RULES
Linguistic rules describing the control system consist of two parts;
an antecedent block (between the IF and THEN) and a consequent
block (following THEN). Depending on the system, it may not be
necessary to evaluate every possible input combination (for 5-by-5
& up matrices) since some may rarely or never occur. By making
this type of evaluation, usually done by an experienced operator,
fewer rules can be evaluated, thus simplifying the processing logic
and perhaps even improving the FL system performance.
.
.
Fuzzy Logic
Figures 3 & 4 - The rule structure.
After transferring the conclusions from the nine rules to the
matrix there is a noticeable symmetry to the matrix. This suggests
(but doesn't guarantee) a reasonably well-behaved (linear)
system. This implementation may prove to be too simplistic for
some control problems, however it does illustrate the process.
Additional degrees of error and error-dot may be included if the
desired system response calls for this. This will increase the
rulebase size and complexity but may also increase the quality of
the control. Figure 4 shows the rule matrix derived from the
previous rules.
Fuzzy Logic
SUMMARY
Linguistic variables are used to represent an FL system's
operating parameters. The rule matrix is a simple graphical
tool for mapping the FL control system rules. It accommodates
two input variables and expresses their logical product (AND)
as one output response variable. To use, define the system
using plain-English rules based upon the inputs, decide
appropriate output response conclusions, and load these into
the rule matrix.
THANK YOU