rai practical presentations
DESCRIPTION
Robotics and Artificial intelliegence (Rai) practical presentations.TRANSCRIPT
![Page 1: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/1.jpg)
Problem Solving Problem Solving and Searchand Search
Introduction to Artificial Intelligence
CS440/ECE448
Lecture 2
![Page 2: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/2.jpg)
This LectureThis Lecture
• Problem representation• Problem solving through search
ReadingReading• Chapter 2
AnnouncementsAnnouncements• My office hours: Weds. From 2 to 3pm.
![Page 3: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/3.jpg)
The 8-puzzleThe 8-puzzle
2 8 3
1 6 4
7 5
Start
2
8
31
6
4
7 5
Goal
How do we goal from start configuration to the goal configuration?
![Page 4: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/4.jpg)
The corresponding search treeThe corresponding search tree2 8 31 6 47 5
2 8 31 6 4
7 5
2 8 31
64
7 5
2 8 31 6 47 5
2 8 3
16 47 5
2 8 316
47 5
28
31
64
7 5
2 8 31 6 47 5
![Page 5: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/5.jpg)
Toy Problems and Real ProblemsToy Problems and Real Problems
• 8-puzzle
• Vacuum World
• Cryptarithmetic
• 8-queens
• The water jug problem
• Missionaries and Cannibals
• Towers of Hanoi
• Traveling salesman
• Robot navigation
• Process or assembly planning
• VLSI Layout
![Page 6: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/6.jpg)
Problem Solving:Problem Solving:• World State – values of all attributes of interest in the world.• State Space – the set of all possible world states.• Operators – change one state into another; cost of applying
operator. • Goal – An (often partial) world state or states; in an agent,
often implemented as a function of state and current percept.• Initial State – The values of attributes that are in effect at the
beginning of a problem before any operators have been applied.• Note: The states and the operators define a directed (possibly
weighted) graph.
• Solution (path) – a sequence of operators leading from the initial state to a goal state.
• Path cost – e.g. sum of distances, number of operators executed…
![Page 7: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/7.jpg)
In the real worldIn the real world
• The real world is absurdly complex.
– Real state space must be abstracted for problem solving.
– An abstract state is equivalent to a set of real states.
• Abstract operator is equivalent to a complex combination of real actions.
– Robot operator: Move down hall – In practice, this might involve a complex set of sensor and motor activities.
• An abstract solution is equivalent to a set of real paths that are solutions in the real world.
![Page 8: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/8.jpg)
Example: The 8-puzzleExample: The 8-puzzle
• States:
• Operators:
• Goal Test:
• Path Cost:
• Constraints:
2 8 31 6 47 5
Start
28
31
64
7 5
Goal
3£ 3 array of integer values
Move tile number i left, right, up, down
= goal state (given)
1 per move
Can only move in a direction if that space is empty
![Page 9: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/9.jpg)
Example: The 8-puzzleExample: The 8-puzzle
• States:
• Operators:
• Goal Test:
• Path Cost:
• Constraints:
2 8 31 6 47 5
Start
28
31
64
7 5
Goal
Integer location of tiles (ignore intermediate positions)
Move blank left, right, up, down
= goal state (given)
1 per move
Can only move blank in a direction if it stays in puzzle
![Page 10: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/10.jpg)
Example: The 8-puzzleExample: The 8-puzzle
2 8 31 6 47 5
Start
28
31
64
7 5
Goal
Initial State = [4, 1, 3, 6, 9, 5, 7, 2]
Goal State = [1, 2, 3, 6, 9, 8, 7, 4]
1 2 3
4 5 6
7 8 9
![Page 11: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/11.jpg)
Missionaries and cannibalsMissionaries and cannibals
• Three missionaries and three cannibals are on the left bank of a river.
• There is one canoe which can hold one or two people.
• Find a way to get everyone to the right bank, without ever leaving a group of missionaries in one place outnumbered by cannibals in that place.
![Page 12: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/12.jpg)
Missionaries and cannibalsMissionaries and cannibals
• States: three numbers (i,j,k) representing the number of missionaries, cannibals, and canoes on the left bank of the river.
• Initial state: (3, 3, 1)• Operators: take one missionary, one cannibal, two
missionaries, two cannibals, one missionary and one cannibal across the river in a given direction (I.e. ten operators).
• Goal Test: reached state (0, 0, 0)• Path Cost: Number of crossings.
![Page 13: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/13.jpg)
Missionaries and Cannibals
(3,3,1)
![Page 14: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/14.jpg)
Missionaries and Cannibals
A missionary and cannibal cross
![Page 15: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/15.jpg)
Missionaries and Cannibals
(2,2,0)
![Page 16: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/16.jpg)
Missionaries and Cannibals
One missionary returns
![Page 17: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/17.jpg)
Missionaries and Cannibals
(3,2,1)
![Page 18: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/18.jpg)
Missionaries and Cannibals
Two cannibals cross
![Page 19: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/19.jpg)
Missionaries and Cannibals
(3,0,0)
![Page 20: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/20.jpg)
Missionaries and Cannibals
A cannibal returns
![Page 21: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/21.jpg)
Missionaries and Cannibals
(3,1,1)
![Page 22: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/22.jpg)
Missionaries and Cannibals
Two missionaries cross
![Page 23: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/23.jpg)
Missionaries and Cannibals
(1,1,0)
![Page 24: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/24.jpg)
Missionaries and Cannibals
A missionary and cannibal return
![Page 25: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/25.jpg)
Missionaries and Cannibals
(2,2,1)
![Page 26: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/26.jpg)
Missionaries and Cannibals
Two Missionaries cross
![Page 27: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/27.jpg)
Missionaries and Cannibals
(0,2,0)
![Page 28: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/28.jpg)
Missionaries and Cannibals
A cannibal returns
![Page 29: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/29.jpg)
Missionaries and Cannibals
(0,3,1)
![Page 30: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/30.jpg)
Missionaries and Cannibals
Two cannibals cross
![Page 31: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/31.jpg)
Missionaries and Cannibals
(0,1,0)
![Page 32: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/32.jpg)
Missionaries and Cannibals
A cannibal returns
![Page 33: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/33.jpg)
Missionaries and Cannibals
(0,2,1)
![Page 34: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/34.jpg)
Missionaries and Cannibals
The last two cannibals cross
![Page 35: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/35.jpg)
Missionaries and Cannibals
(0,0,0)
![Page 36: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/36.jpg)
Water JugsWater Jugs• You are given:
– a spigot,
– a 3 Gallon jug,
– a 4 Gallon jug.
• The goal: Get 2 gallons of water in the 4 gallon jug.
• Actions: Filling jugs from spigot, dumping water in jugs onto ground, dumping 4 gallon into 3 gallon jug until 3 gallon jug is full. Dumping 3 gallon jug into 4 gallon jug until empty or until 4 gallon is full, etc, etc.
![Page 37: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/37.jpg)
Water JugsWater Jugs
• States: How full are the two jugs?
• State Representation:4G = ?3G = ?
• Constraints:0 4G 40 3G 3
• Initial State:
4G = 0
3G=0
• Goal State:
4G=2
![Page 38: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/38.jpg)
OperatorsOperators
• F3: Fill the 3 Gallon jug from the tap.
• F4: Fill the 4 Gallon jug from the tap.
• E4: Empty the 4-Gallon jug on the ground.
• P43: Pour water from 4G jug into the 3G jug until
3G jug is full.
• P34: Pour water from 3G jug into the 4G jug until
4G jug is full or 3G is empty.
![Page 39: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/39.jpg)
• F3: Fill the 3 Gallon jug from the tap.
• F4: Fill the 4 Gallon jug from the tap.
• E4: Empty the 4-Gallon jug on the ground.
• P43: Pour water from 4G jug into the 3G jug until 3G jug is full.
• P34: Pour water from 3G jug
into the 4G jug until 4G jug is
full or 3G is empty.
Partial State GraphAnd
Solution Path
![Page 40: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/40.jpg)
Search MethodsSearch Methods
![Page 41: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/41.jpg)
A Toy Example: A Romanian A Toy Example: A Romanian HolidayHoliday
• State space: Cities in Romania• Initial state: Town of Arad• Goal: Airport in Bucharest• Operators: Drive between cities• Solution: Sequence of cities• Path cost: number of cities, distance, time, fuel
![Page 42: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/42.jpg)
The state spaceThe state space
![Page 43: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/43.jpg)
Search AlgorithmsSearch Algorithms• Basic Idea: Off-line exploration of state space by generating
successors of already-explored states (also known as expanding states).
Function GENERAL-SEARCH (problem, strategy)
returns a solution or failure
Initialize the search tree using the initial state of problem
loop do
if there are no candidates for expansion, then return failure
Choose a leaf node for expansion according to strategy
if node contains goal state then return solution
else expand node and add resulting nodes to search tree.
end
Function GENERAL-SEARCH (problem, strategy)
returns a solution or failure
Initialize the search tree using the initial state of problem
loop do
if there are no candidates for expansion, then return failure
Choose a leaf node for expansion according to strategy
if node contains goal state then return solution
else expand node and add resulting nodes to search tree.
end
![Page 44: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/44.jpg)
General Search ExampleGeneral Search Example
Arad
Zerind Sibiu Timisoara
Arad Oradea Fagaras Rimnicu Vilcea
Sibiu Bucharest
![Page 45: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/45.jpg)
The solutionThe solution
![Page 46: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/46.jpg)
Tree search exampleTree search example
![Page 47: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/47.jpg)
Tree search exampleTree search example
Expanded node
Fringe
![Page 48: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/48.jpg)
Tree search exampleTree search example
![Page 49: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/49.jpg)
Implementation of Search AlgorithmsImplementation of Search Algorithms
Function GENERAL-SEARCH (problem, queing-fn)
returns a solution or failure
queue MAKE-QUEUE (MAKE-NODE(INITIAL-STATE[problem]))
loop do
if queue is empty, then return failure
node Remove-Front(queue)
if GOAL-TEST [problem] applied to STATE(node) succeeds
then return node
else queueQUEING-FN(queue,EXPAND(node,operators[problem]))
end
Function GENERAL-SEARCH (problem, queing-fn)
returns a solution or failure
queue MAKE-QUEUE (MAKE-NODE(INITIAL-STATE[problem]))
loop do
if queue is empty, then return failure
node Remove-Front(queue)
if GOAL-TEST [problem] applied to STATE(node) succeeds
then return node
else queueQUEING-FN(queue,EXPAND(node,operators[problem]))
end
Nodes: state, parent-node,operator, depth, path cost
![Page 50: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/50.jpg)
States vs. nodesStates vs. nodes
• A state is a (representation of a) physical configuration.
• A node is a data structure constituting part of a search tree includes parent, children, depth, path cost g(n).
• States do not have parents, children, depth, or path cost!
![Page 51: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/51.jpg)
Search StrategiesSearch StrategiesA strategy is defined by picking the order of node expansion.
Strategies are evaluated along the following dimensions:
– completeness – does it always find a solution if one exists?
– optimality – does it always find a least-cost solution?
– time complexity – number of nodes generated/expanded
– space complexity – maximum number of nodes in memory
Time and space complexity are measured in terms of:
b – maximum branching factor of the search tree
d – depth of the least-cost solution
m – maximum depth of the state space (may be infinite)
![Page 52: Rai practical presentations](https://reader036.vdocuments.site/reader036/viewer/2022062307/5562e18bd8b42ad26c8b4853/html5/thumbnails/52.jpg)
Uninformed Search StrategiesUninformed Search Strategies
Uninformed (blind) strategies use only the information available in the problem definition.
Informed search techniques which might have additional information (e.g. a compass).
• Breadth-first search• Uniform-cost search• Depth-first search• Depth-limited search• Iterative deepening search