Unit 2
Unit 2
Unit 2
• An intelligent agent needs knowledge about the real world for taking
decisions and reasoning to act efficiently.
❑ Inference system generates new facts so that an agent can update the KB. An
inference system works mainly in two rules which are given as:
o Forward chaining
o Backward chaining
Continue..
1. TELL: This operation tells the knowledge base what it perceives from the
environment.
2. ASK: This operation asks the knowledge base what action it should
perform.
o Each time when the function is called, it performs its three operations:
1. Knowledge level: Knowledge level is the first level of knowledge-based agent, and in
this level, we need to specify what the agent knows, and what the agent goals are. With
these specifications, we can fix its behavior. For example, suppose an automated taxi
agent needs to go from a station A to station B, and he knows the way from A to B, so
this comes at the knowledge level.
2. Logical level: At this level, we understand that how the knowledge representation of
knowledge is stored. At this level, sentences are encoded into different logics. At the
logical level, an encoding of knowledge into logical sentences occurs. At the logical level
we can expect to the automated taxi agent to reach to the destination B.
o However, in the real world, a successful agent can be built by combining both
declarative and procedural approaches, and declarative knowledge can often
be compiled into more efficient procedural code.
Knowledge-Based Agent in Artificial intelligence: Knowledge
Representation
❑ What is knowledge representation?
Humans are best at understanding, reasoning, and interpreting knowledge. Human
knows things, which is knowledge and as per their knowledge they perform various
actions in the real world. But how machines do all these things comes under
knowledge representation and reasoning. Hence we can describe Knowledge
representation as following
o Knowledge representation and reasoning (KR, KRR) is the part of Artificial intelligence
which concerned with AI agents thinking and how thinking contributes to intelligent
behavior of agents.
o It is responsible for representing information about the real world so that a computer can
understand and can utilize this knowledge to solve the complex real world problems such as
diagnosis a medical condition or communicating with humans in natural language.
o It is also a way which describes how we can represent knowledge in artificial intelligence.
Knowledge representation is not just storing data into some database, but it also enables an
intelligent machine to learn from that knowledge and experiences so that it can behave
intelligently like a human.
Continue..
Continue..
❑ AI knowledge cycle:
1. Perception
2. Learning
3. Knowledge Representation and Reasoning
4. Planning
5. Execution
Knowledge-Based Agent in Artificial intelligence: Knowledge
Representation
❑ AI knowledge cycle:
The above diagram is showing how an AI system can interact with the real world and what
components help it to show intelligence. AI system has Perception component by which it
retrieves information from its environment. It can be visual, audio or another form of
sensory input. The learning component is responsible for learning from data captured by
Perception comportment. In the complete cycle, the main components are knowledge
representation and Reasoning. These two components are involved in showing the
intelligence in machine-like humans. These two components are independent with each
other but also coupled together. The planning and execution depend on analysis of
Knowledge representation and reasoning.
Knowledge-Based Agent in Artificial intelligence: Knowledge
Representation
o The structural idea is that knowledge can be stored in the form of graphs, with
nodes representing objects in the world, and arcs representing relationships
between those objects.
1. Semantic nets consist of nodes, links and link labels. In these networks diagram, nodes
appear in form of circles or ellipses or even rectangles which represents objects such as
physical objects, concepts or situations.
2. Links appear as arrows to express the relationships between objects, and link labels
specify relations.
3. Relationships provide the basic needed structure for organizing the knowledge, so
therefore objects and relations involved are also not needed to be concrete.
4. Semantic nets are also referred to as associative nets as the nodes are associated with
other nodes.
Continue…
Continue..
COMPONENTS OF SEMANTIC NETWORKS:
Semantic Networks can further be defined by specifying its fundamental
components, which are:
•Structural Component - Here the links and nodes form a directed graph wherein
the labels are placed on the link and nodes.
•Semantic Component - The meanings here are related to the links and labels of
nodes, whereas the facts are dependent on the approved areas.
•Procedural Part - The creation of new links and nodes is permitted by constructors,
whereas the destructors are responsible for the removal of links and nodes.
SEMANTIC NETWORK EXAMPLES:
Some of the examples of Semantic Networks are:
WordNet: A lexical database of English that groups English words into sets of
synonyms (synsets), provides definitions, and records semantic relations
between them.
ADVANTAGES:
•It is simple and comprehensible.
•Efficient in space requirement.
•Easily clusters related knowledge.
•It is flexible and easy to visualize.
•It is a natural representation of knowledge.
•Conveys meaning in a transparent manner.
Continue..
DISADVANTAGES:
3. Implicational Networks –
• Use implication as the primary relation for connecting nodes. They may be used to
represent patterns of beliefs, causality, or inferences.
• Implicational networks emphasize implication, they are capable of expressing all
the Boolean connectives by allowing a conjunction of inputs to a propositional
node and a disjunction of outputs.
Continue..
4. Executable Networks –
• Include some mechanism, such as marker passing or attached procedures, which
can perform inferences, pass messages, or search for patterns and associations.
• Executable semantic networks contain mechanisms that can cause some change to
the network itself.
Continue..
5. Learning Networks –
• Build or extend their representations by acquiring knowledge from examples. The
new knowledge may change the old network by adding and deleting nodes and
arcs or by modifying numerical values, called weights, associated with the nodes
and arcs.
• The purpose of learning, both from a natural and AI standpoint, is to create
modifications that enable the system to respond more effectively within its
environment.
Continue..
6. Hybrid Networks –
• Combine two or more of the previous techniques, either in a single network or in
separate, but closely interacting networks..
• System are usually called hybrids if their component languages have different
syntax... The most widely used hybrid of multiple network notations is the
Unified Modeling Language (UML), which was by designed by three
authors....who merged their competing notations.
APPLICATION OF SEMANTIC NETWORKS:
With the growing need for intelligent machines, the application of semantic
networks is also increasing. Therefore, listed here are some of the areas
where Semantic Networks are applied or used:
o Generate and Test Search is a heuristic search technique based on Depth First
Search with Backtracking which guarantees to find a solution if done
systematically and there exists a solution. In this technique, all the solutions are
generated and tested for the best solution. It ensures that the best solution is
checked against all possible generated solutions.
o It is also known as British Museum Search Algorithm as it’s like looking for an
exhibit at random or finding an object in the British Museum by wandering
randomly.
Generate and Test Heuristic Search
❑ Algorithm :
Properties of Good Generators:
Complete: Good Generators need to be complete i.e. they should generate all
the possible solutions and cover all the possible states. In this way, we can
guaranty our algorithm to converge to the correct solution at some point in
time.
Informed: Good Generators have the knowledge about the search space which
they maintain in the form of an array of knowledge. This can be used to search
how far the agent is from the goal, calculate the path cost and even find a way
to reach the goal.
Continue..
Generate and Test Heuristic Search
In this case, one way to find the required pin is to generate all the solutions
in a brute force manner for example,
• The total number of solutions in this case is (100)3 which is approximately
1M.
• So if we do not make use of any informed search technique then it results in
exponential time complexity.
• Now let’s say if we generate 5 solutions every minute. Then the total
numbers generated in 1 hour are 5*60=300 and the total number of solutions
to be generated are 1M.
• Let us consider the brute force search technique for example linear search
whose average time complexity is N/2. Then on an average, the total number
of the solutions to be generated are approximately 5 lakhs.
• Using this technique even if you work for about 24 hrs a day then also you
will need 10 weeks to complete the task.
• Now consider the same case that you are generating 5 solutions every
minute and working for 24 hrs then you can find the solution in less than 2
days which was being done in 10 weeks in the case of uninformed search.
• We can conclude for here that if we can find a good heuristic then time
complexity can be reduced gradually.
•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).
• First, the system evaluates the current state to establish whether there
is a problem. If a problem is identified, then it means that an action
should be taken to correct it.
• The second step involves defining the target or desired goal that needs
to be achieved.
• The target goal is split into sub-goals, that are further split into other
smaller goals.
• This step involves establishing the actions or operations that will be
carried out to achieve the end state.
• In this step, all the sub-goals are linked with corresponding executable
actions (operations).
• After that is done, intermediate steps are undertaken to solve the
problems in the current state. The chosen operators will be applied to
reduce the differences between the current state and the end state.
• This step involves tracking all the changes made to the actual state.
Changes are made until the target state is achieved.
The following image shows how the target goal is divided into sub-goals,
that are then linked with executable actions.
Algorithm steps for Means End Analysis
The following are the algorithmic steps for means end analysis:
1.Conduct a study to assess the status of the current state. This can be done
at a macro or micro level.
2.Capture the problems in the current state and define the target state. This
can also be done at a macro or micro level.
3.Make a comparison between the current state and the end state that you
defined. If these states are the same, then perform no further action. This is
an indication that the problem has been tackled. If the two states are not the
same, then move to step 4.
4.Record the differences between the two states at the two aforementioned
levels (macro and micro).
5.Transform these differences into adjustments to the current state.
6.Determine the right action for implementing the adjustments in step 5.
7.Execute the changes and compare the results with the target goal.
8.If there are still some differences between the current state and the target
state, perform course correction until the end goal is achieved.
❑ Example of Means-Ends Analysis:
❑ Solution of Means-Ends Analysis:
❑ Solution of Means-Ends Analysis:
Applications of Means End Analysis
Means end analysis can be applied in the following fields:
1.Organizational planning
• Means end analysis is used in organizations to facilitate general management. It helps
organizational managers to conduct planning to achieve the objectives of the
organization.
• The management reaches the desired goal by dividing the main goals into sub-goals
that are linked with actionable tasks.
2.Business transformation
• This technique is used to implement transformation projects. If there are any desired
changes in the current state of a business project, means end analysis is applied to
establish the new processes to be implemented.
• The processes are split into sub-processes to enhance effective implementation.
3.Gap analysis
• Gap analysis is the comparison between the current performance and the required
performance.
• Means end analysis is applied in this field to compare the existing technology and the
desired technology in organizations.
• Various operations are applied to fill the existing gap in technology.
Production Systems
Production System in AI
o The rules in a production system are determined by LHS (left-hand side) and
RHS (right-hand side) equations, where LHS denotes the specific condition
to be applied, and RHS shows the output of the applied condition.
2. Set of Production Rules: The production rules operate on the global database.
Each rule usually has a precondition that is either satisfied or not by the global
database. If the precondition is satisfied, the rule is usually be applied. The
application of the rule changes the database.
3. Control System: The control system checks the applicability of a rule. It helps
decide which rule should be applied and terminates the process when the
system gives the correct output. It also resolves the conflict of multiple
conditions arriving at the same time. The strategy of the control system specifies
the sequence of rules that compares the condition from the global database to
reach the correct result.
Characteristics of a Production System
There are mainly four characteristics of the production system in AI that is
simplicity, modifiability, modularity, and knowledge-intensive.
❑ Opacity
Communication between the rule interpreter and the production rules creates
difficulty for the understanding of the control system and its strategies. This
condition arises due to the impact of the combined operation of the control
program. There exist difficulties in understanding the hierarchy of operations.
Disadvantages of a Production System
❑ Inefficiency
There are various rules that we employ for solving a problem. The rules can be
effective in different ways. There are conditions where multiple rules get activated
during execution. All the individual rules apply exhaustive searches in each cycle
that reduces the efficiency of the production system.
❑ Inability to Learn
A simple production system based on certain rules is not capable of learning
through experience, unlike advanced AI systems. They are simply bound to
specific rules for actions. We can understand the rules and break them.
❑ Conflict Resolution
To satisfy a condition, various production rules are employed. The condition may
arise when there is a triggering of more than one rule. In that condition, the
control system has to determine the best possible rule from the set of conflicting
rules. This may reduce the efficiency of the production system.
Classes of a Production System
❑ There are four types of production systems that help in categorizing
methodologies for solving different varieties of problems. Let us have a look at
each one of them.
1. Monotonic Production System: In this type of a production system, the rules can be
applied simultaneously as the use of one rule does not prevent the involvement of another
rule that is selected at the same time.
2. Partially Commutative Production System: This class helps create a production system
that can give the results even by interchanging the states of rules. If using a set of rules
transforms State A into State B, then multiple combinations of those rules will be capable to
convert State A into State B.
4. Commutative System: Commutative systems are helpful where the order of an operation
is not important. Also, problems where the changes are reversible use commutative systems.
On the other hand, partially commutative production systems help in working on problems,
where the changes are irreversible such as a chemical process. When dealing with partially
commutative systems, the order of processes is important to get the correct results.
Use Case: Sorting a String in a Production System
▪ Now, we will understand the use of production rules with an example of
sorting a string.
Use Case: Sorting a String in a Production System
• Here, the conflict set represents the set of all the rules that are applicable to the
string. We have to decide which rule should be used.
• Hence, by using three production rules and seven iterations, we are able to
convert the string ‘cbaca’ to ‘aabcc.’
Case based approach
Case-based reasoning (CBR)
• In artificial intelligence and philosophy, case-based reasoning (CBR),
broadly construed, is the process of solving new problems based on the
solutions of similar past problems.
• CBR developed its roots in the work of artificial intelligence theorist and
cognitive psychologist, Roger Schank, and his students at Yale in the late
20th century.
• CBR systems can “learn” by acquiring new knowledge as cases. This, along
with the application of database techniques, makes it easier to maintain
large volumes of information.
Working of CBR
Example-1-Help desk