COMPUTERLESSON
HARDWARE
2
Problem Solving in Artificial Intelligence
READING RESOURCES
• Müller. A. C., & Guido, S. (2016). Introduction to
Machine Learning with Python. O'Reilly Media. Inc.
• AI and ML Playlist
https://www.youtube.com/playlist?list=PLrjkTql3jnm_yol-ZK1QqPSn5YSg0NF9r
• AI and ML Tutorial
https://www.javatpoint.com/artificial-intelligence-tutorial
• Search Strategies
https://www.youtube.com/watch?v=bSv4CWMTeR0&t=64s
https://www.youtube.com/watch?v=8pTjoFiICg8
LESSON OUTLINE
▪Problem Solving in Artificial Intelligence
▪Introductory Concepts
▪Terminologies
▪Search Space Graphs and Search Trees
Introductory Concepts
• Problem-Solving in Artificial Intelligence involves
• Coming up with a formula that allows intelligent agents to plan
ahead
• The use of SEARCH STRATEGIES/ALGORITHMS by rational or
problem-solving agents
• Characterizing problems to be solved as search problems using
the principle of mathematical abstraction
• Mathematical abstraction is a means of representing real-world
mathematical problems using mental images
• It is a means of simplifying complex problems in order to solve them
• Search Algorithms are used to solve the mathematical
abstractions
Introductory Concepts
• Intelligent or Rational agents are also known as Planning Agents
• A planning agent
• Has a goal to achieve e.g. Reaching an Apple
• Has to think of different options ahead of time to achieve the goal
• Thinks through the possible scenarios for achieving a goal and takes
actions based on them
• Asks what if and make decisions based on the consequences of
actions
• Usually works based on a model of how the world evolves in response
to actions
• The key for every planning agent is to find the best sequence of
actions that will allow it to get to the exact goal
Introductory Concepts
• Planning Agents are usually involved in
• Planning
• Deciding and acting on a sequence of actions in
order to obtain a solution always
• Replanning
• Deciding and acting on a sequence of actions
• Changing a sequence of actions when the
conditions in the environment change
Introductory Concepts
• Planning algorithms implemented by planning agents
must have the following characteristics
• They must be optimal
• They must have a solution
• The solution must be obtained with the least cost
• They must be complete
• If there is a solution; it must be found
• They must have time complexity related to the problem
• They must have space complexity related to the problem
Introductory Concepts
• Time and Space Complexity
• Time complexity of a particular algorithm is a function, this function takes
input as length of data entered in that algorithm and determines how much
time or cycles need to run that algorithm for that input.
• Consider an algorithm which always print “hello” whenever you enter
your name as an input.
• For each step of that algorithm our CPU will performs some calculations
and generate some intermediate results, for each steps let us consider
CPU takes one cycle to execute
• If the simple algorithm has let’s say 20 steps it will be completed in 20
cycles.
Introductory Concepts
• Time and Space Complexity
• Space Complexity
• Whenever a solution to a problem is written some memory is required to complete. For
any algorithm memory may be used for the following:
• Variables (This include the constant values, temporary values)
• Program Instruction
• Execution
• Space complexity is the amount of memory used by the algorithm (including the input
values to the algorithm) to execute and produce the result.
• Auxiliary Space should not be confused with Space Complexity. Auxiliary Space is the
extra space or the temporary space used by the algorithm during it's execution.
• Space Complexity = Auxiliary Space + Input space
Terminologies
• A search problem consists of
• State/Search Space: The agent’s view of the problem. It is the set of possible solutions
which a system may have
• Successor function: It is a function that tells the next state after an action is executed
It is a function that tells the agent the cost associated with an action that was previously
taken
• Start State: It is a state from which the agent begins to solve the problem
• Goal: It is a function that observes a current state in order to show whether the goal
has been achieved or not
• Solution: It is a sequence of actions or a plan which transforms the start start state to
the goal state
It is the action sequence which leads from the state node to the goal node
• Optimal Solution: The solution which has the lowest cost among all solutions
Terminologies
• Search algorithms are able to solve any problem which are
characterised as Search Problems
• The sequence followed in Searching is
Real World Search Search
Solution
Problem Problem Algorithm
Calls
i. Start State
ii. Goal State
iii. Successor functions
iv. Search Space
State Space Graphs
• State space graph: A mathematical
representation of a search problem
• Nodes are (abstracted) world
configurations
• Arcs represent successors (action
results)
• The goal test is a set of goal nodes
(maybe only one)
• In a state space graph, each state
occurs only once!
• We can rarely build this full graph in
memory (it’s too big), but it’s a useful
idea
Search Trees
A search tree: Search Trees are built from Search Algorithms
• A “what if” tree of plans and their outcomes
• The start state is the root node
• Children correspond to successors
• Nodes show states, but correspond to PLANS
that achieve those states
• For most problems, we can never actually build
the whole tree
Search Trees vs State Space Graphs
Each NODE in in the
State Space Graph search tree is an entire
PATH in the state space
graph.
We construct both on
demand – and we
construct as little as
possible.
Search Trees vs State Space Graphs
Consider this 4-state graph: How big is its search tree (from S)?
Tree Search
Tree Search
Search
• Expand out potential plans (tree nodes)
• Maintain a fringe of partial plans under consideration
• Try to expand as few tree nodes as possible
Tree Search
Search
• Expand out potential plans (tree nodes)
• Maintain a fringe of partial plans under consideration
• Try to expand as few tree nodes as possible
Tree Search
The Search Algorithm
• Builds a Search Tree
• Chooses an ordering
of the
fringe(unexplored
nodes)
• Finds least-cost plans
Tree Search Example
Search Trial