Unit i Problem Solving
Unit i Problem Solving
Topic 1: Introduction to AI
AI is one of the newest fields in science and engineering. The word Artificial Intelligence comprises of two
words “Artificial” and “Intelligence”. Artificial refers to something which is made by humans or non-
natural thing and intelligence means the ability to understand or think.
AI is the study of how to train the computers so that computers can do things which at present human can
do better. It is the ability of a computer to act like a human being. Therefore, AI is an intelligence where
we want to add all the capabilities to machine that human contains.
Four approaches to AI
• Systems that think like humans.
• Systems that act like humans
• Systems that think rationally
• Systems that act rationally.
A human-centred approach must be in part an empirical science, involving observations and hypotheses
about human behaviour. A rationalist approach involves a combination of mathematics and engineering.
1.Acting humanly: The Turing Test approach
The Turing Test, proposed by Alan Turing (1950), was designed to provide a satisfactory opera-
tional definition of intelligence. A computer passes the test if a human interrogator, after posing some writ-
ten questions, cannot tell whether the written responses come from a person or from a computer.
Example:
“Socrates is a man;
all men are mortal;
therefore, Socrates is mortal.”
TOPIC 2: AI Applications
AGENTS:
An agent is anything that can be ENVIRONMENT viewed as perceiving its environment through sensors
and acting upon that environment through actuators.
percept to refer to the agent’s perceptual inputs at any given instant.
An agent’s behaviour is described by the agent function that maps any given percept sequence to
an action. The agent function for an artificial agent will be implemented by an agent program. It is im-
portant to keep these two ideas distinct.
The agent function is an abstract mathematical description;
The agent program is a concrete implementation, running within some physical system.
The notion of an agent is meant to be a tool for analyzing systems, not an absolute characterization
that divides the world into agents and non-agents.AI operates at the most interesting end of the spectrum,
where the artifacts have significant computational resources and the task environment requires nontrivial
decision making.
Step 1: Goal formulation, based on the current situation and the agent’s performance measure,
Step 2: Problem formulation is the process of deciding what actions and states to consider, to achieve a
goal.
Step 3: Search The process of looking for a sequence of actions that reaches the goal is called search.
Step 4: Execution A search algorithm takes a problem as input and returns a solution in the form of an
action sequence. Once a solution is found, the actions it recommends can be carried out. This is called the
execution phase.
The initial state, actions, and transition model implicitly define the state space of the problem, ie) the set
of all states reachable from the initial state by any sequence of actions
A path in the state space is a sequence of states connected by a sequence of actions. A solution to a problem
is an action sequence that leads from the initial state to a goal state. Solution quality is measured by the
path cost function, and an optimal solution has the lowest path cost among all solutions.
Example Problems:
1. Toy problem
a) States: A state description specifies the location of each of the eight tiles and the blank in one of
the nine squares.
b) Initial state: Any state can be designated as the initial state.
c) Actions: The simplest formulation defines the actions as movements of the blank space Left, Right,
Up, or Down.
d) Transition model: Given a state and action, this returns the resulting state.
e) Goal test: This checks whether the state matches the goal configuration
f) Path cost: Each step costs 1, so the path cost is the number of steps in the path.
The 8-puzzle belongs to the family of sliding-block puzzles, which are often used as test problems for
new search algorithms in AI. This family is known to be NP-complete.
9!
• The 8-puzzle has 2 = 181, 440 reachable states and is easily solved.
• The 15-puzzle (on a 4×4 board) has around 1.3 trillion states (Few milli seconds to solve)
• The 24-puzzle (on a 5 × 5 board) has around 1025 states (Hours to solve)
1.Route Finding Problems is defined in terms of specified locations and transitions along links between
them. Route-finding algorithms are used in a variety of applications.
(e.g., an airport)
a) States: Each state obviously includes a location and the current time.
b) Initial state: This is specified by the user’s query.
c) Actions: Take any flight from the current location, in any seat class, leaving after the current time,
leaving enough time for within-airport transfer if needed
d) Transition model: The state resulting from taking a flight will have the flight’s destination as the
current location and the flight’s arrival time as the current time.
e) Goal test: Are we at the final destination specified by the user?
f) Path cost: This depends on monetary cost, waiting time, flight time, customs and immigration
procedures, seat quality, time of day, type of airplane, frequent-flyer mileage awards, and so on.
2.The Traveling Salesperson Problem (TSP) is a touring problem in which each city must be visited
exactly once. The aim is to find the shortest tour.
The solution to a search problem is a sequence of actions called the plan that transforms the start state
to the goal state. This plan is achieved through search algorithms. Search algorithm is classified into 2 types
Uninformed Search
Uninformed search algorithms that are given no information about the problem other than its definition.
The basic algorithms are as follows:
a) Breadth-first search expands the shallowest nodes first; it is complete, optimal for unit step costs,
but has exponential space complexity.
b) Uniform-cost search expands the node with lowest path cost, g(n), and is optimal for general step
costs.
c) Depth-first search expands the deepest unexpanded node first. It is neither complete nor optimal,
but has linear space complexity.
d) Depth-limited search adds a depth bound.
Informed Search
Informed search methods may have access to a heuristic function h(n) that estimates the cost of a solution
from n.
a) The generic best-first search algorithm selects a node for expansion according to an evaluation
function.
b) Greedy best-first search expands nodes with minimal h(n). It is not optimal but is often efficient.
c) A∗ search expands nodes with minimal f(n) = g(n) + h(n). A∗ is complete and optimal, provided
that h(n) is admissible (for TREE-SEARCH) or consistent (for GRAPH-SEARCH). The space complexity
of A∗ is still prohibitive.
d) SMA∗ (simplified memory-bounded A∗) are robust, optimal search algorithms that use limited
amounts of memory; given enough time, they can solve problems that A∗ cannot solve because it
runs out of memory.
The performance of heuristic search algorithms depends on the quality of the heuristic function.