AI Unit-1
AI Unit-1
Intelligence is defined as mental capability that involves the ability to reason, to plan, to solve problems,
to think abstractly, to comprehend complex ideas, to learn quickly and to learn from experience. It is not
merely book learning, a narrow academic skill, or test-taking smartness.
In simple words, intelligence is nothing but thinking skills and the ability to adapt to and to learn from
life’s everyday experiences.
The intelligence is intangible. It is composed of −
Reasoning
Learning
Problem Solving
Perception
Linguistic Intelligence
Artificial Intelligence
According to the father of Artificial Intelligence John McCarthy, it is “The science and engineering of
making intelligent machines, especially intelligent computer programs”.
Artificial Intelligence is a way of making a computer, a computer-controlled robot, or a software think
intelligently, in the similar manner the intelligent humans think.
Artificial intelligence (AI) is an area of computer science that emphasizes the creation of intelligent
machines that work and react like humans. Some of the activities computers with artificial intelligence
are designed for include:
o Speech recognition
o Learning
o Planning
o Problem solving
Applications of AI
AI has been dominant in various fields such as −
1. Gaming − AI plays crucial role in strategic games such as chess, poker, tic-tac-toe, etc., where
machine can think of large number of possible positions based on heuristic knowledge.
2. Natural Language Processing − It is possible to interact with the computer that understands natural
language spoken by humans.
3. Expert Systems − There are some applications which integrate machine, software, and special
information to impart reasoning and advising. They provide explanation and advice to the users.
4. Vision Systems − These systems understand, interpret, and comprehend visual input on the
computer. For example,
o A spying aero plane takes photographs, which are used to figure out spatial information
or map of the areas.
o Doctors use clinical expert system to diagnose the patient.
o Police use computer software that can recognize the face of criminal with the stored
portrait made by forensic artist.
5. Speech Recognition − Some intelligent systems are capable of hearing and comprehending the
language in terms of sentences and their meanings while a human talks to it. It can handle different
accents, slang words, noise in the background, change in human’s noise due to cold, etc.
6. Handwriting Recognition − The handwriting recognition software reads the text written on paper
by a pen or on screen by a stylus. It can recognize the shapes of the letters and convert it into
editable text.
7. Intelligent Robots − Robots are able to perform the tasks given by a human. They have sensors to
detect physical data from the real world such as light, heat, temperature, movement, sound, bump,
and pressure. They have efficient processors, multiple sensors and huge memory, to exhibit
intelligence. In addition, they are capable of learning from their mistakes and they can adapt to the
new environment.
State Spaces
One general formulation of intelligent action is in terms of state space. A state contains all of the
information necessary to predict the effects of an action and to determine if it is a goal state. State-space
searching assumes that
the agent has perfect knowledge of the state space and can observe what state it is in (i.e., there is
full observability);
the agent has a set of actions that have known deterministic effects;
some states are goal states, the agent wants to reach one of these goal states, and the agent can
recognize a goal state; and
a solution is a sequence of actions that will get the agent from its current state to a goal state.
A state-space problem consists of
a set of states;
a distinguished set of states called the start states;
a set of actions available to the agent in each state;
an action function that, given a state and an action, returns a new state;
a set of goal states, often specified as a Boolean function, goal(s), that is true when s is a goal state;
and
a criterion that specifies the quality of an acceptable solution. For example, any sequence of actions
that gets the agent to the goal state may be acceptable, or there may be costs associated with actions
and the agent may be required to find a sequence that has minimal total cost. This is called an
optimal solution. Alternatively, it may be satisfied with any solution that is within 10% of optimal.
Production rules
The production rules operate on the global database. Each rule has a precondition that is either satisfied
or not by the database. If the precondition is satisfied, the rule can be applied. Application of the rule
changes the database. The control system chooses which applicable rule should be applied and ceases
computation when a termination condition on the database is satisfied. If several rules are to fire at the
same time, the control system resolves the conflicts.
Problem Characteristics
A problem may have different aspects of representation and explanation. In order to choose the most
appropriate method for a particular problem, it is necessary to analyze the problem along several key
dimensions. Some of the main key features of a problem are given below.
Is the problem decomposable into set of sub problems?
Can the solution step be ignored or undone?
Is the problem universally predictable?
Is a good solution to the problem obvious without comparison to all the possible solutions?
Is the desire solution a state of world or a path to a state?
Is a large amount of knowledge absolutely required to solve the problem?
Will the solution of the problem required interaction between the computer and the person?
The above characteristics of a problem are called as 7-problem characteristics under which the solution
must take place.
Algorithm:
Step 1: Place the root node inside the queue.
Step 2: If the queue is empty then stops and return failure.
Step 3: If the FRONT node of the queue is a goal node then stop and return success.
Step 4: Remove the FRONT node from the queue. Process it and find all its neighbours that are in ready
state then place them inside the queue in any order
Step 5: Go to Step 3.
Step 6: Exit.
Implementation:
Let us implement the above algorithm of BFS by taking the following suitable example.
Consider the graph in which let us take A as the starting node and F as the goal node (*)
Step 1:
A
Step 2:
Now the queue is not empty and also the FRONT node i.e. A is not our goal node. So move to step 3.
Step 3:
So remove the FRONT node from the queue i.e. A and find the neighbour of A i.e. B and C
B C A
Step 4:
Now b is the FRONT node of the queue .So process B and finds the neighbours of B i.e. D.
C D B
Step 5:
D E C
Step 6:
Next find out the neighbours of D as D is the FRONT node of the queue
E F D
Step 7:
Now E is the front node of the queue. So the neighbour of E is F which is our goal node.
F E
Step 8:
Finally F is our goal node which is the FRONT of the queue. So exit.
Advantages:
Disadvantages:
Concept:
Step 4: This process will continue until we are getting the goal node.
Algorithm:
Step 3: If the top node of the stack is the goal node, then stop and return success.
Step 4: Else POP the top node from the stack and process it. Find all its neighbours that are in ready
state and PUSH them into the stack in any order.
Step 5: Go to step 3.
Step 6: Exit.
Implementation:
Step 2: Now the stack is not empty and A is not our goal node. Hence move to next step.
Step 3: POP the top node from the stack i.e. A and find the neighbours of A i.e. B and C.
B C A
Step 4: Now C is top node of the stack. Find its neighbours i.e. F and G.
B F G C
Step 5: Now G is the top node of the stack. Find its neighbour i.e. M
B F M G
Step 6: Now M is the top node and find its neighbour, but there is no neighbours of M in the graph so
POP it from the stack.
B F M
Step 7: Now F is the top node and its neighbours are K and L. so PUSH them on to the stack.
B K L F
Step 8: Now L is the top node of the stack, which is our goal node.
B K L
Also you can traverse the graph starting from the root A and then insert in the order C and B into the
stack. Check your answer.
Advantages:
Disadvantages: