Professional Documents
Culture Documents
CHAPTER - 1 The test involves an interrogator who interacts with one human
Introduction to AI and one machine. He must decide which is which. If he is wrong
half the time, then the machine is intelligent
1.1 What is AI?
To pass the Turing Test, the computer would need to possess the
Intelligence following capabilities:
· The intelligence is the ability to learn, understand and create, to solve problems and to make
decision. Natural language processing to enable it to communicate successfully in English;
Intelligence involves sensing, thinking, and acting. Knowledge representation to store what it knows or hears;
Automated reasoning to use the stored information to answer questions and to draw new
conclusions;
Machine learning to adapt to new circumstances and to detect and extrapolate patterns.
SENSING THINKING ACTING
If there is no direct physical interaction between the interrogator and the computer, it is called
Manipulation of the conceptual Translation of intent into ―Total Turing Test‖. The requirements for the ―total Turing test‖: computer vision, speech
Translation of sensory inputs (percepts) into a conceptual representation (physical) actions (reflexive or recognition, speech synthesis, robotics.
representation deliberative)
- Knowledge
- Computer Vision Representation - Robotics B) Thinking humanly: The cognitive modeling approach
- Speech Recognition - Problem - Speech and Language The human mind can think three ways: (i) through introspection —trying to catch our own
- Language Understanding Solving/Planning Synthesis thoughts as they go by; (ii) through psychological experiments—observing a person in action; and
- Learning (making (iii) through brain imaging—observing the brain in action. Cognitive Science embraces computer
improvements models from AI and experimental methods from psychology.
based on the results
of past actions)
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
AI Today
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
■ Finite state model consists of a set of states, a set of input events and the relations
[1, 2] [ ] []
between them. Given a current state and an input event you can determine the
next current state of the model.
■ Transition relation: If a pair of states (S, S') is such that one move takes the
[] [ ] [1, 2] [1] [ ] [2] [1] [2] [ ] [ ] [1, 2] [ ]
system from S to S', then the transition relation is represented by S => S’
Towers of Hanoi puzzle
■ Examples of some possible transitions between states are shown for the Towers of
Hanoi puzzle.
■ Puzzle : Towers of Hanoi with only 2 disks
Move the disks from the leftmost post to the rightmost post while never putting
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
The “going on strike” and “increasing productivity” are alternative ways of trying
ii. Goal Reduction to “earn more money” (increase pay).
■ Goal-reduction process is illustrated in the form of AND/OR tree drawn upside- ◊ Conjoint sub-goals
To “provide for old age”, not only need to “earn more money”, but as well need
down.
to “save money”.
◊ Goal levels : Higher-level goals are higher in the tree, and lower- level goals
are lower in the tree.
iii. Constraint Satisfaction Techniques
◊ Arcs are directed from a higher-to-lower level node represents the reduction of
higher-level goal to lower-level sub-goal. ■ Constraint satisfaction is a process of finding a solution to a set of constraints –
◊ Nodes at the bottom of the tree represent irreducible action goals. the constraints express allowed values for variables and finding solution is
■ An AND-OR tree/graph structure can represent relations between goals and sub- evaluation of these variables that satisfies all constraints.
goals, alternative sub-goals and conjoint sub-goals. ■ Constraint Satisfaction Problem (CSP) and its solution
■ Example Goal Reduction
◊ A Constraint Satisfaction Problem (CSP) consists of :
AND-OR tree/graph structure to represent facts such as “enjoyment”, ‡ Variables, a finite set X = {x1 , . . . , xn } ,
“earning/save money”, “old age” etc. ‡ Domain, a finite set Di of possible values which each variable xi can take,
‡ Constraints, a set of values that the variables can simultaneously satisfy the
constraint (e.g. D1 != D2)
The above AND-OR tree/graph structure describes ◊ Apply "no-threatening" constraints between each couple Ri and Rj
of queens and evolve the algorithm.
◊ Hierarchical relationships between goals and subgoals
The “going on strike” is a sub-goal of “earning more money”, is a sub-goal of
“improving standard of living ”, is a sub-goal of “improving enjoyment of
life”.
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
3 3 3 3
vi. Generate and Test (GT)
2 2 2 2
1 1 1 1 * Generate-and-test method
a b c d e f g h a b c d e f g h
The method first guesses the solution and then tests whether this solution is
Unique solution 1 Unique solution 2 correct, means solution satisfies the constraints.
* In the case of a dead end - backtrack to the last node in the tree where a previously
unexplored path branches of, and test this path.
◊ Best-first search
* Like beam search but only proceeding from one "most likely" node at each
level.
https://bit-papers.blogspot.com/ ©17171R
Artificial Intelligence Artificial Intelligence
b. The world is composed of 3-D objects, but the inputs to the human eye and
computers' TV cameras are 2-D.
c. Some useful programs can work solely in 2-D, but full computer vision
requires partial 3-D information that is not just a set of 2-D views.
Applications Of AI
d. At present there are only limited ways of representing 3-D information
You can buy machines that can play master level chess for a few hundred dollars. There is some
AI in them, but they play well against people mainly through brute force computation--looking at directly, and they are not as good as what humans evidently use.
hundreds of thousands of positions. To beat a world champion by brute force and known reliable
heuristics requires being able to look at 200 million positions per second. e. Examples
i. Speech recognition
◊ Face recognition :
a. A process of converting a speech signal to a sequence of words; the programs in use by banks
b. In 1990s, computer speech recognition reached a practical level for ◊ Autonomous driving :
limited purposes. The ALVINN system, autonomously drove a van from Washington,
D.C. to San Diego, averaging 63 mph day and night, and in all
c. Using computers recognizing speech is quite convenient, but most users find
weather conditions.
the keyboard and the mouse still more convenient.
◊ Other usages
d. The typical usages are : Handwriting recognition, Baggage inspection, Manufacturing inspection,
◊ Voice dialing (Call home), Photo interpretation, etc .
◊ Call routing (collect call), v. Expert systems
◊ Data entry (credit card number). A ``knowledge engineer'' interviews experts in a certain domain and tries to embody their
◊ Speaker recognition. knowledge in a computer program for carrying out some task. How well this works depends
ii. Game playing
on whether the intellectual mechanisms required for the task are within the present state of
a. Games are Interactive computer program, an emerging area in which the
AI. When this turned out not to be so, there were many disappointing results. One of the first
goals of human-level AI are pursued.
expert systems was MYCIN in 1974, which diagnosed bacterial infections of the blood and
b. Games are made by creating human level artificially intelligent entities, suggested treatments. It did better than medical students or practicing doctors, provided its
e.g. enemies, partners, and support characters that act just like humans. limitations were observed. Namely, its ontology included bacteria, symptoms, and treatments
Compiled By: Bhawana Bam Email: bhawana70003@gmail.com Compiled By: Bhawana Bam Email: bhawana70003@gmail.com
https://bit-papers.blogspot.com/ ©17171R
Artificial Intelligence Artificial Intelligence
$sagarMalla
and did not include patients, doctors, hospitals, death, recovery, and events occurring in time.
2016 Batch Artificial intelligence helps us in reducing the error and the chance of reaching accuracy
19171R
with a greater
Its interactions depended on a single patient being considered. Since the experts consulted degree of precision is a possibility. It is applied in various studies such as exploration of space.Intelligent
by the knowledge engineers knew about patients, doctors, death, recovery, etc., it is clear robots are fed with information and are sent to explore space. Since they are machines with metal bodies,
that the knowledge engineers forced what the experts told them into a predetermined they are more resistant and have greater ability to endure the space and hostile atmosphere.
framework.
They are created and acclimatized in such a way that they cannot be modified or get disfigured or
vi. Heuristic classification
breakdown in the hostile environment.
One of the most feasible kinds of expert system given the present knowledge of AI is to put
some information in one of a fixed set of categories using several sources of information. An 2. Difficult Exploration:
example is advising whether to accept a proposed credit card purchase. Information is available
about the owner of the credit card, his record of payment and also about the item he is buying and Artificial intelligence and the science of robotics can be put to use in mining and other fuel exploration
about the establishment from which he is buying it (e.g., about whether there have been processes. Not only that, these complex machines can be used for exploring the ocean floor and hence
previous credit card frauds at this establishment). overcome the human limitations.Due to the programming of the robots, they can perform more laborious
and hard work with greater responsibility. Moreover, they do not wear out easily.
Foundations of AI
Different fields have contributed to AI in the form of ideas, viewpoints and techniques. 3. Daily Application:
Philosophy:
Logic, reasoning, mind as a physical system, foundations of learning, language and rationality. Computed methods for automated reasoning, learning and perception have become a common phenomenon
in our everyday lives. We have our lady Siri or Cortana to help us out. We are also hitting the road for long
Mathematics:
Formal representation and proof algorithms, computation, undecidability, intractability, probability. drives and trips with the help of GPS. Smartphone in an apt and every day is an example of the how we use
Psychology: artificial intelligence. In utilities, we find that they can predict what we are going to type and correct the
adaptation, phenomena of perception and motor control. human errors in spelling. That is machine intelligence at work.
Economics:
formal theory of rational decisions, game theory. When we take a picture, the artificial intelligence algorithm identifies and detects the person’s face and tags
Linguistics: the individuals when we are posting our photographs on the social media sites. Artificial Intelligence is
Knowledge representation, grammar
widely employed by financial institutions and banking institutions to organize and manage data. Detection
Neuroscience:
of fraud uses artificial intelligence in a smart card based system.
Physical substrate for mental activities
Control theory:
Homeostatic systems, stability, optimal agent design 4. Digital Assistants:
Highly advanced organizations use ‘avatars’ which are replicas or digital assistants who can actually
Advantages of Artificial Intelligence:
interact with the users, thus saving the need for human resources. For artificial thinkers, emotions come in
the way of rational thinking and are not a distraction at all. The complete absence of the emotional side,
Artificial intelligence is complex in nature. It uses very complicated mixture of computer science,
makes the robots think logically and take the right program decisions. Emotions are associated with moods
mathematics and other complex sciences. Complex programming helps these machines replicate the
that can cloud judgment and affect human efficiency. This is completely ruled out for machine intelligence.
cognitive abilities of human beings.
1. Error Reduction:
Compiled By: Bhawana Bam Email: bhawana70003@gmail.com Compiled By: Bhawana Bam Email: bhawana70003@gmail.com
https://bit-papers.blogspot.com/ ©17171R
Artificial Intelligence Artificial Intelligence
$sagarMalla
5. Repetitive Jobs:
2016 Batch 2. No Replicating Humans: 19171R
Repetitive jobs which are monotonous in nature can be carried out with the help of machine intelligence. Intelligence is believed to be a gift of nature. An ethical argument continues, whether human intelligence is
Machines think faster than humans and can be put to multi-tasking. Machine intelligence can be employed to be replicated or not.
to carry out dangerous tasks. Their parameters, unlike humans, can be adjusted. Their speed and time are
calculation based parameters only. Machines do not have any emotions and moral values. They perform what is programmed and cannot make
the judgment of right or wrong. Even cannot take decisions if they encounter a situation unfamiliar to them.
When humans play a computer game or run a computer-controlled robot, we are actually interacting with They either perform incorrectly or breakdown in such situations.
artificial intelligence. In the game we are playing, the computer is our opponent. The machine intelligence
plans the game movement in response to our movements. We can consider gaming to be the most common 3. No Improvement with Experience:
use of the benefits of artificial intelligence.
Unlike humans, artificial intelligence cannot be improved with experience. With time, it can lead to wear
and tear. It stores a lot of data but the way it can be accessed and used is very different from human
6. Medical Applications:
intelligence.
In the medical field also, we will find the wide application of AI. Doctors assess the patients and their
health risks with the help of artificial machine intelligence. It educates them about the side effects of Machines are unable to alter their responses to changing environments. We are constantly bombarded by
various medicines. the question whether it is really exciting to replace humans with machines.
Medical professionals are often trained with the artificial surgery simulators. It finds a huge application in In the world of artificial intelligence, there is nothing like working with a whole heart or passionately. Care
detecting and monitoring neurological disorders as it can simulate the brain functions. or concerns are not present in the machine intelligence dictionary. There is no sense of belonging or
togetherness or a human touch. They fail to distinguish between a hardworking individual and an
Robotics is used often in helping mental health patients to come out of depression and remain active. A inefficient individual.
popular application of artificial intelligence is radiosurgery. Radiosurgery is used in operating tumours and
this can actually help in the operation without damaging the surrounding tissues. 4. No Original Creativity:
Machines, unlike humans, do not require frequent breaks and refreshments. They are programmed for long These are not the forte of artificial intelligence. While they can help you design and create, they are no
hours and can continuously perform without getting bored or distracted or even tired. match for the power of thinking that the human brain has or even the originality of a creative mind.
Disadvantages of Artificial Intelligence: Human beings are highly sensitive and emotional intellectuals. They see, hear, think and feel. Their
thoughts are guided by the feelings which completely lacks in machines. The inherent intuitive abilities of
Creation of artificial intelligence requires huge costs as they are very complex machines. Their repair and
maintenance require huge costs.
They have software programs which need frequent up gradation to cater to the needs of the changing
environment and the need for the machines to be smarter by the day.
Compiled By: Bhawana Bam Email: bhawana70003@gmail.com Compiled By: Bhawana Bam Email: bhawana70003@gmail.com
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
[Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 1 [Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 2
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
“An agent that can form representations of the world, use a process of inference to 2.5 Properties / types of environment
derive new references of the world and use these new representatives to decide what to do.
The range of task environments that might arise in Ai is obviouslyvast. We can, however, identifya
v. Proactiveness: fairlysmall number of dimensions along which task environments can be categorized. These
– Generating and attempting to achieving goals dimensions determine, to a large extent, the appropriate agent design and the applicability of each of
– Executing actions /giving advice/making recommendations /making the principal families of techniques for agent implementation.
The environment is where agent lives, operate and provide the agent with something to sense · Deterministic / Non-deterministic − If the next state of the environment is
and act upon it. An environment is mostly said to be non-feministic. completely determined by the current state and the actions of the agent, then the
environment is deterministic (e.g. Chess); otherwise it is non-deterministic (e.g.
In contrast, some software agents (software robots or softbots) exist in rich, unlimited Taxi driving).
softbots domains. The simulator has a very detailed, complex environment. The software
agent needs to choose from a long array of actions in real time. A softbot designed to scan · Episodic / Non-episodic − In an episodic environment, each episode consists of the
the online preferences of the customer and show interesting items to the customer works in agent perceiving and then acting. The quality of its action depends just on the
the real as well as an artificial environment. episode itself. Subsequent episodes do not depend on the actions in the previous
episodes. Episodic environments are much simpler because the agent does not need
The most famous artificial environment is the Turing Test environment, in which one real to think ahead.(e.g. Image analysis); In non-episodic environment , the current
and other artificial agent are tested on equal ground. This is a very challenging decision could affect all future decisions e.g. chess.
environment as it is highly difficult for a software agent to perform as well as a human.
[Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 3 [Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 4
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
[Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 5 [Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 14
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
They use a model of the world to choose their actions. They maintain an internal state.
[Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 14 [Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 14
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
v. Learning Agents
o A learning agent in AI is the type of agent which can learn from its past experiences, or it has
learning capabilities.
o It starts to act with basic knowledge and then able to act and adapt automatically through
learning.
o A learning agent has mainly four conceptual components, which are:
a. Learning element: It is responsible for making improvements by learning from
4. Utility Based Agents environment
b. Critic: Learning element takes feedback from critic which describes that how well
An agent generates a goal state with high –quality behavior(utility) that is , if more than one the agent is doing with respect to a fixed performance standard.
sequence exists to reach the goal state then the sequence with more reliable,safer,quicker and c. Performance element: It is responsible for selecting external action.
cheaper than others to be selected. d. Problem generator: This component is responsible for suggesting actions that will
lead to new and informative experiences.
o These agents are similar to the goal-based agent but provide an extra component of utility
measurement which makes them different by providing a measure of success at a given state. o Hence, learning agents are able to learn, analyze performance, and look for new ways to
improve the performance.
o Utility-based agent act based not only goals but also the best way to achieve the goal.
o The Utility-based agent is useful when there are multiple possible alternatives, and an agent
has to choose in order to perform the best action.
o The utility function maps each state to a real number to check how efficiently each action
achieves the goals.
· There are conflicting goals, out of which only few can be achieved.
· Goals have some uncertainty of being achieved and you need to weigh likelihood of
success against the importance of a goal.
[Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 14 [Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 14
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Sensors: The device or components through which the agent observes and perceives it’s
environment are the sensors of the agent.
Agents include humans, robots, softbots, thermostats, etc. The agent function maps from Medical Healthy Patient, Display of Keyboard entry of
diagnosis patient, hospital, Staff, questions,
percept histories to actions: system reduced costs pharmacy tests, symptoms, findings,
f : P ∗ → A. diagnoses, patient’s answers, Web
treatments,
The agent program runs on the physical architecture to produce f . referrals. pages (text, graphics,
Display to user, scripts. . .)
follow URL, fill in
PEAS form
PEAS stand for performance, Environment, Actuators, and Sensors. Based on these properties of an Safety, time, Roads, other Steering, sonar, Camera, Sonar, GPS, speedometer
Self legal drive, card , GPS, , accelerometer, engine sensor,
agent, they can be grouped together or can be differentiated from each other. Each agent has these driving comfort pedestrians , speedometer, keyboard
car traffic signs etc. ,keyboard etc.
following properties defines for it.
Performance: The output which we get from the agent .All the necessary results that an agent gives
Interactive Student’s Set of students, Display of Keyboard entry
after processing comes under its performance. English score on test testing agency exercises,
Environment: All the surrounding things and conditions of an agent fall in this section. It basically Tutor suggestions,
corrections
consists of all things under which the agent works. Fig: Examples of agent types and their PEAS description
Actuators: The devices, hardware or software through which the agent performs any actions or
processes any information to produce a result.
[Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 14 [Compiled By: Bhawana Bam –Artificial Intelligence (Email:bhawana70003@gmail.com)] Page 14
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
CHAPTER -3 3.3 Problem Formulation and problem Definition
Problem formulation means choosing a relevant set of states to consider and a feasible set of operators for moving from
Problem Solving Using Searching one state to another.
3.1 Introduction
Search is the process of considering various possible sequence of operates applied to the initial state and finding out the
– A problem is a situation which is experienced by an agent. A problem is solved by a sequence of
sequence which culminates in the goal state.
actions that reduce the different between the initial situation and the goal.
A search problem consist of the following:
– Problem solving is a mental process that involves the defining a problem; determining the cause
S:the full set of staes
of the problem; identifying, prioritizing and selecting alternatives for a solution; and implementing a
S0: the initial state
solution.
A Sà S is a set of operators
- Problem solving is a agent based system that finds sequence of actions that lead to G is the set of final states.G is the subset of S.
desirable states from the initial state. The search problem is to find the sequence of actions which transform the agent from the initial state to the goal state.
1 2
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
i. Toy problem
The first example we examine is the vacuum world. This can be formulated as aproblem as follows:
· States: The state is determined by both the agent location and the dirt locations. The agent
is in one of two locations, each of which might or might not contain dirt. Thus, there are 2
2 2
x 2 =8 possible world sates. The larger environment with n locations has n.n states.
· Initial state: Any state can be designed as the initial state.
· Actions: In this simple environment, each state has just three actions: Left, right, and Suck.
Larger environment might also include UP and DOWN.
3.4 State Space Representation of Problem
· Transition model: The actions have their expected effects, except that moving Left in the
leftmost square, moving Right in the rightmost square, and Sucking in a clean square have no – A set of all possible states for a given problem is known as state space for that
effect. problem. The major components of state space representation are: (a) Initial state,
(b) Goal state, and (c) operator or legal moves.
· Goal test: This checks whether all the squares are clean.
· Path Cost: Each step cost 1, so the path coast is the number of steps in the path. – Many problems in AI take the form of state-space search. The states might be legal board
configurations in a game, towns and cities in some sort of route map, Collections of
mathematical propositions, etc.
– The state-space is the configuration of the possible states and how they connect to each
other e.g. the legal moves between states.
– When we don't have an ; which tells us definitively how to negotiate the state-space we
need to search the state-space to find an optimal path from a start state to a goal state.
i. Let us consider a problem of 8-tile puzzle game. The puzzle consists of an 8-square frames and
an empty slot. The tiles are numbered from 1-8. It is possible to move the tiles in the square
field by moving tile into the empty slot. The objective is to get square in a numeric order.
ii. 8 puzzle
3 4
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
8. if x + y ≥ 3 and x > 0 Pour water from the 4-gallon jug into the 3-gallon
(x,y) à (x – (3 – y), 3) jug until the 3-gallon jug is full
9. if x + y ≤ 4 and y > 0 (x,y) à (x + y, 0) Pour all the water from the 3-gallon jug into the 4-
gallon jug
10. if x + y ≤ 3 and x > 0 (x,y) à (0, x + y) Pour all the water from the 4-gallon jug into the 3-
gallon jug
5 6
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
7 8
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Steps in Searching
1. Check whether the current state is the goal state or not? Uninformed search strategies
2. Expand the current state to generate the new sets of states.
- These types of search strategies are provided with the problem definition and these don’t have
3. Choose one of the new states generated for search depending upon search strategy.
additional information about the state space.
4. Repeat step 1 to 3 until the goal state is reached or there are no more state to be
- These can only expand current state to get a new set of states and distinguish a goal state
expanded.
from non-goal state.
Performance Measure of the Algorithm - The uninformed search does not contain any domain knowledge such as closeness, the location of
• Strategies are evaluated along the following dimensions: the goal. It operates in a brute-force way as it only includes information about how to traverse the
o Completeness: does it generate to find a solution if there is any? tree and how to identify leaf and goal nodes.
o Optimality: does it always find the highest quality (least-cost) solution? - It examines each node of the tree until it achieves the goal node.
o Time complexity: How long does it take to find a solution? - Less effective than informed search.
- Distinguish goal state from non goal state
o Space complexity: How much memory does it need to perform the search?
- Time and space complexity are measured in terms of It can be divided into five main types:
b: maximum branching factor of the search tree
d: depth of the least-cost solution o Breadth-first search
m: maximum depth of the state space (may be ∞) o Uniform cost search
Types of Search/Searching strategies: o Depth-first search
• A search strategy is defined by picking the order of node expansion
o Iterative deepening depth-first search
o Bidirectional 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.
· Starting from the root node (initial state) explores all children of the root node, left to right
· If no solution is found, expands the first (leftmost) child of the root node, then expands the
i. Uninformed (Blind) Search second node at depth 1 and so on …
ii. Informed ( Heuristic)Search
9 10
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
o It requires lots of memory since each level of the tree must be saved into memory to expand the next
level.
o BFS needs lots of time if the solution is far away from the root node.
Put the start node in the queue, Examine the first element of the queue. If it is the goal, stop,
otherwise put its children in the queue
Weakness
• We may get stuck going down an infinite branch that doesn’t lead to a solution.
• As in given figure, suppose our solution is on right branch at depth level 1, but DFS
search proceeds down left branch and continues its search upto 1000’s of nodes. It might get
stuck in that branch without solution.
Properties of depth-first search
Properties of Breadth-First Search • Completeness: Incomplete as it may get stuck down going down an infinite branch that doesn’t
leads to solution.
• Completeness: Complete if the goal node is at finite depth • Optimality: The first solution found by the DFS may not be shortest.
• Optimality: It is guaranteed to find the shortest path • Space complexity: b as branching factor and d as tree depth level, Space complexity =
O(b.d)
• Time complexity
Time complexity = O(bd+1) • Time Complexity: O(bd)
• Space Complexity: O(bd+1) • Looks for the goal node among all the children of the current node before using the sibling of this
node i.e. expand deepest unexpanded node.
Weakness of BFS • Fringe is implemented as a LIFO queue (=stack)
• High time and memory requirements
11 12
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
iii. Uniform Cost Search:
- Breadth first Search finds the shallowest goal but it’s not always sure to find the optimal solution.
- Uniform cost search can be used if the cost of travelling from one node to another is
S
Available.
- Uniform cost search always expands the lowest cost node on the fringe (the collection of nodes that are
waiting to be expanded.)
A
- The first solution is guaranteed to be the cheapest one because a cheaper one is expanded
earlier and so would have been found first.
Uniform cost search example (Find path from A to E)
B
• Expand A to B,C,D
• The path to B is the cheapest one with path cost 2.
C E • Expand B to E
• Total path cost = 2+9 =11
• This might not be the optimal solution since the path AC as path
D F cost 4 ( less than 11)
• Expand C to E
• Total path cost = 4+5 =9
• Path cost from A to D is 10 ( greater than path cost, 9)
G
• Hence optimal path is ACE
DFS Evaluation:
Disadvantage
Completeness;
Does not care about the no of steps a path has but only about their cost. Hence it might get stuck in an
– Does it always find a solution if one exists?
– NO infinite loop if it expands a node that has a zero cost action leading back to same state.
– If search space is infinite and search space contains loops then DFS may Properties of uniform cost search
not find solution.
Time complexity: • Completeness: Complete if the cost of every step is greater than or equal to some
– Let m is the maximum depth of the search tree. In the worst case Solution may small positive constant e
exist at depth m.
– root has b successors, each node at the next level has again b successors (total • Optimality: Optimal if the cost of every step is greater than or equal to some small positive
2
b ), … constant e .
– Worst case; expand all except the last node at depth m
– Total no. of nodes generated: • Time complexity : O(bc*/e) where c* is cost of optimal path, e is small positive constant
2 3 m m
b + b + b + ………………….. b = O(b ) • Space Complexity : O(bc*/e)
Space complexity:
– It needs to store only a single path from the root node to a leaf node, along with iv. Depth Limited Search:
remaining unexpanded sibling nodes for each node on the path.
– Total no. of nodes in memory: • The unbounded tree problem appeared in DFS can be fixed by imposing a limit on the depth that DFS
1+ b + b + b + ………………….. b m times = O(bm)
can reach, this limit we will call depth limit l, this solves the infinite path problem.
Optimal (i.e., admissible):
– DFS expand deepest node first, if expands entire let sub-tree even if right sub- • A depth-limited search algorithm is similar to depth-first search with a predetermined limit. Depth-limited
tree contains goal nodes at levels 2 or 3. Thus we can say DFS may not always
search can solve the drawback of the infinite path in the Depth-first search. In this algorithm, the node at the
give optimal solution.
depth limit will treat as it has no successor nodes further.
Properties of depth limit search
· Completeness:
13 14
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
• Iterative deepening search uses only linear space and not much more time than other uninformed
The limited path introduces another problem which is the case when we choose l < d, in which is our DLS algorithms
will never reach a goal, in this case we can say that DLS is not complete.
An example of Iterative deepening DFS (depth level 3)
· Optimality: First Iteration Search at level l=0
- One can view DFS as a special case of the depth DLS, that DFS is DLS with l = infinity.
- DLS is not optimal even if l > d.
l
· Time Complexity: O(b )
Second Iteration Search at level l=1
· Space Complexity: O(bl)
• The iterative deepening algorithm is a combination of DFS and BFS algorithms. This search algorithm finds out
the best depth limit and does it by gradually increasing the limit until a goal is found.
• This algorithm performs depth-first search up to a certain "depth limit", and it keeps increasing the depth limit
Third Iteration Search at level l=3
after each iteration until the goal node is found.
• This Search algorithm combines the benefits of Breadth-first search's fast search and depth-first search's
memory efficiency.
• The iterative search algorithm is useful uninformed search when search space is large, and depth of goal node is
unknown.
15 16
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Advantages:
o It combines the benefits of BFS and DFS search algorithm in terms of fast search and memory efficiency. Completeness: Bidirectional Search is complete if we use BFS in both searches.
Disadvantages: Time Complexity: Time complexity of bidirectional search using BFS is O(bd).
i. Completeness:
– YES (no infinite paths)
ii. Time complexity:
– Algorithm seems costly due to repeated generation of certain states.
– Node generation:
level d : once level d-1: 2
level d-2: 3
…
level 2: d-1
level 1: d
– Total no. of nodes generated:
d.b +(d-1). b2 + (d-2). b3 + …………………..+1. bd = O(bd)
iii. Space complexity:
– It needs to store only a single path from the root node to a leaf node, along with remaining Forward search: 1à 4à 8à9
unexpanded sibling nodes for each node on the path. Backward search: 16à12à10à9
– Total no. of nodes in memory:
1+ b + b + b + ………………….. b d times = O(bd) Solution path is: 1à 4à 8à 9à 10à 12à16
17 18
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
word, the informed search is one that uses the problem specific knowledge beyond the definition of
Step 2: If the OPEN list is empty, Stop and return failure.
the problem itself and can find solutions more efficiently than blind search strategies.
• It may be too resource intensive (both time and space) to use a blind search Step 3: Remove the node n, from the OPEN list which has the lowest value of h(n), and
places it in the CLOSED list.
• Use of Heuristic improves efficiency of search process.
• The idea is to develop a domain specific heuristic function h(n). Step 4: Expand the node n, and generate the successors of node n.
Step 6: For each successor node, algorithm checks for evaluation function f(n), and then
check if the node has been in either OPEN or CLOSED list. If the node has not been in both
list, then add it to the OPEN list.
19 20
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Applications
Best-first search and its more advanced variants have been used in such applications as
games and web crawlers.
§ In a web crawler, each web page is treated as a node, and all the hyperlinks on the
page are treated as unvisited successor nodes. A crawler that uses best-first search
generally uses an evaluation function that assigns priority to links based on
how closely the contents of their parent page resemble the search query.
§ In games, best-first search may be used as a path-finding algorithm for game
characters. For example, it could be used by an enemy agent to find the location of the
player in the game world.
Heuristic Searches - Why Use?
· Even if a blind search will work we may want a more efficient search method
Informed Search uses domain specific information to improve the search pattern
– Define a heuristic function, h(n), that estimates the "goodness" of a node n.
– Specifically, h(n) = estimated cost (or distance) of minimal cost path from n to a
goal state.
– The heuristic function is an estimate, based on domain-specific information that
is computable from the current state description, of how close we are to a goal.
Admissible Heuristic:
A heuristic function is said to be admissible if it is no more than the lowest-cost path to the
goal. In other words, a heuristic is admissible if it never overestimates the cost of reaching
the goal. An admissible heuristic is also known as an optimistic heuristic.
An admissible heuristic is used to estimate the cost of reaching the goal state in an informed
search algorithm. In order for a heuristic to be admissible to the search problem, the estimated
cost must always be lower than the actual cost of reaching the goal state. The search algorithm
uses the admissible heuristic to find an estimated optimal path to the goal state from the current
node. For example, in A* search the evaluation function (where n is the current node) is: f(n) =
g(n) + h(n)
where;
f(n) = the evaluation function.
• Complete? No – can get stuck in loops, g(n) = the cost from the start node to the current node
• Time? O(bm), but a good heuristic can give dramatic improvement h(n) = estimated cost from current node to goal.
• Space? O(bm) -- keeps all nodes in memory h(n) is calculated using the heuristic function. With a non-admissible heuristic, the A*
• Optimal? No algorithm would overlook the optimal solution to a search problem due to an overestimation in
f(n).
21 22
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
2) A* Search Algorithm
· A* search is the most commonly known form of best-first search. It uses heuristic function
h(n), and cost to reach the node n from the start state g(n). Example: heuristic value
· It has combined features of UCS and greedy best-first search, by which it solve the problem 1 S 4
efficiently. S 7
2
· A* search algorithm finds the shortest path through the search space using the heuristic A B A 6
function. B 2
12 5 2
· This search algorithm expands less search tree and provides optimal result faster. A* D C C 1
Goal 3
algorithm is similar to UCS except that it uses g(n)+h(n) instead of g(n). D 0
· In A* search algorithm, we use search heuristic as well as the cost to reach the node. Hence
we can combine both costs as following, and this sum is called as a fitness number. Solution:
F(n)=g(n)+ h(n)
· A* is a best first, informed graph search algorithm.
For S, f(n)= 0+7= 7 // 0 because S is start
· The h(x) part of the f(x) function must be an admissible heuristic; that is, it
node (Now expand S)
must not overestimate the distance to the goal. Thus, for an application like routing, h(x) SàA , f= 1+6=7
might represent the straight-line distance to the goal, since that is physically the smallest SàB, f=4+2=6 (least expensive)
possible distance between any two points or nodes.
SàBàC , f=(4+2)+1=7
· It finds a minimal cost-path joining the start node and a goal node for node n.
SàAàB = (1+2)+2=5
· Evaluation function: f(n) = g(n) + h(n)
SàAàC=(1+5)+1=7
Where, SàAàD=(1+12)+0=13
g(n) = cost so far to reach n from root
h(n) = estimated cost to goal from n SàAàBà5+1=6
f(n) = estimated total cost of path through n to goal SàBàCàD=8+0=8
· combines the two by minimizing f(n) = g(n) + h(n); SàBàCàD= 9+0=9
· is informed and, under reasonable assumptions, optimal and complete. SàAàCàD=9+0=9
Therefore, optimal path is : SàAàCàD=8
Advantages:
o A* search algorithm is the best algorithm than other search algorithms.
o A* search algorithm is optimal and complete.
o This algorithm can solve very complex problems.
Disadvantages:
o It does not always produce the shortest path as it mostly based on heuristics and
approximation.
o A* search algorithm has some complexity issues.
o The main drawback of A* is memory requirement as it keeps all generated nodes in the
memory, so it is not practical for various large-scale problems.
23 24
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
· Genetic algorithms are excellent for searching through large and complex datasets.
Steps
o Branching factor is finite.
o Cost at every action is fixed.
o Admissible: the first condition requires for optimality is that h(n) should be an admissible
heuristic for A* tree search. An admissible heuristic is optimistic in nature.
o Consistency: Second required condition is consistency for only A* graph-search.
If the heuristic function is admissible, then A* tree search will always find the least cost path.
Time Complexity: The time complexity of A* search algorithm depends on heuristic function, and
the number of nodes expanded is exponential to the depth of solution d. So the time complexity is
O(b^d), where b is the branching factor.
Selection
25 26
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
The idea of selection phase is to select the fittest individuals and let them pass their genes to the next Generate the initial population
generation. Two pairs of individuals (parents) are selected based on their fitness scores. Individuals with high Compute fitness
REPEAT
fitness have more chance to be selected for reproduction. Selection
Crossover
Crossover Mutation
Compute fitness
Crossover is the most significant phase in a genetic algorithm. For each pair of parents to be mated, a crossover UNTIL population has converged
STOP
point is chosen at random from within the genes.
Example :
For example, consider the crossover point to be 3 as shown below.
Offspring are created by exchanging the genes of parents among themselves until the crossover
point is reached.
Planning :
· The planning in Artificial Intelligence is about the decision making tasks performed by the
robots or computer programs to achieve a specific goal.
New offspring · The execution of planning is about choosing a sequence of actions with a high likelihood to
Mutation complete the specific task.
· The given set of operator instances (defining the possible primitive actions by the agent),an
In certain new offspring formed, some of their genes can be subjected to a mutation with a
initial state description, and a goal state description or predicate ,the planning agent
low random probability. This implies that some of the bits in the bit string can be flipped.
computes a plan.
· The word planning refers to the process of computing several steps of a problem solving
procedure before executing any of them.
· Planning of the problem is done in the hierarchical manner.
What is a plan ?
· A sequence of operator instances such that executing them in the initial state will change the
world to a state satisfying a goal state description.
Mutation: Before and After
Algorithm:
START
27 28
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
29 30
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
o Means –Ends Analysis (MEA) is a problem solving technique used commonly in Artificial
Intelligence for limiting search in AI problems.
o Most of the search strategies either reason forward or backward, however often a mixture of the two
directions is appropriate. Such mixed strategy would make it possible to solve the major parts of
problem first and solve the smaller problems. Such technique is called Means and End analysis. Solution:
o Means-Ends Analysis is problem-solving techniques used in Artificial intelligence for limiting
To solve the above problem, we will first find the differences between initial states and goal states,
search in AI programs.
and for each difference, we will generate a new state and will apply the operators. The operators we
o MEA technique is a strategy to control search in problem solving.
have for this problem are:
o The MEA technique was first introduced in 1961 by Allen Newell, and Herbert A. Simon in their
problem-solving computer program, which was named as General Problem Solver (GPS).
o Move
o The MEA analysis process centered on the evaluation of the difference between the current state and
o Delete
goal state.
o Expand
How means-ends analysis Works:
1. Evaluating the initial state: In the first step, we will evaluate the initial state and will
The means-ends analysis process can be applied recursively for a problem. It is a strategy to control search in
problem-solving. Following are the main Steps which describes the working of MEA technique for solving a compare the initial and Goal state to find the differences between both states.
problem.
a. First, evaluate the difference between Initial State and final State.
b. Select the various operators which can be applied for each difference.
c. Apply the operator at each difference, which reduces the difference between the current state and
goal state.
2. Applying Delete operator: As we can check the first difference is that in goal state there is no
dot symbol which is present in the initial state, so, first we will apply the Delete operator to
Operator Subgoaling
remove this dot.
In the MEA process, we detect the differences between the current state and goal state. Once these
differences occur, then we can apply an operator to reduce the differences. But sometimes it is
possible that an operator cannot be applied to the current state. So we create the sub problem of the
current state, in which operator can be applied, such type of backward chaining in which operators
are selected, and then sub goals are set up to establish the preconditions of the operator is
called Operator Sub goaling.
Example of Mean-Ends Analysis: 3. Applying Move Operator: After applying the Delete operator, the new state occurs which we
Let's take an example where we know the initial state and goal state as given below. In this will again compare with goal state. After comparing these states, there is another difference that is
problem, we need to get the goal state by finding differences between the initial state and goal state the square is outside the circle, so, we will apply the Move Operator.
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
[Artificial Intelligence]
· Competitive environments in which the agents goals are in conflict, give rise to
adversarial search, often known as games.
4. Applying Expand Operator: Now a new state is generated in the third step, and we will
compare this state with the goal state. After comparing the states there is still one difference which · In AI, games means deterministic, fully observable environments in which there are two
is the size of the square, so, we will apply Expand operator, and finally, it will generate the goal agents whose actions must alternate and in which utility values at the end of the game
state. are always equal and opposite.
• Eg. If first player wins, the other player necessarily loses
Opposition between the agent’s utility functions makes the situation adversarial.
Game
· The term Game means a sort of conflict in which n individuals or Groups(known as players)
participate.
· John Von Neumann is acknowledged as a father of Game theory; Neumann defined Game
theory in 1928 and 1937.
· Games are integral attribute of human beings. Games engage the intellectual faculties of
humans.
· If computers are to mimic people they should be able to play games.
A game can be formally be defined as a kind of search problem with the following components
1. Initial state: which specifies how the game is set up at the start?
2. A successor function
3. A terminal test: A terminal test, which is true when the game is over and false
otherwise. States where the game has ended are called terminal states.
4. A utility function: A utility function (also called an objective function or
payoff function), defines the final numeric value for a game that ends in
terminal state 's‘ for a player ‗p‘. In chess, the outcome is a win, loss, or
draw, with values +1, 0, or 1/2. Some games have a wider variety of possible
outcomes; the payoffs in backgammon range from 0 to +192. A zero-sum
game is (confusingly) defined as one where the total payoff to all players is
the same for every instance of the game. Chess is zero- sum because every
game has payoff of either 0 + 1, 1 + 0 or 1/2+ 1/2.
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Minimax Algorithm
Game Tree Representation · Mini-max algorithm is a recursive or backtracking algorithm which is used in decision-making
and game theory. It provides an optimal move for the player assuming that opponent is also
playing optimally.
· Mini-Max algorithm uses recursion to search through the game-tree.
· Min-Max algorithm is mostly used for game playing in AI. Such as Chess, Checkers, tic-tac-
toe, go, and various tow-players game. This Algorithm computes the minimax decision for the
current state.
· In this algorithm two players play the game, one is called MAX and other is called MIN.
· Both the players fight it as the opponent player gets the minimum benefit while they get the
maximum benefit.
· Both Players of the game are opponent of each other, where MAX will select the maximized
value and MIN will select the minimized value.
· The minimax algorithm performs a depth-first search algorithm for the exploration of the
complete game tree.
· The minimax algorithm proceeds all the way down to the terminal node of the tree, then
backtrack the tree as the recursion.
· The minimax algorithm performs a complete depth-first exploration of the game
tree. If the maximum depth of the tree is m and there are b legal moves at each
point, then the time complexity of the minimax algorithm is O(bm) and the space
complexity is O(bm).
· We first consider games with two players: MAX and MIN. MAX moves first, and
then they take turns moving until the game is over. Each level of the tree alternates,
MAX is trying to maximize her score, and MIN is trying to minimize MAX score in
order to undermine her success. At the end of the game, points are awarded to the
winning player and penalties are given to the loser.
• The working of the minimax algorithm can be easily described using an example. Below we
have taken an example of game-tree which is representing the two-player game.
• In this example, there are two players one is called Maximizer and other is called Minimizer.
• Maximizer will try to get the Maximum possible score, and Minimizer will try to get the
minimum possible score.
• This algorithm applies DFS, so in this game-tree, we have to go all the way through the leaves
to reach the terminal nodes.
[Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page 2 [Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page 3
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
minimax(player,board)
if(game over in current board position)
return winner
children = all legal moves for player from this board
if(max's turn)
return maximal score of calling minimax on all the children
else (min's turn)
return minimal score of calling minimax on all the children
example 1
In the below tree diagram, let's take A is the initial state of the tree. Suppose maximizer takes first turn
which has worst-case initial value =- infinity, and minimizer will take next turn which has worst-case Step 3: In the next step, it's a turn for minimizer, so it will compare all nodes value with +∞, and will
initial value = +infinity. find the 3rd layer node values.
[Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page 4 [Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page 5
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Problem
Step 3: Now it's a turn for Maximizer, and it will again choose the maximum of all nodes value and find
the maximum value for the root node. In this game tree, there are only 4 layers, hence we reach · Interesting games have too many states to expand to the leaves.
immediately to the root node, but in real games, there will be more than 4 layers. · Number of nodes to expand is exponential in the depth of the tree and the
branching factor.
o For node A max(4, -3)= 4
Properties of Mini-Max algorithm:
o Complete- Min-Max algorithm is Complete. It will definitely find a solution (if exist), in the
finite search tree.
o Optimal- Min-Max algorithm is optimal if both opponents are playing optimally.
o Time complexity- As it performs DFS for the game-tree, so the time complexity of Min-Max
algorithm is O(b m), where b is branching factor of the game-tree, and m is the maximum depth of
the tree.
o Space Complexity- Space complexity of Mini-max algorithm is also similar to DFS which
is O(bm).
The main drawback of the minimax algorithm is that it gets really slow for complex games such as
Chess, go, etc. This type of games has a huge branching factor, and the player has lots of choices to
decide. This limitation of the minimax algorithm can be improved from alpha-beta pruning.
That was the complete workflow of the minimax two player game.
Example 2 :
-β pruning
α
o Alpha-beta pruning is a modified version of the minimax algorithm. It is an optimization
technique for the minimax algorithm.
o As we have seen in the minimax search algorithm that the number of game states it has to
examine are exponential in depth of the tree. Since we cannot eliminate the exponent, but we can
cut it to half. Hence there is a technique by which without checking each node of the game tree
we can compute the correct minimax decision, and this technique is called pruning. This
involves two threshold parameter Alpha and beta for future expansion, so it is called alpha-beta
pruning. It is also called as Alpha-Beta Algorithm.
o Alpha-beta pruning can be applied at any depth of a tree, and sometimes it not only prune the tree
leaves but also entire sub-tree.
o The two-parameter can be defined as:
a. Alpha: The best (highest-value) choice we have found so far at any point along the path
of Maximizer. The initial value of alpha is -∞.
b. Beta: The best (lowest-value) choice we have found so far at any point along the path of
Minimizer. The initial value of beta is +∞.
[Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page 6 [Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page 7
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
The Alpha-beta pruning to a standard minimax algorithm returns the same move as the
standard algorithm does, but it removes all the nodes which are not really affecting the final
decision but making algorithm slow. Hence by pruning these nodes, it makes the algorithm
fast.
• It reduces the time required for the search and it must be restricted so that no time is to
be wasted searching moves that are obviously bad for the current player.
• The exact implementation of alpha-beta keeps track of the best move for each side as it
moves throughout the tree.
• Alpha–beta pruning can be applied to trees of any depth, and it is often possible to
prune entire sub-trees rather than just leaves. Remember that minimax search is depth-
first, so at any one time we just have to consider the nodes along a single path in the
tree.
Example
α = the value of the best (i.e., highest-value) choice we have found so far at any choice
point along the path for MAX.
β = the value of the best (i.e., lowest-value) choice we have found so far at any choice
point along the path for MIN.
• Alpha–beta search updates the values of α and β as it goes along and prunes
the remaining branches at a node as soon as the value of the current node is
known to be worse than the current α or β value for MAX orMIN, respectively.
1. α>=β
Working of Alpha-Beta Pruning:
Key points about alpha-beta pruning:
Let's take an example of two-player search tree to understand the working of Alpha-beta pruning
o The Max player will only update the value of alpha.
Step 1: At the first step the, Max player will start first move from node A where α= -∞ and β= +∞, these
o The Min player will only update the value of beta.
value of alpha and beta passed down to node B where again α= -∞ and β= +∞, and Node B passes the
o While backtracking the tree, the node values will be passed to upper nodes instead of values of same value to its child D.
alpha and beta.
o We will only pass the alpha, beta values to the child nodes.
[Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page 8 [Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page 9
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Step 2: At Node D, the value of α will be calculated as its turn for Max. The value of α is compared with
firstly 2 and then 3, and the max (2, 3) = 3 will be the value of α at node D and node value will also 3.
Step 5: At next step, algorithm again backtrack the tree, from node B to node A. At node A, the value of
Step 3: Now algorithm backtrack to node B, where the value of β will change as this is a turn of Min,
alpha will be changed the maximum available value is 3 as max (-∞, 3)= 3, and β= +∞, these two values
Now β= +∞, will compare with the available subsequent nodes value, i.e. min (∞, 3) = 3, hence at node
now passes to right successor of A which is Node C.
B now α= -∞, and β= 3.
At node C, α=3 and β= +∞, and the same values will be passed on to node F.
Step 6: At node F, again the value of α will be compared with left child which is 0, and max(3,0)= 3, and
then compared with right child which is 1, and max(3,1)= 3 still α remains 3, but the node value of F will
become 1.
In the next step, algorithm traverse the next successor of Node B which is node E, and the values of α= -
∞, and β= 3 will also be passed.
Step 4: At node E, Max will take its turn, and the value of alpha will change. The current value of alpha
will be compared with 5, so max (-∞, 5) = 5, hence at node E α= 5 and β= 3, where α>=β, so the right
successor of E will be pruned, and algorithm will not traverse it, and the value at node E will be 5.
Step 7: Node F returns the node value 1 to node C, at C α= 3 and β= +∞, here the value of beta will be
changed, it will compare with 1 so min (∞, 1) = 1. Now at C, α=3 and β= 1, and again it satisfies the
condition α>=β, so the next child of C which is G will be pruned, and the algorithm will not compute the
entire sub-tree G.
[Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page [Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page
10 11
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Algorithm
Step 8: C now returns the value of 1 to A here the best value for A is max (3, 1) = 3. Following is the
function alphabeta(node, depth, α, β, maximizingPlayer)
final game tree which is the showing the nodes which are computed and nodes which has never
computed. Hence the optimal value for the maximizer is 3 for this example. if depth = 0 or node is a terminal node
return the heuristic value of node
if maximizingPlayer
for each child of node
α := max(α, alphabeta(child, depth - 1, α, β, FALSE))
if β ≤ α
break (* β cut-off *)
return α
else
for each child of node
β := min(β, alphabeta(child, depth - 1, α, β, TRUE))
if β ≤ α
break (* α cut-off *)
return β
[Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page [Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com)] Page
12 13
https://bit-papers.blogspot.com/ ©17171R
[Artificial Intelligence]
[Artificial Intelligence]
Alpha-Beta run
· Depth-first search
Visit C, A, F,
Visit G, heuristics evaluates to 2
Visit H, heuristics evaluates to 3
· Back up {2,3} to F. max(F)=3
· Back up to A. β(A)=3. Temporary
min(A) is 3.
3 is the ceiling for node A's score.
· Visit B according to depth-first
order.
· Visit I. Evaluates to 5.
Max(B)>=5. α(B)=5.
It does not matter what the value of
J is, min(A)=3. β-prune J.
Effectiveness
Properties of α-β
Example2:
Step 1:
Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 10 Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 10
https://bit-papers.blogspot.com/ ©17171R
[Artificial Intelligence] [Artificial Intelligence]
Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 10 Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 10
https://bit-papers.blogspot.com/ ©17171R
[Artificial Intelligence] [Artificial Intelligence]
Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 10 Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 10
https://bit-papers.blogspot.com/ ©17171R
[Artificial Intelligence]
Example:
Solve the following Constraint Satisfaction Problems [CSP]:
Ü A B C
+ D E F
G H I
Solution:
Tree Searching Rules:
1. A ≠ B ≠ C ≠ D ≠ E ≠ F ≠ G ≠ H ≠ I
2. C + F = I
C + F = 10 + I (I as carry)
3. B + E = H
B + E = 10 + H B +
E+1=H
B + E + 1 =10 + H (H as carry)
4. A + D = G
A+D+1=G
Now,
Step 1:
Domain of C={1,2,3,4,5,6,7,8,9}
Domain of F={1,2,3,4,5,6,7,8,9}
So, Domain of I={0,1,2,3,4,5,6,7,8,9}
Select C=4 & F=9 then I=3 (carry=1)
Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 10 Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 10
https://bit-papers.blogspot.com/ ©17171R
[Artificial Intelligence]
Step 2 H A T 0
D
Of Domain of E={0}
So, Select E = 0
Now we
have,
T R U 0
+ T R U 0
1 A L S 0
Step 3:
Domain of U = {2, 3, 4, 6, 7, 8, 9}
So, Domain of S = {2, 4, 6, 8}
Select U = 4 Then S = 8
So,
Step 3:
T R 4 0
+ T R 4 0 Domain of O = {1, 3, 6}
1 A L 8 0
So, Domain of A = {2, 6}
Select O = 6 Then A = 2 (Carry = 1)
Step 4:
Domain of R={3, 6} So,
So, Domain of L={2,6} L 6 40
Select R = 6 Then L = 2 (Carry = 1) + L 6 40
So, H 2 80
T 6 4 0
+ T 6 4 0 Step 4:
1 A 2 8 0 Domain of L = {1, 3}
Step 5: So, Domain of H = {3, 7}
7 6 4 0 Select L = 3 Then H = 7
+ 7 6 4 0
1 5 2 8 0
Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 11 Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 12
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
[Artificial Intelligence] [Artificial Intelligence]
C =9, R = 6, O = 2, S = 3, A = 5, D = 1, N = 8, G = 7, E = 4.
Solution:
Step 1: Ü
Domain of D = {1} S E N D
Select D= 1 + M O R E
So,
M O N E Y
C R O S S Solution:
+ R O A 1 S
1 A N G E R Step 1:
Domain of M={1}
Step 2: Select M= 1
Domain of S = {2, 3, 4, 5, 6, 7, 8, 9}
So ,we have
So, Domain of R = {0, 2, 4, 6, 8}
Select S = 3 Then R = 6
S E N D
So, + 1 O R E
C 6 O 3 3
+ 6 O A 1 3 1 O N E Y
1 A N G 4 6
Step 2:
Step3:
Domain of O = {0, 2, 4, 5, 7, 8, 9} Domain of S = {9}
Domain of A = {0, 2, 4, 5, 7, 8, 9} Select S = 9 Then O = 0 (Carry = 1)
So, Domain of G = {0, 2, 5, 7, 9} Select O = 2 & A
So,
= 5 Then G = 7
So,
C 6 2 3 3
+ 6 2 5 1 3
1 5 8 7 4 6
Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 13 Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 14
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
[Artificial Intelligence] [Artificial Intelligence]
Step 3:
Domain of E = {5}
Domain of T = {2, 3, 4, 7, 8, 9}
The Carry in the above step will be 2 only when we select E = 5 & T = 8 to obtain T = 8 (Carry = 1)
So,
Simplified form of the above problem will be:
F 9 R 8 6
8 5 0
+ 8 5 0
S 1 X 8 6
Ü F O R T Y
T E N
+ T E N
S I X T Y
Solution:
Step 1:
Domain of N = {0, 5}
Domain of Y = {1, 2, 3, 4, 5, 6, 7, 8, 9}
So, Select N = 0 & Y = 6 to obtain Y = 6
Now we have,
F O R T 6
T E 0
+ T E 0
S I X T 6
Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 15 Artificial Intelligence-Compiled by Yagya Raj Pandeya, NAST, Dhandadhi ©yagyapandeya@gmail.com Page 16
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
CHAPTER - Knowledge Representation, Inference and Reasoning
- The knowledge-based agents are useful for representation of knowledge and processes of reasoning. As
the humans, the knowledge and reasoning are important for artificial agents because they enable
successful behaviors in various scenarios.
- The central component of a knowledge-based agent is its knowledge base, or KB. A knowledge
Exercises: base is a set of sentences, expressed in a language called a knowledge representation language
1. BASE+BALL = GAMES
- The agent maintains a knowledge base, KB; this may initially contain some background knowledge.
2. GERALD + DONALD = ROBERT
3. WIRE + MORE = MONEY Sometimes we dignify a sentence with the name axiom. An axiom is a sentence or proposition
that is not proved or demonstrated and is considered as self-evident or as an initial necessary
consensus for a theory building or acceptation. According as requirements, the new sentences are
added to the knowledge base and then new sentences are also derived from old axiom & theorems,
called inference.
- Logic is method of reasoning process in which conclusions are drawn from premises using rules of
inference. The logic is knowledge representation technique that involves:
* Syntax: defines well-formed sentences or legal expression in the language
Knowledge acquisition refers to the process of extracting, structuring, and organizing domain knowledge from
domain experts into a program.
Knowledge Representation and Reasoning : Knowledge representation and reasoning (KRR) is the field
of artificial intelligence dedicated to representing information about the world in a form that a computer
system can utilize to solve complex tasks.
knowledge engineer is an expert in AI language and knowledge representation who investigates a particular
problem domain, determines important concepts, and creates correct and efficient representations of the objects
and relations in the domain.
1. Planning
2. Knowledge extraction
3. Knowledge analysis
1
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla
4. Knowledge verification 2016 Batch 19171R
Knowledge Representation:
Ø To solve large numbers of complex problems in AI we need
- Large number of Knowledge (knowledge base)
- Mechanism to manipulate or solve the problem create new solutions
Ø Knowledge representation is a study of ways of how knowledge is represented or pictorized. 3. Inferential knowledge:
Ø For representation two entities are important: - Represent knowledge as formal logic.
i. Fact: Truth in real world(Knowledge Base) E.g All dogs have tail .
Representation Mapping: - A proposition is a declarative sentence to which only one of the “Truth value” (i.e. TRUE or
i. Forward representation: Fact to Representation FALSE) can be assigned (but not both). Hence, the propositional logic is also called Boolean
ii. Backward representation: Representation to Fact logic. When a proposition is true, we say that its truth value is T, otherwise its truth value is F.
For example:
Types of Knowledge :
§ The square of 4 is 16 ® T
There are 5 main types of knowledge representation in Artificial Intelligence. § The square of 5 is 27 ® F
· Meta Knowledge – It’s a knowledge about knowledge and how to gain them § Every collage will have computer by 2010 AD ® we cannot know its truth value
· Heuristic – Knowledge – Representing knowledge of some expert in a field or subject. i.e. may be true (T) or false (F), but not both so it is a proposition.
· Procedural Knowledge – Gives information/ knowledge about how to achieve something. - Propositions are of two types:
· Declarative Knowledge – Its about statements that describe a particular object and its attributes , i. Atomic Statement: These statements cannot be simplified further. They are singular sentences.
including some behavior in relation with it.
ii. Compound statement: The two or more statements connected together with some logical
· Structural Knowledge – Describes what relationship exists between concepts/ objects.
connectives such as AND(∧), OR (∨), Implication (→), etc.
Approaches of Knowledge Representation
1. Simple Relational Knowledge:
It is a simple way of sorting facts using relational method.e.g Tabular representation
2. Inheritable knowledge:
- Data should be stored into a hierarchy of classes.
- Classes must be arranged in a generalization.
- Every individual frame can represent the collection of attribute and it’s values.
Eg:
2 3
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Implication (p q) Bi-conditionals (p q)
Syntax: • if p then q Variety of terminology:
There are five connectives in common use: • if p, q • p is necessary and sufficient for q
• p is sufficient for q • if p then q, and conversely
Name Representation Meaning
• q if p • p if and only if q
Negation (not) ¬p or ~p “not p”
• q when p • p iff q
Conjunction (and) p ∧ q or p & q “p and q”
• a necessary condition for p is q
Disjunction (or) “p or q (or both)” •
p∨q p implies q P « q is equivalent to (p®q) Ù (q ®p) =
Exclusive Or “either p or q, but not both” • p only if q (Ø p Ú q) Ù (Ø q Ú p)
p⊕q
• a sufficient condition for q is p
Implication (if...then) p→q “if p then q”
• q whenever p
Bi-conditional or Bi- p ↔ q or p ≡ q “p if and only if q” or “p iff q” • q is necessary for p
implication (if and only if) • q follows from p
Semantics
Note: Set Theory Artificial Intelligence Logic
The semantics defines the rules for determining the truth of a sentence (specified the
(or Discrete Structure)
Union (È) Disjunction (Ú) OR (+) syntax) with respect to a particular model. In propositional logic, a model simply fixes
Intersection (Ç) Conjunction (Ù) AND (.) the truth value—true or false—for every proposition symbol.
Complement Negation (Ø or ~) NOT (Bar)
A. Truth Table
Example-1 The truth tables specify the truth value of a complex sentence for each possible
For example, the meaning of the statements P = it is raining and Q = I am indoors is assignment of truth values to its components. Truth tables for the five connectives are
given in figure.
transformed when the two are combined with
logical connectives: @ a « b: It is a formula.
§ It is raining and I am indoors (P ∧ Q) @ a º b: It is not a formula but it denotes
§ If it is raining, then I am indoors (P →Q) the relationship between a and b.
@ If P®Q be any compound preposition
§ If I am indoors, then it is raining (Q → P) then
* Converse: Q ® P = Ø Q Ú P
§ I am indoors if and only if it is raining (P ↔ * Contra positive: ØQ ® ØP = P® Q
* Inverse: ØP ® ØQ = Q ® P
Q)
Tautology, contradictions & contingent
§ It is not raining (¬P)
Example-2 Let P: This book is good and Q: This - A compound proposition whose truth value is always true is called tautology. For instance, p ∨ ¬p is
book is cheap. a tautology.
Now,
§ This book is good and cheap ® P Ù Q - A contradiction is always false whatever the truth values of its variables. For instance, p ∧ ¬p is a
§ This book is costly but good ®ØQ Ù P - The compound proposition that is neither a tautology nor a contradiction is called contingency.
4 5
https://bit-papers.blogspot.com/ ©17171R
Rules of$sagarMalla
Inference in Propositional Logic 2016 Batch 19171R
Example-1: “It is not sunny this afternoon and it is colder than yesterday”, “We will go
swimming only if it is sunny”, “If we do not go swimming then we take a canoe trip”, and “If we take
a canoe trip then we will be home by sunset” lead to the conclusion “We will be home by sunset”.
Solution: Let
p = “It is sunny this afternoon”
q = “It is colder than yesterday”
r = “We will go swimming”
s = “We will take a canoe trip”
t = “We will be home by sunset”
Hypothesis: Øp∧q, r→p, Ør→s, s→t
Conclusion: t
Example-2: “If you send me an e-mail message then I will finish writing the program”, “If you do not
send me an e-main message then I will go to sleep early”, and “If I go to sleep early then I will wake up
feeling refreshed”. Lead to the conclusion “If I do not finish writing the program then I will wake up
§ Theorem proving—applying rules of inference directly to the sentences in
feeling refreshed”.
our knowledge base to construct a proof of the desired sentence without
Solution: Let
consulting models. p = “You send me an e-mail message”
q = “I will finish writing the program”
r = “I will go to sleep early”
s = “I will wake up feeling refreshed”
Hypothesis: p→q, Øp→r, r→s
Conclusion: Øq→s
Steps Operations Reasons
1. p→q Given hypothesis
2. Øq→Øp Using contrapositive on 1
3. Øp→r Given hypothesis
4. Øq→r Using hypothetical syllogism on 2 and 3
5. r→s Given hypothesis
6. Øq→s Using hypothetical syllogism on 4 and 5
6 7
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla
Hence the given hypotheses lead to the conclusion Øq→s. 2016 Batch 19171R
B. Resolution in Propositional Logic
- Resolution principle was introduced by John Alan Robinson in 1965. Negation of conclusion is : ØR
- The resolution technique can be applied for sentences in propositional logic and first-order logic. Let us assume it will not rain [ØR]
Resolution technique can be used only for disjunctions of literals to derive new conclusion.
- The resolution rule for the propositional calculus can be stated as following: from (P ∨ Q) and (¬P ∨ ØR ØHÚ R
R), we can derive (Q ∨ R). Resolution refutation will terminate with the empty clause if it is logically
equivalent (i.e. KB |= p). There are basic two methods for theorem proving using resolution, which are:
ØO Ú H
ØH
§ Forward chaining: Start with given axioms (or universal rules) and use the rules of
inference to prove the theorem.
§ Backward chaining: Prove that the negation of the result (or goal) cannot be true. This ØO
O
method is commonly known as theorem proving using refutation or proof by
contradiction.
false
For example: Express the following statements in
(Empty clause / Contradiction)
propositional logic
Since, an empty clause has been deduced, we say that our assumption is wrong and hence we
§ If it is hot then humid.
have proved “It will rain”.
§ If it is humid, then it will rain.
§ It is hot. Note :
Use resolution refutation to prove the statement “It will rain”. ## Horn clause is a disjunction of literals of which at most one (or only one) is positive. So
Solution : Let us denote these statements with proposition H, O,& R all definite clauses are Horn clauses, as are clauses with no positive literals; these are called
goal clauses. Horn clauses are closed under resolution: if you resolve two Horn clauses, you
H=It is humid.
get back a Horn clause.
O=It is hot.
Example-1: Let
R=It will rain.
j1 = A ∨ B ∨ ØD
Formulas corresponding to sentences are :
j2 = A ∨ B ∨ C ∨ D
1. O à H CNF: 1. ØO Ú H j3 = ØB ∨ C
2. Hà R 2. ØHÚ R j4 = ØA
3. O 3. O j=C
To prove: R
· a formula is in conjunctive normal form (CNF) or clausal normal form if it is a conjunction § ¬(¬α) ≡ α (double-negation elimination)
of one or more clauses, where a clause is a disjunction of literals; otherwise put, it is an AND of ORs. § ¬(α ∧ β) ≡ (¬α ∨ ¬β) (De Morgan)
· Since every sentence of propositional logic is logically equivalent to a conjunction of clauses, so § ¬(α ∨ β) ≡ (¬α ∧ ¬β) (De Morgan)
any disjunctions literals can be converted into its equivalent conjunction of calluses. A sentence In the example, we require just one application of the last rule:
expressed as a conjunction of clauses is said to be in conjunctive normal form or CNF. (¬B ∨ P ∨ Q) ∧ ((¬P ∧ ¬Q) ∨ B) .
Step 4: Now we have a sentence containing nested ∧ and ∨ operators applied to
Conversion to Conjunctive Normal Form (CNF)
literals. We apply the distributivity law, distributing ∨ over ∧ wherever possible.
i.e. (α ∨ (β ∧ γ)) ≡ ((α ∨ β) ∧ (α ∨ γ)) distributivity of ∨ over ∧
(¬B ∨ P ∨ Q) ∧ (¬P ∨ B) ∧ (¬Q ∨ B) .
The original sentence is now in CNF, as a conjunction of three clauses.
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
e.g ": For all (it can only be defined in a domain) § MAN (Øram) [since negation of constant is not possible i.e. variable may
If x is a variable, then ∀x is read as: have negation]
§ father_of (Q(x)) [since the predicate cannot come inside function]
o For all x
o For each x § MARRIED (MAN, WOMAN) [since predicate of predicate is not possible or the
o For every x.
constant must be in small latter]
ii. Existential quantifier: Existential quantifiers are the type of quantifiers, which express Note: An atomic formula is a WFF. For example: if P and Q are WFFs then ØP, P&Q, PÚQ, P®Q,
that the statement within its scope is true for at least one instance of something. It is P«Q, "x P(x), $x P(x) are WFFs.
denoted by the logical operator ∃.
Example: Convert into
[Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com] [Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com]
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
2. Marcus was Pompeian. 17. Every student in this class has visited Mexico.
Ø POMPEIAN (Marcus)
Ø Let
3. All Pompeian were Roman. o S(x) = “x is a student in this class”
Ø "x POMPEIAN (x) → ROMAN (x)
o M(x) = “x has visited Mexico”
4. Ram tries to assassinate (kill) Hari. Hence, required expression is: "x [S(x) → M(x)] [Note: → appears due to "]
Ø ASSASSINATE (Ram, Hari) 18. Not all birds can fly. Ø"x"x $y ∧∨
Ø("x: BIRD(x) à FLY(x))
5. Everyone is loyal (believe) to someone.
Ø "x $y LOYAL (x, y) 19. If anyone can solve the problem then Shyam can.
6. Someone is loyal to everyone. $x: SOLVES(x, problem) ∧ SOLVES (Shyam, problem)
Ø $x "y LOYAL (x, y) 20. Nobody in the math class is smarter than everyone in AI.
Ø MAN (Socrates), "x MAN (x) ® MORTAL (x), MORTAL (Socrates) 28. Renu wears anything Sita wears.
wears(Sita,x)→wears(Renu,x)
In propositional logic, the resolution method is applied only to those clauses which are disjunction of This rule is also called the binary resolution rule because it only resolves exactly two literals.
literals. There are following steps used to convert into CNF:
1) Eliminate bi-conditional implication by replacing A ⇔ B with (A → B) Ʌ (B →A) Steps for Resolution:
1. Conversion of facts into first-order logic.
2) Eliminate implication by replacing A → B with ¬A V B. 2. Convert FOL statements into CNF
3. Negate the statement which needs to prove (proof by contradiction)
4. Draw resolution graph (unification).
3) In CNF, negation(¬) appears only in literals, therefore we move it inwards as:
Examples of Resolution in Predicate Logic:
Example 1
· ¬ ∀x P(x) = $x ¬ P(x)
a. John likes all kind of food.
· ¬$x P(x) = ∀x ¬ P(x) b. Apple and vegetable are food
· ¬ ( ¬A) ≡ A (double-negation elimination c. Anything anyone eats and not killed is food.
· ¬ (A Ʌ B) ≡ ( ¬A V ¬B) (De Morgan) d. Anil eats peanuts and still alive
· ¬(A V B) ≡ ( ¬A Ʌ ¬B) (De Morgan) e. Harry eats everything that Anil eats.
4) Eliminate quantifiers. Prove by resolution that:
5) Finally, using distributive law on the sentences, and form the CNF as: f. John likes peanuts.
(A1 V B1) Ʌ (A2 V B2) Ʌ …. Ʌ (An V Bn).
Step-1: Conversion of Facts into FOL
4.4 .2 Resolution in FOPL
In the first step we will convert all the given statements into its first order logic.
- Resolution is a theorem proving technique that proceeds by building refutation proofs, i.e., proofs
by contradictions. It was invented by a Mathematician John Alan Robinson in the year 1965.
- Resolution is used, if there are various statements are given, and we need to prove a conclusion of
those statements. Unification is a key concept in proofs by resolutions.
- Resolution is a single inference rule which can efficiently operate on the conjunctive normal form or
clausal form.
[Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com] [Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com]
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
f. ∀k ¬ alive(k) V ¬ killed(k)
g. likes (John, Peanuts).
o Eliminate existential instantiation quantifier by elimination.
In this step, we will eliminate existential quantifier ∃, and this process is known as Skolemization.
But in this example problem since there is no existential quantifier so all the statements will remain
same in this step.
. ¬ food(x) V likes(John, x)
a. food(Apple)
b. food(vegetables)
Step-2: Conversion of FOL into CNF c. ¬ eats(y, z) V killed(y) V food(z)
d. eats (Anil, Peanuts)
In First order logic resolution, it is required to convert the FOL into CNF as CNF form makes easier for
resolution proofs. e. alive(Anil)
o Eliminate all implication (→) and rewrite f. ¬ eats(Anil, w) V eats(Harry, w)
a. ∀x ¬ food(x) V likes(John, x) g. killed(g) V alive(g)
b. food(Apple) Λ food(vegetables) h. ¬ alive(k) V ¬ killed(k)
c. ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y) i. likes(John, Peanuts).
d. eats (Anil, Peanuts) Λ alive(Anil)
o Distribute conjunction over disjunction ¬.
e. ∀x ¬ eats(Anil, x) V eats(Harry, x)
This step will not make any change in this problem.
f. ∀x¬ [¬ killed(x) ] V alive(x)
g. ∀x ¬ alive(x) V ¬ killed(x) Step-3: Negate the statement to be proved
h. likes(John, Peanuts). In this statement, we will apply negation to the conclusion statements, which will be written as ¬likes (John,
o Move negation (¬)inwards and rewrite Peanuts)
. ∀x ¬ food(x) V likes(John, x)
Step-4: Draw Resolution graph:
a. food(Apple) Λ food(vegetables)
b. ∀x ∀y ¬ eats(x, y) V killed(x) V food(y) Now in this step, we will solve the problem by resolution tree using substitution. For the above problem, it
will be given as follows:
c. eats (Anil, Peanuts) Λ alive(Anil)
d. ∀x ¬ eats(Anil, x) V eats(Harry, x)
e. ∀x ¬killed(x) ] V alive(x)
f. ∀x ¬ alive(x) V ¬ killed(x)
g. likes(John, Peanuts).
o Rename variables or standardize variables
. ∀x ¬ food(x) V likes(John, x)
a. food(Apple) Λ food(vegetables)
b. ∀y ∀z ¬ eats(y, z) V killed(y) V food(z)
c. eats (Anil, Peanuts) Λ alive(Anil)
d. ∀w¬ eats(Anil, w) V eats(Harry, w)
e. ∀g ¬killed(g) ] V alive(g)
[Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com] [Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com]
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Example 3 Given Expression: Bhaskar is a physician. All physicians know surgery. Prove that
Bhaskar knows surgery using principle of resolution.
Ø FOPL
§ PHYSICIAN (Bhaskar)
§ "x PHYSICIAN (x) → KNOWS (x, surgery) or ØPHYSICIAN (x) ∨
KNOWS (x, surgery)
Now, we have to prove that: KNOWS (Bhaskar, surgery)
To prove the statement using resolution (proof by contradiction); let’s take the negation of
this as: ØKNOWS (Bhaskar, surgery)
Now,
Hence the negation of the conclusion has been proved as a complete contradiction with the given set
of statements.
Example 2 Given Expression: John likes all kinds of foods. Apples are food. Chicken is food. Since, ØKNOWS (Bhaskar, surgery) is not possible and hence the: KNOWS (Bhaskar, surgery)
Prove that John likes Peanuts using resolution. is proved.
FOPL Example 4 Given Expression: All carnivorous animals have sharp teeth. Tiger is carnivorous.
§ "x FOOD (x) → LIKES (John, x) or ØFOOD (x) ∨ LIKES (John, x) Fox is carnivorous. Prove that tiger has sharp teeth.
§ FOOD (apples) Ø FOPL
§ FOOD (chicken) § "x CARNIVOROUS (x) → SHARP TEETH (x) or Ø CARNIVOROUS (x)
Now, we have to prove: LIKES (John, peanuts). ∨ SHARP TEETH (x)
To prove the statement using resolution (proof by contradiction); let’s take the negation of § CARNIVOROUS (tiger)
this as: ØLIKES (John, peanuts) § CARNIVOROUS (fox)
Now
Since, ØLIKES (John, peanuts) is not possible and hence the: LIKES (John,
peanuts) is proved.
[Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com] [Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com]
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Goal: likes(Gita, almond)
Negated goal: ¬likes(Gita, almond)
Since, Ø SHARP TEETH (tiger) is not possible and hence the: SHARP TEETH (tiger) is Now, rewrite in CNF form:
proved. 1. ¬food(x) V likes(Gita, x)
Example 5 Given Expression: Gita only likes easy course. Science courses are hard. All the 2. food(Mango),food(chapati)
courses in KMC are easy. KMC302 is a KMC course. Use the resolution to answer the 3. ¬eats(x,y) V killed(x) V food(y)
question “Which course would Gita like?” 4. eats(Gita, almonds), alive(Gita)
To prove the statement using resolution (proof by contradiction); let‟s take the negation of this
as: Ø LIKES (Gita, KMC302)
Now
Since, Ø LIKES (Gita, KMC302) is not possible and hence the: LIKES (Gita, KMC302) is proved. Hence, we have achieved the given goal with the help of Proof by Contradiction. Thus, it is proved that Gita
Example 6: Consider the following knowledge base: likes almond.
1. Gita likes all kinds of food. Difference Between Propositional logic and Predicate logic
2. Mango and chapati are food.
Propositional Logic Predicate Logic
3. Gita eats almond and is still alive.
1) Propositional logic is a representational language 1) Predicate logic can reason about general properties
4. Anything eaten by anyone and is still alive is food. that makes the assumption that the world can be and relationships that apply to collection of individual.
represented solely in terms of propositions that are
Goal: Gita likes almond.
TRUE or FALSE.
Solution: Convert the given sentences into FOPL as:
Let, x be the light sleeper. 2) Propositional logic combines atoms 2) Predicate logic talk about objects.
1. ∀x: food(x) → likes(Gita,x) - Atoms have connectives. - Properties
- Relations
2. food(Mango),food(chapati)
- -True/False
3. ∀x∀y: eats(x,y) Ʌ ¬ killed(x → food(y)
3) Simplest kind of Logic. 4) An extension of propositional logic.
4. eats(Gita, almonds) Ʌ alive(Gita) 5) It doesn’t uses any quantifiers. 5) It uses mainly two types of quantifiers:
5. ∀x: ¬killed(x) → alive(x) - Universal quantifiers.
- Existential quantifiers.
6. ∀x: alive(x) → ¬killed(x)
[Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com] [Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com]
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
- In Semantic networks, we can represent our knowledge in the form of graphical networks. This
network consists of nodes representing objects and arcs which describe the relationship between
those objects.
- Semantic networks can categorize the object in different forms and can also link those objects.
[Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com] [Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com]
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
· In AI, frames are called slot fillers data representations. The slot is the data values, and the How are objects related in a frame based system ?
fillers are attached procedures which are called before, during or after the slot’s value are There are three types of relationships between objects
changed.
1. Generalization:
Frame as knowledge representation techniques:
· It denotes a-kind of or “Is-a” relationship between super-class and it’s sub-class.
· The concept of a frame defined by a collection of attribute/slot.
· For example: A car is a vehicle.
· Each slot describes a particular attribute or operation of the frame.
· Slots are used to store values. 2. Aggregation:
Example: · It is “a-part-of” or “Part-whole” relationship in which several subclass representing
components are associated with a super-class representing a whole.
Slots Filters
· For example: An engine is a part of a car.
[Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com] [Compiled By: Bhawana Bam , Email :bhawana70003@gmail.com]
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
· Each rule represents a small chunk of knowledge relating to the given domain.
· A number of related rules along with some known facts collectively may correspond
to a chain of inferences.
Unit-5 Reasoning
· An interpreter (inference engine) uses for facts and rules to derive conclusions about
7.1 What is Reasoning??
the current context and situation as presented by the user input.
• Reasoning is the act of deriving a conclusion from certain premises using a given
· Suppose a rule based system has the following statements. methodology.
R1: If A is an animal and A lays no eggs, then A is a mammal. • Reasoning is a process of thinking, reasoning is logically arguing, reasoning is drawing
F1: Lucida is an animal. inference.
• Any system must reason, if it is required to do something which has not been told
F2: Lucida lays no eggs.
explicitly.
The inference engine will update the rule base after interpreting the above set as: • For reasoning, the system must find out what it needs to know from what it already
R1: If A is an animal and A lays no eggs then A is a mammal. knows.
F1: Lucida is an animal.
F2: Lucida lays no eggs.
F3: Lucida is a mammal.
4. A user interface or other connection to the outside world through which input and ❖ Non-logical reasoning :linguistic, language
output signals are received and sent. 7.2 Types of Reasoning
Advantages of rule based approach: 1. Monotonic Reasoning
· Naturalness of Expression: Expert knowledge can often been seen naturally as rules of thumb. • Once you get a conclusion the addition of new facts won’t change the conclusion.
· Modularity: Rules are independent of each other – new rules can be added or revised later. • The definite clause logic is monotonic in the sense that anything that could be concluded
Interpreter is independent from rules. before a clause is added can still be concluded after it is added; adding knowledge does
· Restricted Syntax: Allows construction of rules and consistency checking by other not reduce the set of propositions that can be derived.
programs. Allows (fairly easy) rephrasing to natural language.
i.e, Earth rotates around the sun.
Disadvantages (or limitations)
- Adding new facts like Saturn all revolves around sun won’t affect the conclusive decision.
· rule bases can be very large (thousands of rules)
• In monotonic reasoning if we enlarge at sets of axioms we cannot retract any existing
· rules may not reflect the actual decision making
assertions or axioms.
· the only structure in the KB is through the rule chaining
For example: “If the patient has stiff neck, high fever and an headache, check for Brain
Meningitis”. Then it can be represented in rule based approach as:
IF <FEVER, OVER, 39> AND <NECK, STIFF, YES> AND <HEAD, PAIN, YES> THEN [Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 1
add(<PATIENT,DIAGNOSE, MENINGITIS>)
Page 21
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Example:
Bayes Theorem
• Bayes' theorem is also known as Bayes' rule, Bayes' law, or Bayesian reasoning, which
determines the probability of an event with uncertain knowledge.
• We have described several representation techniques that can be used to model belief P(a ^ b) = P(b|a) P(a) ……………….(2)
systems in which, at any given point in time, a particular fact is believed to be true, Equating 1 and 2
believed to be false or not considered to be either. P(a|b) P(b) = P(b|a) P(a)
• But for some kinds, it is useful to be able to describe beliefs that are not certain but for i.e. P(b|a) = P(a|b) P(b)/P(a)
which there is some supporting evidence. Example:
A doctor knows that the disease meningitis causes the patient to have a stiff neck 50%
• For example, problems that contain genuine randomness. E.g. Card Games of the time. The doctor also knows that the probability that a patient has meningitis
• For such problems, statistical measures may serve a very useful function as summaries of is 1/50,000, and the probability that any patient has a stiff neck is 1/20.
the world; rather than looking for all possible exceptions we can use a numerical Find the probability that a patient with a stiff neck has meningitis.
summary that tells us how often an exception of some sort can be expected to occur.
[Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 2 [Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 3
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
automated insight, reasoning, time series prediction, and decision making under uncertainty. = P[x1| x2, x3,....., xn]P[x2|x3,....., xn]....P[xn-1|xn]P[xn].
- A data structure called Bayesian network to represent the dependencies among variable. It can
In general for each variable Xi, we can write the equation as:
represent essentially any full joint probability distribution in many cases can do very concisely.
- Bayesian Network can be used for building models from data and experts opinions, and it consists P(Xi|Xi-1,........., X1) = P(Xi |Parents(Xi ))
of two parts: Question:
▪ Directed Acyclic Graph
▪ Table of conditional probabilities.
[Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 4 [Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 5
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
The Conditional probability of David that he will call depends on the probability of
Alarm.
The Conditional probability of Sophia that she calls is depending on its Parent Node
"Alarm."
P(B= False)= 0.998, which is the probability of no burglary. False 0.02 0.98
We can provide the conditional probabilities as per the below tables: P(S, D, A, ¬B, ¬E) = P (S|A) *P (D|A)*P (A|¬B ^ ¬E) *P (¬B) *P (¬E).
Hence, a Bayesian network can answer any query about the domain by using Joint distribution.
B E P(A= True) P(A= False)
4. Uncertainty in Reasoning
True True 0.94 0.06
• In many problem domains it is not possible to create complete , consistent models of the
True False 0.95 0.04 world. Therefore agent must act in uncertain worlds .We want an agent to make rational
decisions even when there is not enough information to prove that an action will work.
False True 0.31 0.69
• AI systems must have ability to reason under conditions of uncertainty.
False False 0.001 0.999
[Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 6 [Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 7
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
[Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 8 [Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 9
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
system for processing, such as temperature, pressure, rpm’s, etc. • Mathematical concepts within fuzzy reasoning are very simple.
▪ INFERENCE ENGINE: It determines the matching degree of the current fuzzy input with • You can modify a FLS by just adding or deleting rules due to flexibility of fuzzy logic.
respect to each rule and decides which rules are to be fired according to the input field. • Fuzzy logic Systems can take imprecise, distorted, noisy input information.
▪ DEFUZZIFICATION: It is used to convert the fuzzy sets obtained by inference engine
• FLSs are easy to construct and understand.
into a crisp value. There are several defuzzification methods available and the best suited
• Fuzzy logic is a solution to complex problems in all fields of life, including medicine, as
one is used with a specific expert system to reduce the error.
it resembles human reasoning and decision making.
[Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 10 [Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 11
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
• It is a process of solving new problems based on the solutions of similar past problems. • Other two assumptions are:
• Case based reasoning is reasoning by remembering. - The world is regular place: what holds true today will probably hold true tomorrow.
- Solutions Repeat: If they do not, there is no point in remembering them.
• A case based reasoning solves new problems by adapting solutions that were used to
Advantages of CBR:
solve old problems.
• Case based reasoning is a recent approach to problem solving and learning. • Solutions are quickly proposed.
[Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 12 [Compiled by: Bhawana Bam (bhawana70003@gmail.com, Artificial Intelligence)] Page 13
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
[Compiled By: Bhawana Bam (Email: bhawana70003@gmail.com)] Page 1 [Compiled By: Bhawana Bam (Email: bhawana70003@gmail.com)] Page 2
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
3. Critic: Tells the Learning element how agent is doing (success or failure) by comparing • Three methods are used in inductive learning
4. Problem Generator: Suggests problems or actions that will generate new examples or 2. Version Trees
experiences that will aid in training the system further. 3. Decision trees
1. Rote learning
3. Decision tree
• Decision tree is a powerful tool of classification and prediction.
2. Inductive Learning • It represents rules that are easily expressed and use to retrieve useful information
• A process of learning by example. • A decision tree consist of
• The system tries to induce a general rule from a set of observed instances. The - Nodes: test for the value of certain attribute.
learning method extracts rules and patterns out of massive data sets. - Edges: correspond to the outcome of a test.
• This involves the process of learning by example -- where a system tries to induce a - Leaves: terminal nodes that predict the outcome.
general rule from a set of observed instances.
• This involves classification -- assigning, to a particular input, the name of a class to
which it belongs. Classification is important to many problem solving tasks.
• A learning system has to be capable of evolving its own class descriptions:
- Initial class definitions may not be adequate.
- The world may not be well understood or rapidly changing.
• The task of constructing class definitions is called induction or concept learning.
[Compiled By: Bhawana Bam (Email: bhawana70003@gmail.com)] Page 3 [Compiled By: Bhawana Bam (Email: bhawana70003@gmail.com)] Page 4
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
4. Reinforcement Learn i ng
• Reinforcement learning refers to a class of problem in machine learning which
postulates an agent exploring an environment.
- the agent perceives it’s current state and takes actions.
- The environment in return, provides a reward positive or negative.
- The algorithm attempt to find a policy for maximizing cumulative reward for the agent
over the course of the problem.
• In other word Reinforcement is: “A computational approach to learning whereby an
agent tries to maximize the total amount of reward it receives when interacting with a
complex, uncertain environment”.
• It is a way of programming agents by reward and punishment without needing to
specify how task is to be achieved.
[Compiled By: Bhawana Bam (Email: bhawana70003@gmail.com)] Page 5 [Compiled By: Bhawana Bam (Email: bhawana70003@gmail.com)] Page 6
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
• EBL system accepts an example (i.e., a training example) and explain what it
learns from the example. The EBL system takes only the relevant concepts of Explains
the training. This explanation is translated into particular form that a problem Generate
solving can understand. The explanation is generalized so that it can be used to
solve other problem. Goal concept
• An EBL accepts 4 kinds of inputs Example:
o/p: Lender (x,y)→ relative (x,y) ʌ Rich (y)
a. A training Example: what the learning sees in the world.
b. A goal concept: High level description of what the program is supposed to learn. relative (x,y) uncle (y,x)
c. Operational criterion: description of which concepts are usable. rich(y) Ceo(y,b) ʌ
d. A domain theory: a set of rules that describes relationships between object and Bank(B)
action in a domain. rich (y) Own (y,H) ʌ
a. Explanation: the domain theory is used to prune away all unimportant aspects of the
training example with respect to the goal concept.
b. Generalization: the explanation is generalized as far as possible while still
describing the goal concept.
[Compiled By: Bhawana Bam (Email: bhawana70003@gmail.com)] Page 7 [Compiled By: Bhawana Bam (Email: bhawana70003@gmail.com)] Page
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
The sigmoid function y=1/(1+e-x )is used instead of a step function in artificialneuralnets because Artificial Neuron Model
the sigmoid is continuous , where as a step function is not,and we need continuity whenever we
• Inputs to the network are represented by the mathematical symbol Xn
want to usegradient decent.
• Each of these inputs are multiplied by a connection
weight wn Sum= w1x1 +…..+ wnxn + bias
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 1 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 2
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
• These produces are simply summed, fed through the transfer function f(), to generate a • It may be divided into 2 parts. The first part, g takes an input (ahem dendrite ahem),
result and then output. performs an aggregation and based on the aggregated value the second part, f makes a
decision.
2. Single Layer feed forward neuron network
• Single layer of source nodes that projects directly onto an output layer of neurons.
• The single layer feed-forward network consists of single layer of weights. Where the inputs
are directly connected to the outputs via a series of weights.
• It consist of two layers namely the input layer and the output layer. Input layer neuron receives
the input signals and output layer neuron gives the output.
• Every input neuron is connected to output neuron but not vice versa.
• The output layer performs the computation hence called single layer.
Perceptron
• Perceptron is a single layer neural network. It is a binary classifier and part of supervised
learning. A simple model of the biological neuron in an artificial neural network is known
as the perceptron.
• An arrangement of one input layer of neurons feed forward to one
output layer of neurons is known as Single Layer Perceptron.
• The perception is the simplest form of neural network that is able to classify data into two
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 3 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 4
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
classes.
3. Multi Layer feed forward neuron network
• It consists of single neuron with a number of adjustable weights.
• A single artificial neuron that computes it’s weights inputs and uses a threshold actuation • The architecture of this class of network, besides having the input and the
function. output layers, also have one or more intermediary layers called hidden layers. The
• Perceptron is a simple neuron model that takes input signals (patterns) coded as real input computational units of the hidden layer are known as hi dd en neurons.
vectors (x1 + x2 +......+xn) through the associative synaptic weights W= (w1 + w2+…..+wn+1). • The hidden layer does intermediate computation before directing the input to output layer.
The out put is determined by :
• The input layer neurons are linked to t he hi d d e n l aye r n e u r o n s ; the weights on
Output = f(net)=f(w.x)
these links are referred to as input-hidden layer weights.
It is called a Threshold Logic unit (TLU).
• The hidden layer neurons and the corresponding weights are referred to as output-hidden
• It uses iterative learning procedure. layer weights.
• A multi-layer feed-forward network with ℓ input neurons, m1 neurons in the first hidden
layers, m2 neurons in the second hidden layers, and n output neurons in the output
layers is written as (ℓ - m1 - m2 – n ).
• Fig. above illustrates a multilayer feed-forward network
with a configuration (ℓ - m – n)
Fig: Perceptron
1 if S > F(z)
-1 if S < f(z)
• Weights are changed only when the error occurs. Back propagation in multilayer neural network
• The weights are updated using the following
Algorithm
Wi(new) = Wi (old) + α t xi Given : A set of input/output vector pairs.
Compute: A set of weights for a three –layer network that maps inputs onto
Where, t is either +1 or -1.
Α is the learning rate. corresponding outputs.
Step 1: Initialize the weights in the network. Each weight should be set
randomly to a number between -1 to 1 .
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 5 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 6
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Step 4: propagate the activations from the units in the input layer to the hidden
layer using the activation function
Step 5: propagate the activations from the units in the hidden layer to the unit to the
computer layer.
Step 6: Compute the errors of the units in the output layer denotes by delta. Errors
are based on the networks actual output and the target output.
Error = Target value- actual output
Step 7: Adjust the weights between the hidden layer and output layer. The learning
rate is denoted by ;
Step 8: Adjust the weights between the input layer and hidden layer
Step 9 : Go to step 3 to repeat. When all the input-output pairs have been to the
network, one epoch has been completed. Repeat step3 to 8 for as many iteration as
desired.
Example
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 7 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 8
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
actual output to be closer the target output, thereby minimizing the error for each output neuron and
Step 1 : Feed forward the network as a whole.
We then squash it using the logistic function to get the output of h1: Visually, here’s what we’re doing:
We repeat this process for the output layer neurons, using the output from the hidden layer
neurons as inputs.
Here’s the output for :
Calculating the Total Error The partial derivative of the logistic function is the output multiplied by 1 minus the output:
Repeating this process for (remembering that the target is 0.99) we get: Finally, how much does the total net input of change with respect to ?
The total error for the neural network is the sum of these errors:
Our goal with back propagation is to update each of the weights in the network so that they cause the
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 9 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 10
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
You’ll often see this calculation combined in the form of the delta rule:
Alternatively, we have and which can be written as , aka .We can use this to
rewrite the calculation above:
Therefore:
Some sources extract the negative sign from so it would be written as:
To decrease the error, we then subtract this value from the current weight (optionally multiplied
by some learning rate, eta, which we’ll set to 0.5):
We know that affects both and therefore consideration
its effect on the both output neurons: Starting with :
We perform the actual updates in the neural network after we have the new weights leading into Therefore:
the hidden layer neurons (ie, we use the original weights, not the updated weights, when we
continue the back propagation algorithm below). Now that we have , we need to figure out and then for each weight:
Hidden Layer
We calculate the partial derivative of the total net input to with respect to the same as we
did for the output neuron:
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 11 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 12
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
• RNNs are used in deep learning and in the development of models that simulate the activity of
neurons in the human brain.
Applications of RNNs ― RNN models are mostly used in the fields of natural language processing and
Putting it all together: speech recognition.
Recurrent Network Architecture
• Wxh: is weights for the connection of the input layer to the hidden layer.
Finally, we’ve updated all of our weights! When we fed forward the 0.05 and 0.1 inputs • W: is weights for the connection of the hidden layer to the hidden layer.
originally, the error on the network was 0.298371109. After this first round of backpropagation,
• Why: are the weights for the connection of the hidden-layer-to-output-layer layer.
the total error is now down to 0.291027924. It might not seem like much, but after repeating this
• a: is the activation of the layer.
process 10,000 times, for example, the error plummets to 0.0000351085. At this point, when we
feed forward 0.05 and 0.1, the two outputs neurons generate 0.015912196 (vs 0.01 target) and
The recurrent neural network scans through the data from left to right.
0.984065734 (vs 0.99 target).
The parameters it uses for each time step are shared. In the above diagram, parameters Wxh,
4. Recurrent Networks Why and W are the same for each time step.
• Recurrent neural networks, also known as RNNs, are a class of neural networks that allow In RNN making a prediction at time t, it uses not only input “xt” at time t but also information from
previous outputs to be used as inputs while having hidden states. previous input at time t-1 through activation parameter “a” and weights “W” which passes from
• Recurrent Neural Network (RNN) is a type of Neural Network where the output from previous previously hidden layer to current hidden layer.
step is fed as input to the current step.
• There could be also neurons with self feedback links i.e output of a neuron is feedback into itself
as input.
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 18 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 19
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Architecture
Hopfield Neural Network
• In 1982 , John Hopfield introduced an artificial neural network to store and retrieve
memory like the human Brain.
• It consists of a single layer which contains one or more fully connected recurrent neurons.
• It can be seen as a fully connected single layer auto associative network.
• Hopfield networks are constructed from artificial neurons with N inputs. With each input i
there is a weight wi associated. They also have an output. The state of the output is
maintained, until the neuron is updated.
Properties of Hopfield Neural Network
- A recurrent network with all nodes connected to all other nodes.
- Nodes have binary outputs ( either 0,1 or 1,-1)
- Weights between the nodes are symmetric.
- No connection from node to itself is allowed.
- Nodes are updated asynchronously (the nodes are selected at random)
- The network has no hidden layer. • This model consists of neurons with one inverting and one non-inverting output.
Hopfield neural networks are of two types: • The output of each neuron should be the input of other neurons but not the input of self.
i. Discrete Hopfield network
• Weight/connection strength is represented by wij.
ii. Continuous Hopfield network
• Connections can be excitatory as well as inhibitory. It would be excitatory, if the output
Discrete Hopfield Network of the neuron is same as the input, otherwise inhibitory.
- The network is fully interconnected neural network where each unit is connected to every • Weights should be symmetrical, i.e. wij = wji
other unit.
• The output from Y1 going to Y2, Yi and Yn have the weights w12, w1i and w1n respectively.
- The network has symmetric weights with no self connection i.e Wi j =Wji and Wii = 0
Similarly, other arcs have the weights on them.
Continuous Hopfield network
- Used either for associative memory problems or constrained optimization problems
such as the Travelling sales man problems.
- Output is Vi = g(ui) where ui denote the internal activity of a neuron.
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 20 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 20
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
Boltzmann machine
Learning methods in Neural Networks
Boltzmann Machine were first invented in 1985 by Geoffrey Hinton, a professor at the University
The Learning methods in neural networks are classified into three basic types:
of Toronto. He is a leading figure in the deep learning community and is referred to by some as
- Supervised Learning
the “Godfather of Deep Learning”.
- Unsupervised Learning
• Boltzmann Machine is a generative unsupervised model, which involve learning a
- Reinforcement Learning
probability distribution from an original dataset and using it to make inferences about
i. Supervised Learning
never before seen data.
• Learning in which we teach or train the machine using data which is well labeled that means
• Boltzmann Machine have an input layer (also referred to as the visible layer) and one or some data is tagged with correct answer.
several hidden layers (also referred to as the hidden layer).
• Supervised learning is where you have input variables(x) and an output variable (y) and you
• Boltzmann Machine use neural networks with neurons that are connected not only to other use an algorithm to learn the mapping function from the input to the output.
neurons in other layers but also to neurons within the same layer.
Y= f(x)
• Everything is connected to everything. Connections are bidirectional, visible neurons
• It is called Supervised because the process of an algorithm learning from the training dataset
connected to each other and hidden neurons also connected to each other
can be thought of as a teacher supervising the learning process.
• Boltzmann Machine doesn’t expect input data, it generate data. Neurons generate
• Learning process is based on comparison between networks computed output and the correct
information regardless they are hidden or visible.
expected output and the correct expected output , generating error.
• A Boltzmann machine (also called stochastic Hopfield network with hidden units) is a
• The easiest way can be used if a (large enough) set of test data with known results exists.
type of stochastic recurrent neural network.
Then the learning goes like this: Process one dataset. Compare the output against the known
• Visible nodes are what we measure and Hidden nodes are what we don’t measure. When
result. Adjust the network and repeat.
we input data, these nodes learn all the parameters, their patterns and correlation between
• Supervised learning algorithms can be further grouped into:
those on their own and form an efficient system; hence Boltzmann Machine is termed as
a) Classification: A Classification problem is when the output variable is a cegory such as
an Unsupervised Deep Learning model.
red or blue OR disease or non-disease etc.
• This model then gets ready to monitor and study abnormal behavior depending on what it b) Regression : A regression problem is when output variable is real value,weigjht,dollor
has learnt. This model is also often considered as a counterpart of Hopfield Network, etc.
which are composed of binary threshold units with recurrent connections between them..
ii. Unsupervised Learning
- Unsupervised learning is where you only have input data (x) and no corresponding
output variables.
- The goal is to model the underlying structure or distribution in the data in order to
learn more about data.
- It is called unsupervised because unlike supervised learning there is no teacher.
Algorithms are left to their own devices to discover and present the interesting
structure in the data.
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 21 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 22
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
- The expected or desired output is not presented to the network. might imposer a limit on the growth of synaptic weight.
- The system learns of it own by discovering and adapting to the What can neural networks do?
structural features in the input patterns. ANN’s have been successfully applied to a number of problem domains:
- Useful if no test data is readily available, and if it is possible to derive some kind
• Classify data by recognizing patterns. Is this a tree on that picture?
while working on the real data.
• Detect anomalies or novelties, when test data does not match the usual patterns. Is the
- Unsupervised learning further grouped into :
truck driver at the risk of falling asleep? Are these seismic events showing normal ground
a. Clustering: A Clustering problem is where you want to discover the inherent motion or a big earthquake?
groupings in the data, such as grouping customers by purchasing behavior. • Process signals, for example, by filtering, separating, or compressing.
b. Association: It is a rule where you want to discover rules that describe large portion • Approximate a target function–useful for predictions and forecasting. Will this storm turn
of your data, such as people that buy x also tend to buy y.
so let’s look at some real-world applications. Neural networks can -
iii. Reinforced Learning
- A teacher is present but does not present the expected or desired output • identify faces,
• recognize speech,
but only indicated if the computed output is correct or incorrect.
• read your handwriting (mine perhaps not),
- The information provided helps the network in its learning process. • translate texts,
- A reward is given for correct answer computed and a penalty for a wrong answer. • play games (typically board games or card games)
• control autonomous vehicles and robots
- The ‘carrot and stick’ method. Can be used if the neural network generates • and surely a couple more things!
continuous action. Follow the carrot in front of your nose! If you go the wrong way - Applications of Neural Networks:
ouch. Over time, the network learns to prefer the right kind of action and to avoid the Neural network applications can be grouped in following categories:
wrong one. i. Clustering:
Note : The Supervised and Unsupervised learning methods are most popular
A clustering algorithm explores the similarity between patterns and places similar
forms of learning compared to Reinforced learning.
patterns in a cluster. Best known applications include data compression and data
iv. Hebbain Learning mining.
• In 1949, Donald Hebb proposed one of the key ideas in biological learning, ii. Classification/Pattern recognition
commonly known as hebb’s law. The task of pattern recognition is to assign an input pattern (like handwritten symbol)
• Hebb’s Law states that if neuron iis near enough to excite neuron j and repeatedly to one of many classes. This category includes algorithmic implementations such as
participates in it’s activation, the synaptic connection between these two neurons is associative memory.
strengthened and neuron j becomes more sensitive to stimuli from neuron i. approximation.
• Hebb’s Law can be represented in the form of two rules: iii. Prediction Systems
- If two neurons on either side of a connection are activated synchronously, then the The task is to forecast some future values of a time-sequenced data. Prediction has a
weight of that connection is increased. significant impact on decision support systems. Prediction differs from function
- If two neurons on either side of a connection are activated asynchronously, then the approximation by considering time factor. System may be dynamic and may produce
weight of that connection is decreased. different results for the same input data based on system state (time).
• Hebbian learning implies that weights can only increase. To resolve this problem, we
[Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 23 [Compiled By: Bhawana Bam (bhawana70003@gmail.com)- Artificial Intelligence] Page 24
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
• Time Series Prediction —Neural networks can be used to make predictions. Will UNIT - 8 Expert system
the stock rise or fall tomorrow? Will it rain or be sunny?
What is Expert system?
• Signal Processing —Cochlear implants and hearing aids need to filter out
unnecessary noise and amplify the important sounds. Neural networks can be • An expert system is a computer system that emulates the decision-making ability of a
trained to process an audio signal and filter it appropriately. human expert.
• Control —You may have read about recent research advances in self-driving cars. • Expert systems are designed to solve complex problems by reasoning through bodies of
Neural networks are often used to manage steering decisions of physical vehicles knowledge, represented mainly as if-then rules rather than through conventional
(or simulated ones). procedural code.
• Soft Sensors —A soft sensor refers to the process of analyzing a collection of • The expert systems are the computer applications developed to solve complex problems
many measurements. A thermometer can tell you the temperature of the air, but
in a particular domain, at the level of extra-ordinary human intelligence and expertise.
what if you also knew the humidity, barometric pressure, dewpoint, air quality, air
• It is considered at the highest level of human intelligence and expertise. It is a computer
density, etc.? Neural networks can be employed to process the input data from
application which solves the most complex issues in a specific domain.
many individual sensors and evaluate them as a whole.
• An expert system is an alternative computer based decision tool that uses both facts and
• Anomaly Detection —Because neural networks are so good at recognizing patterns,
they can also be trained to generate an output when something occurs that doesn’t heuristics to solve difficult decision making problem, based on knowledge acquired from
fit the pattern. Think of a neural network monitoring your daily routine over a long an expert.
period of time. After learning the patterns of your behavior, it could alert you when • An expert system compared with traditional computer :
something is amiss. Inference engine + knowledge = (Expert system)
(Algorithm + Data structure =Program in traditional structure)
• First expert system, called DENDRAL, was developed in the early 70’s at Stanford
University.
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
8.1Introduction
• Heuristic knowledge is less exhaustive, more experimental, more judgmental knowledge
Expert systems are computer applications which embody some non-algorithmic expertise
of performance.
for solving certain types of problems. For example ,expert systems are used in diagnostic
What is knowledge??
applications .They also play chess , make financial planning decisions , configure
The data is collection of facts. The information is organized as data and facts about the task
computers ,monitor real time systems, underwrite insurance policies and perform many
domain. Data, information and past experience combined together are termed as knowledge.
services which previously required human expertise.
- Factual knowledge: It is the information widely accepted by the knowledge
8.2 Components of expert system:
engineers and scholars in the task domain.
- Heuristic knowledge: It is about practice, accurate judgment, one’s ability of
evaluation and guessing.
Knowledge Acquisition??
Knowledge acquisition is the process of extracting, structuring and organizing knowledge from
one source, usually human experts, so it can be used in software such as an ES.
solve a specific problem. It refers the knowledge from the Knowledge Base. It selects facts
and rules to apply when trying to answer the user's query. It provides reasoning about the
The components of expert system (ES) includes: information in the knowledge base. It also helps in deducting the problem to find the
- Knowledge Base solution. This component is also helpful for formulating conclusions.
- Inference Engine
To recommend a solution, the Inference Engine uses the following strategies −
- User Interface
Let us explain them one by one briefly: • Forward Chaining
i. Knowledge Base: • Backward Chaining
• The knowledge base is a repository of facts. It stores all the knowledge about the problem
a. Forward Chaining
domain. It is like a large container of knowledge which is obtained from different experts
of a specific field. - It is a strategy of an expert system to answer the question, “What can happen
• It is expert systems contain both factual and heuristic knowledge. next?”
• Factual knowledge is that knowledge of task domain that is widely shared, typically - It starts with data available and then concludes a desired goal.
found in journals or textbooks.
[Compiled By : Bhawana Bam( bhawana70003@gmail.com)- Artificial Intelligence] [Compiled By : Bhawana Bam( bhawana70003@gmail.com)- Artificial Intelligence]
Page 2 Page 3
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
- Inference Engine follows the chain of conditions and derivations and finally deduces
the outcome. It considers all the facts and rules, and sorts them before concluding to iii. User Interface
a solution. The user interface is the most crucial part of the expert system. This component takes the
- This strategy is followed for working on conclusion, result, or effect. user's query in a readable form and passes it to the inference engine. After that, it displays
the results to the user. In other words, it's an interface that helps the user communicate with
- For example, prediction of share market status as an effect of changes in interest the expert system.
rates.
It explains how the ES has arrived at a particular recommendation. The explanation may
appear in the following forms −
• Natural language displayed on screen.
- On the basis of what has already happened, the Inference Engine tries to find out time with the user. The total time must be less than the time taken by an expert to get the
which conditions could have happened in the past for this result. most accurate solution for the same problem.
• Good Reliability: The expert system needs to be reliable, and it must not make any a
- This strategy is followed for finding out cause or reason.
mistake.
- For example, diagnosis of blood cancer in humans.
• Flexible: It is vital that it remains flexible as it the is possessed by an Expert system.
• Effective Mechanism: Expert System must have an efficient mechanism to administer
the compilation of the existing knowledge in it.
• Capable of handling challenging decision & problems: An expert system is capable
of handling challenging decision problems and delivering solutions.
[Compiled By : Bhawana Bam( bhawana70003@gmail.com)- Artificial Intelligence] [Compiled By : Bhawana Bam( bhawana70003@gmail.com)- Artificial Intelligence]
Page 4 Page 10
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
• The knowledge engineer translates the knowledge into a computer-understandable • Maintains a significant level of information
language. He designs an inference engine, a reasoning structure, which can use • Helps you to get fast and accurate answers
knowledge when needed. • A proper explanation of decision making
• Knowledge Expert also determines how to integrate the use of uncertain knowledge in • Ability to solve complex and challenging issues
the reasoning process and what type of explanation would be useful. • Expert Systems can work steadily work without getting emotional, tensed or fatigued.
• Less Production Cost − Production cost is reasonable. This makes them affordable.
8.8 Applications of expert systems
• Speed − they offer great speed. They reduce the amount of work an individual puts in.
Some popular application where expert systems user:
• Less Error Rate − Error rate is low as compared to human errors.
• Information management
• Reducing Risk − they can work in the environment dangerous to humans. • Hospitals and medical facilities
• Steady response − they work steadily without getting motional, tensed or fatigued. • Help desks management
• Employee performance evaluation
8.5 Disadvantages • Loan analysis
• Virus detection
• Sense: it lacks common sense needed in decision making.
• Useful for repair and maintenance projects
• Creativeness: it cannot respond creatively like human expert would in • Warehouse optimization
unusual circumstances. • Planning and scheduling
• Errors: In knowledge base errors may occur and this leads wrong decisions. • The configuration of manufactured objects
• Financial decision making Knowledge publishing
• Environments: if knowledge base is changed it cannot adapt changing environments.
• Process monitoring and control
• Supervise the operation of the plant and controller
8.6 Benefits of expert systems
• Stock market trading
• It improves the decision quality • Airline scheduling & cargo schedules
• Cuts the expense of consulting experts for problem-solving
• It provides fast and efficient solutions to problems in a narrow area of specialization.
• It can gather scarce expertise and used it efficiently.
• Offers consistent answer for the repetitive problem
[Compiled By : Bhawana Bam( bhawana70003@gmail.com)- Artificial Intelligence] [Compiled By : Bhawana Bam( bhawana70003@gmail.com)- Artificial Intelligence]
Page 10 Page 10
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
• Mapping the given input in the natural language into a useful representation.
[Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com )] Page 2 [Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com )] Page 3
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
[Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com )] Page 4 [Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com )] Page 5
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
side, which defines its alternative component parts, reading from left to right.
Context-Free Grammars are simply grammars consisting entirely of rules with a single symbol
on the left-hand side of the rewrite rules. The obvious advantage of CFG is that it is simple to
define. Many of the grammars used for NLP systems are CFG, as such they have been widely
studied and understood and hence highly efficient parsing mechanisms have been developed to
apply them to their input.
However, CFG also have some severe disadvantages. Consider the following rewrite rules,
since V can be replaced by both "eat" or "eats", sentences like "The cat eat the rice" would be
allowed. Therefore, additional sets of grammar would have to be implemented for both singular
and plural sentences. Moreover, completely different sets of rules would also be needed for
passive sentences, e.g. "The rice was eaten by the cat". This means that an extremely large set of
rules would have to be created which makes it difficult to handle. Many different grammar
formalisms like the unification grammar and the categorical grammar have been developed to
capture the rules of syntax more concisely, but we won't go into them.
[Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com )] Page 6 [Artificial Intelligence: Compiled By: Bhawana Bam(bhawana70003@gmail.com )] Page 7
https://bit-papers.blogspot.com/ ©17171R
$sagarMalla 2016 Batch 19171R
There are some parallels, and some fundamental distinctions, between the goals and methods of
programming language processing (design and compiler strategies) and natural language
processing. Here is a brief summary:
NLP PLP
many and
varied
few
grammatical - declarative
- declarative
constructs - interrogative
- imperative
- fragments
etc.
meanings of
many one
an expression
morphological
analysis
syntactic lexical analysis
analysis context-free parsing
tools and
semantic code
techniques
analysis generation/compiling
integration of interpreting
world
knowledge
https://bit-papers.blogspot.com/ ©17171R