computer science & engineering shiraz university artificial intelligence
TRANSCRIPT
![Page 1: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/1.jpg)
Computer Science & EngineeringShiraz University
Artificial Intelligence
![Page 2: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/2.jpg)
3
65
4
8
1
27 7
32
5
1
4
8
6
Game of 8
Game of 8
• How can we solve Game Of 8 with minimum number of movements?• The answer can be a sequence of movements.
![Page 3: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/3.jpg)
•Program input can be a 3 by 3 Matrix
Input = [[3, 7, 2], [1, 4, 0], [8, 5, 6]]
ظ3
65
4
8
1
27
Game of 8
•Output can be a list representing movements of the empty place
Output = [‘up’, ‘right’, ‘down’, … , ‘left’, ‘up’]
>>> def find_answer(input, target):
“returns a sequence of movements”
Goal = [[7, 8, 0], [4, 5, 6], [1, 2, 3]]
![Page 4: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/4.jpg)
• What is AI ?• Making computers to act Intelligently
• What is Intelligence ? (Russell and Norvig 1995)
– Thinking like humans– Acting like humans
– Thinking rationally– Acting rationally
![Page 5: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/5.jpg)
•What are factors of Intelligence ?• Understanding• Reasoning• Problem Solving• Learning• Common Sense• Generalizing• Inference• Analogy• Recall• Intuition• Emotion• Self-awareness
![Page 6: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/6.jpg)
The Turing Test
Proposed by Alan Turing in 1950 to provide a definition of intelligent behaviour.
– The computer is interrogated by a human via a teletype
– it passes the test if the interrogator cannot identify the answerer was computer or human
![Page 7: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/7.jpg)
The Turing Test Requirements• Natural language processing
– Communicating with human; understanding sentences
• Knowledge representation– Storing facts and information
• Automated reasoning– Concluding new facts using from existing facts
• Machine learning– Using experiences – Acting rationally in new situations– Recognizing patterns
![Page 8: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/8.jpg)
The Total Turing Test
adding to the agent a video interface and an acting arm
it necessitates:
1- Machine Vision
2- Robotics
![Page 9: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/9.jpg)
• Some examples of AI related topics• Playing Chess with human• Solving a Geometric Problem• Selecting fastest way to destination• Vision• Traffic Controlling• Automatic Conversation • Pattern recognition• Robot Controlling • Deriving Proof of Mathematical theorems• Symbolic Calculation• Weather forecasting• Disease diagnosis• Symbolic
erentiation and integration from mathematical expressions
![Page 10: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/10.jpg)
• Foundations of AI• Philosophy (Dualism vs. Materialism)• Mathematics (Computation, Logic, Probability)• Linguistics (Understanding and Analysis of Languages)• Computer Science (provides and tools : programmability, speed,
storage, actions)• Psychology (The brain processes, study of human Behaviors)• Cognitive Sciences• Neurology/Biology• Engineering• ...
![Page 11: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/11.jpg)
Some Examples
![Page 12: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/12.jpg)
3
65
4
8
1
27 7
32
5
1
4
8
6
Game of 8
Game of 8
• How can we solve Game Of 8 with minimum number of movements?• The answer can be a sequence of movements.
![Page 13: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/13.jpg)
D
C
FA
EZ
GB32km
30km
55km 17km
26km
40km 31km
18km
20km 33km
35km
• We want to go from city 'A' to 'Z' through shortest possible path• The answer can be sequence of city names
![Page 14: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/14.jpg)
Problem Solving using Search
Searching: Testing all possible states to find an appropriate solution.
• In many cases Search problems have a close relation with Trees
![Page 15: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/15.jpg)
3
654
81
27
3
654
81 2
7 36
54
81
27 3
654
81
273
654
81 2
73
654
81 2
7 36
54
81
27
3
654
81 2
7 365
481
27 3
654
81
27 3
654
81
27
3
65 4
81
27
![Page 16: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/16.jpg)
Game Playing
• We can design game playing programs using search methods
• So, we should visit all possible states which can occur in a game.
• But like many search problems, there are methods to reduce the search states (eliminates some states having no effect on search solutions)
![Page 17: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/17.jpg)
X X XX X ...
X O X O XO ...
... ... ...X O X
O XO
X O XO O XX X O
X O XX
X O O
![Page 18: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/18.jpg)
Some other examplesSome other examples
![Page 19: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/19.jpg)
• Find maximum of the functions :
f(x) = x e^(1-x^2) - e^x log xf(x, y) = x^(log y – y) + y^(x^2 – 1)f(x1, x2, x3, ... , x100) = ...
![Page 20: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/20.jpg)
• If age of Ali is 3 times greater than age of his brother plus 1, and age of his brother is ¼ of age of Ali then find age of Ali and his brother.
• Can ordinary search methods be used to solve the above problem?
• Reasonable steps to solve the problem:• Getting and storing the text• Analyzing text and extracting necessary information.• Converting the information to suitable mathematical form• Solving the equations and finding unknown variables
![Page 21: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/21.jpg)
•In ABC we know AB = AC A
B C
• Are angles B and C equal?
• Print steps of the proof
• How to pose this problem for computer?
• Computer would search for a sequence of inference proves the fact
• Using a geometric model can ease the process.
![Page 22: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/22.jpg)
•Write a program to simplify simple expressions
>>> def simplify(expr):
:
>>> simplify(“(a + b) (a – b)”)
“a^2 – b^2”
>>> simplify(“(a-b) (a+b) (a^2 + b^2) + a^4 + b^4”)
“2 a^4”
>>> simplify(“(a + b)^2 – (a - b)^2”)
“4 a b”
![Page 23: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/23.jpg)
•Write a program to differentiate simple mathematical expressions:
>>> def diff(expr, resp):
:
>>> diff(‘2 x^2 – x + 4’ , ‘x’)
“4 x - 1”
>>> diff(‘(x - a)^2’ , ‘x’)
“2 x – 2 a”
>>> diff(‘y sin (y^2)’, ‘y’)
“sin (y^2) + 2 y^2 cos(y^2) ”
![Page 24: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/24.jpg)
•Write a program to calculate integration:
>>> def integrate(expr, resp):
:
>>> integrate(‘6 x + 4’ , ‘x’)
“3 x^2 + 4 x + C”
>>> integrate(‘x + sin x’ , ‘x’)
“0.5 x^2 - cos x + C”
>>> integrate(‘y sin (y^2)’, ‘y’)
“- 0.5 cos (y^2) + C”
>>> integrate(‘x sin x’, ‘x’)
“- x cos x + sin x + C”
![Page 25: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/25.jpg)
•Stages to solve such problems
•Assume we are going to simplify “(x-y) (x+y)”
1- Transform the expression in the form dealing with which is more convinient:
For example in this case we can convert it to:
[[‘x’, ‘y’, ‘-’], [‘x’, ‘y’, ‘+’], ‘*’]
2- Simplify according to some rules and algorithms
[[‘x’, 2, ‘^’], [‘y’, 2, ‘^’], ‘-’]
3- Convert simplified expression to strings
“x^2 – y^2”
![Page 26: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/26.jpg)
•Write a program who could solve simple differential equations
>>> def solve(equation , indep_var, dep_var):
:
>>> solve(”y = y’ “ , ‘x’, ‘y’)
“A e^x”
>>> solve(‘ y’’ – y’ = 2 sin x’ , ‘x’, ‘y’)
“A e^x + B + cos x – sin x”
![Page 27: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/27.jpg)
to ?is liketo
Analogy
1 2 3 4 5
![Page 28: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/28.jpg)
• Examples of Logic• Suppose we have the following facts
•All habitants of “Bal Island” are exactly truthful or lier•A, B, C are habitants of Bal islandA says: “All of us are lier”
•B says: “At least one of us is lier”• Each of A, B, C are lier or truthful?
(-> algorithmic puzzles, Mohammad Ghodsi, Fatemi Publication)
![Page 29: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/29.jpg)
• Examples of Logic• We can solve this problem using search• In this case we should try 8 (=23) cases
For example (A is lier, B is truthful, C is lier)• But if we had 100 persons we should search 2100 states • (2100 = 1267650600228229401496703205376)• This is practically impossible
![Page 30: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/30.jpg)
Problem Solving Using Logic
We can solve some of problems using logical conclusions (reasoning)
By logical reasoning we can obtain new facts from existing factsReasonings can be done according to logical roles in mathematics
![Page 31: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/31.jpg)
•Suppose we have following facts•Kamran is a student
All students are humansAll students like learning • Know we can conclude following facts
•Kamran is a humanKamran like learning
•A human likes learning OR is not a student
An Example of Logical Reasoning
Suppose we have following facts•Kamran is a student•All students are humans•All students like learning
Know we can conclude following facts•Kamran is a human•Kamran like learning•A human likes learning OR is not a student
![Page 32: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/32.jpg)
Knowledge Representation• Before working with the data we should be able to
represent and store them in computer.
• There are many ways for representing information in computers, example:
Ali is tall -> tall(Ali) Ali is bigger than Reza -> bigger(Ali, Reza) Ali is brother of Reza -> Ali = brotherOf(Reza) Ali is tall and Reza is not fat -> tall(Ali) AND (NOT fat(Reza)) If Ali is a human then he can speak
-> human(Ali) => canSpeak(Ali)All humans are Male or Female
-> for all x : human(x) => Male(x) OR Female(x)
![Page 33: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/33.jpg)
Fuzzy LogicAssume following predicates :• My bag is at home.• My book is in my bag.• My brother is taller than me
They are exactly True or False.• So we can have some conclusions :IF (My bag is at home) AND (My book is in may bag) THEN (My book is at home)
![Page 34: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/34.jpg)
Fuzzy Logic • We want to perform conclusions on the knowledge obtained from the real world• But some or most of facts in the real word are not decisive (are not exactly true or false)• Look the facts below:
• Ali is tall.• The weather is hot.• My book is large.• It is about 2 meters high.
![Page 35: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/35.jpg)
Fuzzy Logic• Fuzzy Logic suggests a solution• In fuzzy logic facts are not exactly true or
false they instead have degree of truth• If we denote true by '1' and false by '0' then
truth of a fact can be a number between '0' and '1'.
• For example truth of “Ali is tall” can be '0.9'• We can define 'AND' , 'OR', 'NOT' and '=>'
in fuzzy logic such as ordinary logic.
![Page 36: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/36.jpg)
Fuzzy Logic• Fuzzy Logic was created by “Dr. Lotfi Zhdeh” in 1960 for the purpose of modeling uncertainty inherent in Natural Language• Representing vague and often contradictory knowledge.• Fuzzy logic is primarily used as the underlying logic of fuzzy expert systems
![Page 37: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/37.jpg)
Fuzzy Logic• Example of Fuzzy Logic applications :
• Pattern Recognition• Control (Fuzzy Controllers)• Weather forecasting• Economics• Politics
![Page 38: Computer Science & Engineering Shiraz University Artificial Intelligence](https://reader034.vdocuments.net/reader034/viewer/2022051000/56649e2b5503460f94b194e7/html5/thumbnails/38.jpg)
other fields of AI Evolutionary Computation (Genetic
Algorithms, ...) Artificial Neural Networks Robotics Expert Systems Image Processing and Machine Vision Data Mining ...