numerical methods in a.i.: fuzzy logic

35
NUMERICAL METHODS IN A.I.: FUZZY LOGIC By: Hoo Wai Lam WEK070049 Lim Chern Hong WEK070063

Upload: lenka

Post on 23-Feb-2016

67 views

Category:

Documents


0 download

DESCRIPTION

By: Hoo Wai Lam WEK070049 Lim Chern Hong WEK070063. Numerical Methods in A.I.: Fuzzy Logic. Introduction – Fuzzy Logic. Fuzzy Logic is a problem-solving control system methodology that lends itself to implementation in systems - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Numerical Methods in A.I.: Fuzzy Logic

NUMERICAL METHODS IN A.I.:

FUZZY LOGIC

By:Hoo Wai Lam WEK070049Lim Chern Hong WEK070063

Page 2: Numerical Methods in A.I.: Fuzzy Logic

Introduction – Fuzzy Logic Fuzzy Logic is a problem-solving control system

methodology that lends itself to implementation in systems ranging from simple, small, embedded micro-controllers to large,

networked, multi-channel PC or workstation-based data acquisition and control systems.

Provides a simple way to arrive at a definite conclusion based upon vague, ambiguous, imprecise, noisy, or missing input information.

Can be implemented in hardware, software, or a combination of both.

(from: http://www.seattlerobotics.org/Encoder/mar98/fuz/flindex.html)

Page 3: Numerical Methods in A.I.: Fuzzy Logic

Introduction – Fuzzy Logic Fields applying theory of fuzzy sets and fuzzy

logic : taxonomy; topology; linguistics; logic; automata theory;

game theory; pattern recognition; medicine; law; decision support; Information retrieval; etc.

Recent fuzzy machines that have been developed: automatic train control; tunnel digging machinery;

washing machines; rice cookers; vacuum cleaners; air conditioners, etc.

Page 4: Numerical Methods in A.I.: Fuzzy Logic

Introduction – Fuzzy Logic Fuzzy logic makes understanding using knowledge that is

imprecise rather than precise possible. There are many decision-making and problem-solving task which

are too complex to be understood quantitatively

Fuzzy set theory generate decisions by resembling human reasoning in its use of approximate information and uncertainty with the help of natural language processing.

It was specifically designed to mathematically represent uncertainty and vagueness using mathematical approach and dealing with the imprecision intrinsic to many problems by designing formalized fuzzy-logic-based tools.

Page 5: Numerical Methods in A.I.: Fuzzy Logic

Introduction – Fuzzy Logic “As the complexity of a system increases, it

becomes more difficult and eventually impossible to make a precise statement about its behavior, eventually arriving at a point of complexity where the fuzzy logic method born in humans is the only way to get at the problem.”(Originally identified and set forth by Lotfi A. Zadeh, Ph.D., University of California, Berkeley)

http://www.fuzzy-logic.com/

Page 6: Numerical Methods in A.I.: Fuzzy Logic

Literature Review Fuzzy logic, or multi-valued logic, was introduced in

the 1930s by Jan Lukasiewicz, a Polish philosopher.

introduced logic that extended the range of truth values to all real numbers in the interval between 0 and 1, compared to classical logic which operates with only two values: 1 (true) and 0 (false).

This implies an inexact reasoning technique called possibility theory.

For example, the possibility that a man 181 cm tall is really tall might be set to a value of 0.86. It is likely that the man is tall.

Page 7: Numerical Methods in A.I.: Fuzzy Logic

Literature Review In 1965 Lotfi Zadeh, published his

famous paper “Fuzzy sets”.

extended the work on possibility theory into a formal system of mathematical logic

introduced fuzzy logic to represent and manipulate fuzzy terms by applying natural language.

Page 8: Numerical Methods in A.I.: Fuzzy Logic

Literature Review The term fuzzy logic is used in two senses:

Narrow sense○ Fuzzy logic is a branch of fuzzy set theory, which

deals with the representation and inference from knowledge.

○ Unlike other logical systems, it deals with imprecise or uncertain knowledge.

Broad Sense: ○ fuzzy logic is synonymous to fuzzy set theory

Page 9: Numerical Methods in A.I.: Fuzzy Logic

Literature Review The fuzzy logic analysis and control method:

First Step:○ Receive inputs, measurements or other assessment of conditions

existing in the system we wish to analyze or control.

Second step:○ Processing all inputs according to "If-Then" rules.

Third step:○ Averaging and weighting the resulting outputs into one output decision

or signal which decides what to do or tells a controlled system what to do.

(Modified from www.fuzzy-logic.com)

Page 10: Numerical Methods in A.I.: Fuzzy Logic

Literature Review

(Modified from www.fuzzy-logic.com)

Page 11: Numerical Methods in A.I.: Fuzzy Logic

Presentation of Core Idea

Page 12: Numerical Methods in A.I.: Fuzzy Logic

Why Fuzzy Logic? Robust – It does not require precise,

noise free inputs Can be tweaked easily to improve or

drastically alter system performance. Not limited to a few inputs and one or

two control outputs FL can control nonlinear systems

Page 13: Numerical Methods in A.I.: Fuzzy Logic

How is FL used?1. Define the control objectives and criteria2. Determine the input and output3. Using the rule-based structure of FL, break the

control problem down into series of IF X AND Y THEN Z rules.

4. Create FL membership functions that define the meaning (value) of Input / Output terms use in the rules.

5. Create the necessary pre- and post- processing6. Test the system, evaluate the result.

Page 14: Numerical Methods in A.I.: Fuzzy Logic

Fuzzy logic is not logic that is fuzzy, but logic that is used to describe fuzziness. Fuzzy logic is the theory of fuzzy sets, sets that calibrate vagueness.

Fuzzy logic is based on the idea that all things admit of degrees. Temperature, height, speed, distance, beauty – all come on a sliding scale.The motor is running really hot.Tom is a very tall guy.

Page 15: Numerical Methods in A.I.: Fuzzy Logic

Mathematics Part in Fuzzy Logic

Will use logic function (e.g. AND OR function and truth values)

Set Matrices Mathematical graphical representation Mathematical Inferencing Methods (e.g.

MAX-MIN, MAX-DOT, MAX-PRODUCT, AVERAGING, ROOT-SUM-SQUARE)

Page 16: Numerical Methods in A.I.: Fuzzy Logic

ExampleStep1 :Define the control objectives and criteria

Following questions will help you to make to achieve the goal of this steps.

1) What am I trying to control?2) What do I have to do to control the system? 3) What kind of response do I need? 4) What are the possible (probable) system

failure modes?

Page 17: Numerical Methods in A.I.: Fuzzy Logic

ExampleStep1: Define the control objectives and criteria

A temperature controller with an electric heating element and a variable-speed cooling fan

Page 18: Numerical Methods in A.I.: Fuzzy Logic

ExampleStep1 :Define the control objectives and criteria

1) What am I trying to control? Temperature2) What do I have to do to control the system? To

determine the command (target) temperature and room temperature. Find the error and error dot for FL engine.

3) What kind of response do I need? To Heat / To cool / No change to the system

4) What are the possible (probable) system failure modes?

Page 19: Numerical Methods in A.I.: Fuzzy Logic

ExampleStep2: Determine the input and output

For this example, we are going to use error and error dot as our input for the FL engine to do decision.

Input1: Error = the value of cmd – temp (e.g 10°C - 15°C = -5°C) Input2: Error dot = rate-of-change-of-error

Error: + = too cold- = too hot

Error dot:+ = getting hotter- = getting cooler

Page 20: Numerical Methods in A.I.: Fuzzy Logic

ExampleStep2: Determine the input and output

For this example, we can use: "N" = "negative" error or error-dot input level "Z" = "zero" error or error-dot input level "P" = "positive" error or error-dot input level And output: "H" = "Heat" output response “NC" = "No Change" to current output "C" = "Cool" output response

Page 21: Numerical Methods in A.I.: Fuzzy Logic

ExampleStep2: Determine the input and output

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 (NC), Cool (C))

INPUT#1 System Status Error = Command temp-Feedback temp P=Too cold (+), Z=Just right(0), N=Too hot(-)

INPUT#2 System Status Error-dot = d(Error)/dt P=Getting hotter(+) Z=Not changing(0) N=Getting colder(-)

OUTPUT Conclusion & System Response Output H = Call for heating NC = Don't change anything C = Call for cooling

Page 22: Numerical Methods in A.I.: Fuzzy Logic

ExampleStep3: Using the rule-based structure of FL, break the control problem

down into series of IF X AND Y THEN Z rules.

terms like "IF (process is too cool) AND (process is getting colder) THEN (add heat to the process)" or "IF (process is too hot) AND (process is heating rapidly) THEN (cool the process quickly)"

Page 23: Numerical Methods in A.I.: Fuzzy Logic

ExampleMake it to 3X3 Matrices Form

Page 24: Numerical Methods in A.I.: Fuzzy Logic

ExampleFor step 4-6….

4. Create FL membership functions that define the meaning (value) of Input / Output terms use in the rules.

5. Create the necessary pre- and post- processing

6. Test the system, evaluate the result.

Page 25: Numerical Methods in A.I.: Fuzzy Logic

Coming Soon !!!

Page 26: Numerical Methods in A.I.: Fuzzy Logic

Exercise Building a fuzzy logic speed control system:

Parts needed:○ (1) IBM or compatible personal computer equipped

to run Microsoft Quick BASIC.   IBM is a registered trademark of IBM Corporation.   Microsoft and Quick BASIC are registered trademarks of Microsoft, Inc.

○ (2) Controller.○ (3) Signal conditioner (transistor amplifier to adjust

levels as needed).○ (4) Transistor - 2N3053.○ (5) DC motor, 1.5 V to 3.0 V, 100 ma., 1100 Rpm to

3300 Rpm, and compatible generator.(Adopted from www.fuzzy-logic.com)

Page 27: Numerical Methods in A.I.: Fuzzy Logic

Exercise

Page 28: Numerical Methods in A.I.: Fuzzy Logic

Exercise Step 1: Determine the control system

input.   Examples:   The temperature is the input for

your home air conditioner control system.   Speed of the car is the input for your cruise control.

In our case, input is the speed in rpm of the DC motor, for which we are going to regulate the speed.

Page 29: Numerical Methods in A.I.: Fuzzy Logic

Exercise Step 2: Determine the control system output.

  For a home air conditioner, the output is the

opening and closing of the switch that turns the fan and compressor on and off.   For a car's cruise control, the output is the adjustment of the throttle that causes the car to return to the target speed.

In our case, we have just one control output.   This is the voltage connected to the input of the transistor controlling the motor.

Page 30: Numerical Methods in A.I.: Fuzzy Logic

Exercise Step 3: Determine the target set point

valuefor example 70 degrees F for your home

temperature, or 60 Miles per hour for your car.

In our case, the target set point is 2,420 Rpm.

Page 31: Numerical Methods in A.I.: Fuzzy Logic

Exercise Step 4: Choose word descriptions for

the status of input and output.For a steam engine project, example

input:○ Positive Big

Positive MediumPositive SmallAlmost No ErrorNegative SmallNegative MediumNegative Big

Page 32: Numerical Methods in A.I.: Fuzzy Logic

Exercise In our cases, the input can be:

DescriptionsToo slow

About rightToo fast

And, for output:Speed up

Not much change neededSlow down

Page 33: Numerical Methods in A.I.: Fuzzy Logic

Exercise The rules will be:

Rule 1:○ If the motor is running too slow, then speed

it up.

Rule 2:○ If motor speed is about right, then not much

change is needed.

Rule 3:○ If motor speed is to fast, then slow it down.

Page 34: Numerical Methods in A.I.: Fuzzy Logic

Exercise Step 5: Associate the above inputs and outputs as

causes and effect with a Rules Chart

Step 6: Derive results in the following regarding voltage to the speed controller

Step 7: Determine the output, that is the voltage that will be sent from the controller/signal conditioner/transistor to the speed controlled motor.  

Step 8: The next step is to draw "effect" (output determining) triangles with their height "h" determined by the values obtained in Step 7

Page 35: Numerical Methods in A.I.: Fuzzy Logic

Exercise Derived results (Step 6):

If speed is about right then not much change needed in voltage to the speed controller.

If speed is too slow then increase voltage to the speed controller to speed up.

If speed is too fast then decrease voltage to the speed controller to slow down.