Sei sulla pagina 1di 40

12

ARTIFICIAL INTELLIGENCE @ COMSATS IIT LHR


REPRESENTATION (STATE SPACE MODELING), SEARCHING AND PLANNING

Wajahat M. Qazi, Ph.D.


Assistant Professor| DDP Coordinator,
In-charge Intelligent Machines and Robotics|
Department of Computer Science,
COMSATS Institute of Information Technology Lahore
HOW?

Graph based Representation


GRAPH REPRESENTATION
GRAPH REPRESENTATION
GRAPH REPRESENTATION
HYPERGRAPH REPRESENTATION
Neo4j: A Graph Database
State Space Modeling
HOW?
AGENTS AND PROBLEM SOLVING (HOW THEY DO IT?)
We will come to State Space Modeling
Again!
Lets see how it works
State-space Search and Planning
SEARCHING AND PLANNING (PART I)

▪ State Space and Search


▪ DFS and Goal Driven Search
▪ BFS and Data Driven Search
▪ Uniform-cost Search (UCS)
▪ Greedy Algorithm
▪ A*
DFS VS. BFS AND THEIR ISSUES
UNIFORM COST SEARCH
OUR VERSION OF THE STORY
GENERAL TREE SEARCH
Heuristics and Search, h(x)
▪ Generally considered to be Rule of Thumb but in AI it’s a function
▪ Method of Discovering
▪ A function that estimates how close a state is to a goal
▪ Designed for a particular search problem
▪ Its about your cleverness
▪ Examples: Manhattan distance, Euclidean distance for path
Greedy Search
GREEDY SEARCH AND PATH FINDING
PACMAN AND HEURISTICS
WHAT MIGHT GO WRONG WITH GREEDY SEARCH
OUR VERSION OF THE STORY
A* (A-Star Algorithm)
UCS+ Greedy
A* = UCS + GREEDY: F(N) = H(N) + G(N)
IS A* OPTIMAL? WHAT MIGHT GO WRONG WITH A*
ADMISSIBLE HEURISTICS

▪ Admissible if it never overestimates the cost of reaching


the goal
▪ The cost it estimates to reach the goal is not higher than
the lowest possible cost from the current point in the path
Back to State Space Modeling
 Tree search:
 A* is optimal if heuristic is admissible
 UCS is a special case (h = 0)

 Graph search:
 A* optimal if heuristic is consistent
 UCS optimal (h = 0 is consistent)

 Consistency implies admissibility


 In general, most natural admissible heuristics tend to be
consistent, especially if from relaxed problems
SIMPLIFY THE ASSUMPTIONS

Environment is static
 no changes in environment while problem is being
solved
Environment is observable
Environment and actions are discrete
 (typically assumed, but exceptions are always there)
Environment is deterministic
FORMULATE A STATE SPACE (NAVIGATION EXAMPLE)
 Set of States
 Individual cities
 Operators
 Freeway routes from one city to another
 Start State
 Current City
 Goal States
 Set of cities we would like to be in
 Solution
 A specific goal city,
 A sequence of operators which get us there,
PERFORM ABSTRACTION

 Removing irrelevant details to create an abstract representation: ``high-level” view


 Navigation Example: how do we define states and operators?
 First step is to abstract “the big picture”
 Solve a map problem
 nodes = cities, links = freeways/roads (a high-level description)
 This description is an abstraction of the real problem

 Can later worry about details like Refueling Stations, Scene Views, Refreshment Points…

 Abstraction is critical for automated problem solving


 must create an approximate, simplified, model of the world for the computer to deal with: real-
world is too detailed to model exactly
 good abstractions retain all important details
FORMULATE A STATE SPACE (8 QUEEN EXAMPLE)

 States:
 any arrangement of n<=8 queens
 or arrangements of n<=8 queens in leftmost n
 columns, 1 per column, such that no queen
 attacks any other.
 initial state:
 no queens on the board
 Actions:
 add queen to any empty square
 or add queen to leftmost empty square such that it is not attacked by other queens.
 Goal Test:
 8 queens on the board, none attacked.
 Path Cost? 1 per move
8- PUZZLE EXAMPLE FOR A* = UCS + GREEDY: F(N) = H(N) + G(N)
SEARCHING STRATEGIES

 A search 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?
 Time complexity: number of nodes generated
 Space complexity: maximum number of nodes in memory
 Optimality: does it always find a least-cost solution?

 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 ∞)
SEARCH STRATEGY AND COMPLEXITY EXAMPLE

Depth of Solution Node to Expand Time Memory


0 1 1 millisecond 100 bytes
2 11 0.1 Second 11 Kbytes
4 11,111 11 Second 1 Megabyte
8 108 31 hours 11 Gigabytes
12 1012 35 Years 111 Terabytes

Assuming b=10, 1000 nodes/sec, 100 bytes/node


JAZAK ALLAH

Potrebbero piacerti anche