Topic 2 - 1 - Basic Search Strategies

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

UEMH4723 APPLICATIONS OF ARTIFICIAL INTELLIGENCE

Mohammad Babrdel Bonab

ARTIFICIAL INTELLIGENCE 1
About me
Assistant Professor

ARTIFICIAL INTELLIGENCE 2
Attendance QR

ARTIFICIAL INTELLIGENCE 3
What Is Artificial Intelligence(AI)?

ARTIFICIAL INTELLIGENCE 4
What Is Artificial Intelligence(AI)?

ARTIFICIAL INTELLIGENCE 5
What Is Artificial Intelligence(AI)?
• Artificial intelligence (AI) refers to the simulation of human intelligence
in machines that are programmed to think like humans and mimic
their actions.

• The term may also be applied to any machine that exhibits traits associated
with a human mind such aslearning and problem-solving.

• The ideal characteristic of artificial intelligence is its ability to rationalize and


take actions that have the best chance of achieving a specific goal.

ARTIFICIAL INTELLIGENCE 6
What Is Artificial Intelligence(AI)?

ARTIFICIAL INTELLIGENCE 7
Why is AI important?
• AI technology is important because it enables human capabilities – understanding,
reasoning, planning, communication and perception – to be undertaken by software
increasingly effectively, efficiently and at low cost.
• General analytical tasks, including finding patterns in data, that have been
performed by software for many years can also be performed more effectively using AI.
• The automation of these abilities creates new opportunities in most business sectors and
consumer applications.
• AI has numerous, tangible use cases today that are enabling corporate revenue growth
and cost savings in existing sectors.
• Significant new products, services and capabilities enabled by AI include
autonomous vehicles, automated medical diagnosis, voice input for human-computer
interaction, intelligent agents, automated data synthesis and enhanced decision-making.

ARTIFICIAL INTELLIGENCE 8
Why is AI important?
• Applications will be most numerous in sectors in which a large proportion of time is spent
collecting and synthesizing data: financial services, retail and trade, professional services,
manufacturing and healthcare. Applications of AI-powered computer vision will be
particularly significant in the transport sector.

ARTIFICIAL INTELLIGENCE 9
What problems can we solve using AI?
• Energy
• Environment
• Transportation
• Food and water
• Disease and Human Suffering
• Education
• Population
• …

I believe that all of this problems can be tackled using AI.


ARTIFICIAL INTELLIGENCE 10
Search Methods

ARTIFICIAL INTELLIGENCE 11
Why is search important in Artificial Intelligence?
 In many problems, sequence of steps required to solve is not known in
advance but must be determined by systematic trial-and-error exploration of
alternatives.

 Many of AI problems can be readily modeled as state spaces, and solving these
problems can "simply" be reduced to exploring the state space, and identifying the
correct answer.

 to simulate human actions, human thinking and human perception as well that's why
search is major and high part of the artificial intelligence.

ARTIFICIAL INTELLIGENCE 12
Search Methods
 Searching is the universal technique of problem solving and one of the most
important areas of Artificial Intelligence.

 Search is the process to find out the best sequence of actions.

 Problem-solving agents or Rational agents in AI mostly used these search


strategies or algorithms to solve a specific problem and provide the best result.

 Problem-solving agents are the goal-based agents and use atomic representation.

ARTIFICIAL INTELLIGENCE 13
Problems that are addressed by AI search
 The problems that are addressed by AI search algorithms fall into three general classes:
 single-agent path-finding problems
 two-players games
 constraint-satisfaction problems
 Classic examples in the AI literature of path-finding problems are sliding-title
puzzles, Rubik’s Cube and theorem proving.
 Real-world problems include the traveling salesman problem, vehicle navigation,
and the wiring of VLSI circuits. In each case, the task is to find a sequence of
operations that map an initial state to a goal state.

ARTIFICIAL INTELLIGENCE 14
Search Methods
 An agent can have several ways to archive a goal, search methods try to find the
best set of actions to archive the goal based on the objective function.

 To start solving a problem, first of all we need to define the objective, then formulate
the problem and finally solve the problem.

 The best solution is given by the one with the best performance, in other words, the
one who score better in archiving the objective.

ARTIFICIAL INTELLIGENCE 15
Search Algorithm Terminologies
 Search: Searching is a step by step procedure to solve a search-problem in a given
search space. A search problem can have three main factors:

a. Search Space: Search space represents a set of possible solutions, which a


system may have.

b. Start State: It is a state from where agent begins the search.

c. Goal test: It is a function which observe the current state and returns
whether the goal state is achieved or not.

ARTIFICIAL INTELLIGENCE 16
Search Algorithm Terminologies
 Search tree: A tree representation of search problem is called Search tree. The root of
the search tree is the root node which is corresponding to the initial state.
 Actions: It gives the description of all the available actions to the agent.

 Transition model: A description of what each action do, can be represented as a


transition model.
 Path Cost: It is a function which assigns a numeric cost to each path.

 Solution: It is an action sequence which leads from the start node to the goal node.

 Optimal Solution: If a solution has the lowest cost among all solutions.

ARTIFICIAL INTELLIGENCE 17
Search Problem
 A problem may be solvable by a search technique if the problem has
each of the following features:
 Initial state
 Possible actions
 Transition model
 Goal criteria
 Path cost

ARTIFICIAL INTELLIGENCE 18
State-space search algorithms
 State space search is a process of finding a goal state with a desired property.

a. Uninformed Search

b. Heuristic Search

 Stochastic search

a. Meta-heuristics

ARTIFICIAL INTELLIGENCE 21
Uninformed Search Strategies
 An uninformed (a.k.a. blind , brute-force ) search algorithm generates
the search tree without using any domain specific knowledge.

 They are most simple, as they do not need any domain-specific knowledge.

 They work fine with small number of possible states.

 We do not use the path cost when


executing uninformed search.

ARTIFICIAL INTELLIGENCE 24
Generic search algorithm
 All searches essentially follow the same algorithm:
1. create an empty list called "closedset"; this list will contain states that have been visited.
2. create a list called "openset" that contains just the starting state; this list contains states that
have not been visited but are known to exist.
3. create an empty map (key/value pairs) called "parents"; this map contains the previous state of
each state that has been visited.
4. while the openset is not empty:
a. grab a state from the openset (and remove it);
put it in the closedset (since we're now looking at it)
b. if that state is the goal, hey we're done!
i. return a reconstructed path from the goal state to the start state (this is easy: recursively grab parent states from the
"parents" map)
c. it's not the goal state; for each next state that is accessible from here:
i. if this next state is in the closedset (it has been visited before), ignore it
ii. if this next state is not in the openset, put it in the openset and record its parent.
5. if the openset is empty and we never found the goal, oops!
ARTIFICIAL INTELLIGENCE 26
ARTIFICIAL INTELLIGENCE 27
State-space search algorithms

Backtracking search

ARTIFICIAL INTELLIGENCE 28
Backtracking search
 Backtracking search is a naive recursive algorithm that tries all possibilities to
find the minimum cost path.

 In this case, action costs can be either positive or negative.

ARTIFICIAL INTELLIGENCE 29
Breadth-first search (BFS)
 Breadth-first search is a graph search algorithm that does a level-by-level
traversal. (most common search strategy for traversing a tree or graph)
 This algorithm searches breadthwise in a tree or graph, so it is called breadth-first
search.
 BFS algorithm starts searching from the root node of the tree and expands all
successor node at the current level before moving to nodes of next level.
 Breadth-first search implemented using FIFO queue data structure.

ARTIFICIAL INTELLIGENCE 30
Breadth-first search (BFS)

ARTIFICIAL INTELLIGENCE 31
Breadth-first search (BFS)
 Advantages:
 BFS will provide a solution if any solution exists.
 If there are more than one solutions for a given problem, then BFS will provide the
minimal solution which requires the least number of steps.
 Disadvantages:
 It requires lots of memory since each level of the tree must be saved into memory to
expand the next level.
 BFS needs lots of time if the solution is far away from the root node.

ARTIFICIAL INTELLIGENCE 32
Depth-first Search
 Depth-first search is a recursive algorithm for traversing a tree or graph data
structure.
 It is called the depth-first search because it starts from the root node and follows
each path to its greatest depth node before moving to the next path.
 DFS uses a stack data structure for its implementation.
 The process of the DFS algorithm is similar to the BFS algorithm.

ARTIFICIAL INTELLIGENCE 33
Depth-first Search

ARTIFICIAL INTELLIGENCE 34
ARTIFICIAL INTELLIGENCE 35
Depth-first Search
 Advantage:
 DFS requires very less memory as it only needs to store a stack of the nodes on the
path from root node to the current node.
 It takes less time to reach to the goal node than BFS algorithm (if it traverses in the
right path).
 Disadvantage:
 There is the possibility that many states keep re-occurring, and there is no guarantee
of finding the solution.
 DFS algorithm goes for deep down searching and sometime it may go to the infinite
loop.

ARTIFICIAL INTELLIGENCE 36
Informed (Heuristic) Search Strategies
 Informed search algorithm contains an array of knowledge such as how far we are
from the goal, path cost, how to reach to goal node, etc.
 This knowledge help agents to explore less to the search space and find more
efficiently the goal node.
 Informed search algorithm uses the idea of heuristic, so it is also called
Heuristic search.
 Heuristic search refers to a search strategy that attempts to optimize a problem
by iteratively improving the solution based on a given heuristic function or a cost
measure.

ARTIFICIAL INTELLIGENCE 37
Informed (Heuristic) Search Strategies
 Heuristic is a function which is used in Informed Search, and it finds the most
promising path.

 It takes the current state of the agent as its input and produces the estimation of
how close agent is from the goal.

 The informed search algorithm is more useful for large search space.

ARTIFICIAL INTELLIGENCE 38
Informed (Heuristic) Search Strategies
 Admissibility of the heuristic function is given as:
h(n) <= h*(n)
 Here h(n) is heuristic cost, and h*(n) is the estimated cost. Hence heuristic cost
should be less than or equal to the estimated cost.

ARTIFICIAL INTELLIGENCE 39
Informed (Heuristic) Search Strategies
 Informed Search:
 A * Search
 Greedy Best First Search (Greedy Search)
 Graph Search

ARTIFICIAL INTELLIGENCE 40
Meta-heuristics
 Meta-heuristics: High-level strategies
for guiding a search (Glover, 1986)
according to feedback from the objective
function, previous decisions and prior
performance.
 In other words, the rules of a meta-
heuristic consist of (at least) two orders,
such that the overall searching behavior
keeps changing while exploring the state-
space.

ARTIFICIAL INTELLIGENCE 41
Heuristics VS Meta-heuristics
 In fact, heuristics and metaheuristics are part of optimization's field. (Alejandro ).
 Heuristics are problem-dependent techniques. Metaheuristics are problem-
independent techniques that can be applied to a broad range of problems.
 A heuristic exploits problem-dependent information to find a 'good enough'
solution to a specific problem, while metaheuristics are, like design patterns,
general algorithmic ideas that can be applied to a broad range of problems.
 Heuristics designed to obtain the specific solution for problem and the solution
examed by several experimental, thus the solution is good, near optimal. Meta-
heuristics designed the general structure to solve different type of problems, each
of these structures used to solve different problem as Tabu search, Ant,....

ARTIFICIAL INTELLIGENCE 42
Travelling Salesman Problem
 In this problem, the objective is to find a low-cost tour that starts from a city, visits
all cities en-route exactly once and ends at the same starting city.

Start
Find out all (n -1)! Possible solutions,
where n is the total number of cities.

Determine the minimum cost by finding out


the cost of each of these (n -1)! solutions.

Finally, keep the one with the minimum cost.


End

ARTIFICIAL INTELLIGENCE 43
T&Q

UECS2153/UECS2053/UEMH3163 - ARTIFICIAL INTELLIGENCE 44

You might also like