L1A Introduction To AI and Search
L1A Introduction To AI and Search
Definition of Intelligence
Human intelligence, mental quality that consists of the abilities to learn from experience, adapt to new
situations, understand and handle abstract concepts, and use knowledge to manipulate one’s environment.
Intelligence is the computational part of the ability to achieve goals in the world. Varying kinds and degrees
of intelligence occur in people, many animals and some machines.
Types of Intelligence
i) General intelligence: - Abilities that allow us to be flexible and adaptive thinkers, not necessarily tied to
acquired knowledge
ii) Linguistic-verbal intelligence: - Use words and language in various forms / Ability to manipulate language
to express oneself poetically. Linguistic intelligence is evident in poets, novelists, journalists, and effective
public speakers.
iii) Logical-Mathematical intelligence: - Ability to detect patterns / Approach problems logically / Reason
deductively. Logical intelligence is usually well developed in mathematicians, scientists, and detectives.
iv) Musical intelligence: - Recognize nonverbal sounds: pitch, rhythm, and tonal patterns. This intelligence
enables us to recognize, create, reproduce, and reflect on music, as demonstrated by composers,
conductors, musicians, vocalist, and sensitive listeners.
v) Spatial intelligence: - Typically thinks in images and pictures / Used in both arts and sciences. Core
capacities include mental imagery, spatial reasoning, image manipulation, graphic and artistic skills, and an
active imagination. Sailors, pilots, sculptors, painters, and architects all exhibit spatial intelligence.
vi) Intrapersonal intelligence: - Ability to understand oneself, including feelings and motivations / can
discipline themselves to accomplish a wide variety of tasks. Intra-personal intelligence involves not only an
appreciation of the self, but also of the human condition. It is evident in psychologist, spiritual leaders, and
philosophers.
vii) Interpersonal intelligence: - Ability to "read people"—discriminate among other individuals especially their
moods, intentions, motivations. Teachers, social workers, actors, and politicians all exhibit interpersonal
intelligence.
viii) Naturalist intelligence: - Ability to recognize and classify living things like plants, animals. Generally,
naturalist intelligence designates the human ability to discriminate among living things (plants, animals) as
well as sensitivity to other features of the natural world (clouds, rock configurations).
ix) Bodily-Kinesthetic intelligence: - Use one’s mental abilities to coordinate one’s own bodily movements.
This intelligence also involves a sense of timing and the perfection of skills through mind–body union.
Athletes, dancers, surgeons, and crafts people exhibit well-developed bodily kinesthetic intelligence
Within AI, there has not been a big effort to try to pass the Turing test. The issue of acting like a human comes
up primarily when AI programs have to interact with people, as when an expert system explains how it came to
its diagnosis, or a natural language processing system has a dialogue with a user.
Note: Emphasis is on how to tell if a machine is intelligent, not on how to make it intelligent
General Definition of AI
Artificial Intelligence is the field of computing that attempts at providing computational models of some human
activities, which are considered intelligent activities, such as learning, acting, decision making, evolving etc. AI,
therefore, relates strongly to fields such as psychology, biology and sociology.
Developing AI Systems
There are two main streams in developing AI systems: quantitative and qualitative approaches.
i). Quantitative approaches sometimes referred to as numerical approaches, because they use quantities in
analysing the problems. Neural nets, fuzzy logic, genetic algorithms are all examples of the quantitative
approaches.
ii). Qualitative approaches sometimes referred to as symbolic approaches, because they use qualities of the
problem to solve the problem. Logic, rules, lists based systems are examples of qualitative AI systems.
Theoretical Foundations to AI
Computer Science (tools for testing theories, programmability, speed, storage, actions)
Mathematics (Formalization of tasks and problems, logic, computation, probability)
Psychology (human reasoning, behaviourism, cognitive psychology)
Philosophy (nature of belief, rationality, theories of language, reasoning, learning, the mind)
Linguistics (structure and meaning of language, knowledge representation, natural language processing)
Human Biology (how brain works)
Main Branches of AI
i) Machine Vision: This is area dealing with visual recognition of objects. Cameras and sensors are used. The
challenges in it involve mapping visual realities to representations that allow easy pattern recognition. With
maturity computers can recognize their owners; vehicles can find their way around; robots can conduct
errands in the house etc.
ii) Speech Synthesis and Recognition: This is an area that attempt to find how to make computers recognize
voice inputs and respond vocally. The main challenges include speech recognition and generation. On
maturity computers can talk, discuss and take voice commands.
iii) Machine Learning: Here the investigation is focused on making computers acquire knowledge, skills and
be adaptive. The challenges include knowledge acquisition, knowledge representation, learning operators
and how to help humans learn. On maturity computers will learn from experience, solve problems and be
adaptive.
iv) Robotics: Here the investigation is focused on movement and positioning of arms and other parts. The main
challenges include the arm positioning and locating positions. On maturity the robots will be used for
additional domestic and industrial applications. Currently they are used for such industrial applications such
as assembling and welding.
vi) Problem Solving: This is an area that originally attempted to build a general problem solver. Its focus was
later revised to specialized problem solvers such as expert systems. Its main challenges include finding out
how to formulate the problems, looking or searching for solutions, representing knowledge. On maturity,
computers will solve various problems and problem solving can be embedded into many industrial
applications.
Characteristics of AI Programs
a) Symbolic Processing: - Symbolic processing is reasoning about objects represented by symbols, and their
properties and relationships, rather than numerical calculations. Generally A.I. programs primarily use
symbolic representations: collections of symbols that represent: objects, properties of objects, relationships
among objects and rules about classes of objects.
b) Knowledge Representation: - Knowledge is the general principles that are stored in the program and used
for reasoning about novel situations. This knowledge is represented by some kind of data structures in the
machine's memory that reflect the complexity of the real world. Several kinds of knowledge need to be
represented such as factual Data, general principles, hypothetical data etc.
c) Search: - This is a method for finding a solution to a problem when no direct method exists. Search
programs find a solution for a problem by trying different sequences of actions (operators) until a solution
is found.
d) Heuristics: - Are similar to rules of thumb where you need not rethink completely what to do every time a
similar problem is encountered.
e) Inferencing: - This is a form of reasoning with facts and rules using heuristics or some search strategies.
Search Terminology
States: “places” the search can visit
Search space: the set of possible states
Search path: Sequence of states the agent actually visits
Solution:
– A state which solves the given problem, either known or has a checkable property
– May be more than one solution
Strategy: How to choose the next state in the path at any given state
Process of Searching
Searching proceeds as follows:
1. Check the current state;
2. Execute allowable actions to move to the next state;
3. Check if the new state is the solution state; if it is not then the new state becomes the current
state and the process is repeated until a solution is found or the state space is exhausted.
Search problem
The search problem consists of finding a solution plan, which is a path from the current state to the goal state.
Possible moves
Put a block on table;
Put a block on top of another block;
Remove a block from the top of another and place on top of another block.
Search Problem
Initial state (current state)
C
A
B
C B
B B C C
A AC ABC AB A
B C
AC AB
A A
B C
C B
The state space has 13 elements or nodes. The solution to our problem is any member of the set of all paths
from original to goal state such as the path indicated in bold.
Search Strategies
A search strategy is defined by picking the order of node expansion. Different search strategies are evaluated in
terms of four criteria:
1. Completeness: is the strategy guaranteed to find a solution when there is one?
2. Time complexity: how long does it take to find a solution?
3. Space complexity: how much memory does it need to perform the search?
4. Optimality: does the strategy find the highest quality solution when there are several different solutions?
Types of Searches
There are two broad classes of searches:
i) Uninformed search (blind / Exhaustive search)
ii) Informed search (Heuristic/ Guided search)
Note: Breadth first search can only be used for small problems. If we have larger problems to solve then there
are better blind search strategies that can be used as depth first search.
2) Informed search: -
Is a search that uses domain-dependent (heuristic) information in order to search the space more efficiently.
The idea behind a heuristic search is to explore the node that is most likely to be nearest to a goal state. To
do this, a heuristic function which tells us how close we are to a goal state is used. Heuristic is used as an
estimate, based on domain-specific information that is computable from the current state description, of
how close we are to a goal
The following are the various heuristic search algorithms:
i). Uniform-cost search
ii). Hill climbing
iii). Greedy search
iv). A* search
v). IDA* search
i). Uniform-cost search:- Looks for the cheapest path from the start node to a goal node. i.e. this method
always extends the cheapest path found so far. In this way it is guaranteed to find the cheapest path, if
one exists. Generally, uniform cost search will find the cheapest solution provided that the cost of the
path never decreases as we proceed along the path. If this requirement is not met then we never know
when we will meet a negative cost. The result of this would be a need to carry out an exhaustive search
of the entire tree.
A 4 4
B C
3
S 5
5
4 G
D E F 3
2 4
Using the problem defined above, find the shortest route from S to G; that is S is the initial state and G
is the goal state
step 1
S
3 4
step 2 step 3
A 3 4 D
4 5 5 2
step 5
B 7 8 D A 9 6 E step 4
4 5 5 4
C 11 12 E 11 B F 10 step 6
3
G 13
In summary, uniform cost search will find the cheapest solution provided that the cost of the path never
decreases as we proceed along the path. If this requirement is not met then we never know when we will
meet a negative cost. The result of this would be a need to carry out an exhaustive search of the entire
tree.
ii). Hill climbing:- Hill climbing is depth-first search with a heuristic measurement that orders choices as
nodes are expanded. It always selects the most promising successor of the node last expanded. For
instance, one may consider that the most promising successor of a node is the one that has the shortest
straight-line distance to the goal city G. In figure below, the straight line distances between each city and
G is indicated in square brackets.
[10] S 5
5
4 G
D E F 3
2 4
[8] [6] [3]
A 8.5 8 D
A 8.5 6 E
6 B F 3
G
iii). Greedy Search: - The node closest to the goal state, as determined by an evaluation function f(n) = h(n),
is expanded first. Generally it selects node to expand that is believed to be closest (hence it's "greedy")
to a goal node (i.e., smallest f value).
A Heuristic Function (h(n)) is a function that calculates the cost of reaching the goal state from the node
n.
Issues:
Finds solution quickly
Doesn’t always find the best solution, since it evaluates the immediate best choice, not the long
term options.
Can fall prey to false starts i.e expands a node that leads to a dead end (not complete).
iv). The search algorithm A*: - is a refinement of the greedy search due to the fact that it is neither optimal
nor complete. The goal of the A* algorithm is to find a minimal cost-path joining the start node and a
goal node. It uses the following evaluation function to estimate the promise of a node n:
Notice that A* is very similar to the uniform-cost search, except that it uses a different function (which
is a heuristic function) to estimate the promise of a node.
In fact, A* reduces to uniform-cost search if h*(n) is always considered to be 0.
Example
Use A* algorithm to find the path from city S to city G by using the following functions:
[10] S 5
5
4 G
D E F 3
2 4
[8] [6] [3]
In the above figure, the value of h* for each node is represented in square brackets. That is, h*(D) = 8.
step 1 S
g*(A)=3 3 4 g*(D)=4
h*(A)=8.5 h*(D)=8
f*(A)=3+8.5 A 11.5 12 D f*(D)=4+8
step 2 4 5 5 2 step 3
C 14 18 E 11+6 B 17 13 F 10+3
step 6
3
13 G