Artificial_Intelligence
Artificial_Intelligence
Intelligence
Unit -1 Artificial
Intelligence
Depth First Search or DFS for a Graph
In Depth First Search (or DFS) for a graph, we traverse all adjacent
vertices one by one. When we traverse an adjacent vertex, we completely
finish the traversal of all vertices reachable through that adjacent vertex.
This is similar to a tree, where we first completely traverse the left subtree
and then move to the right subtree. The key difference is that, unlike trees,
graphs may contain cycles (a node may be visited more than once). To
avoid processing a node multiple times, we use a boolean visited array.
The step by step process to implement the DFS
traversal is given as follows -
• Optimality
If a solution found is the best (lowest path cost) among all the solutions
identified, then that solution is said to be optimal.
• Time complexity
The time taken by an algorithm to complete its task is called time
complexity. If the algorithm completes a task in a shorter amount of
time, then it is efficient.
• Space complexity
It is the maximum storage or memory the algorithm takes while
searching.
• Select a new state that has not yet been applied to the current state.
• If the new state improves upon the current state, make it the current
state and continue.
3.Repeat until the solution is found or the current state remains unchanged:
• Select a new state that hasn’t been applied to the current state.
• If the best state improves upon the current state, make it the new
current state and repeat.
Alpha is the best value that the maximizer currently can guarantee at
that level or above.
Beta is the best value that the minimizer currently can guarantee at
that level or below.
2. Perform DFS with Depth Limit (L): In each iteration, perform a DFS with a
depth limit L.
4. Repeat: Continue this process until the goal node is found or the search space is
exhausted.
Knowledge representation issues
• 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
• 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.
• What to Represent:
• Following are the kind of knowledge which needs to be represented in
AI systems:
• Object: All the facts about objects in our world domain. E.g., Guitars
contains strings, trumpets are brass instruments.
• Events: Events are the actions which occur in our world.
• Performance: It describe behavior which involves knowledge about
how to do things.
• Meta-knowledge: It is knowledge about what we know.
• Facts: Facts are the truths about the real world and what we represent.
• Knowledge-Base: The central component of the knowledge-based
agents is the knowledge base. It is represented as KB. The
Knowledgebase is a group of the Sentences (Here, sentences are used
1. Declarative Knowledge
• Declarative knowledge is to know about something.
• It includes concepts, facts, and objects.
• It is also called descriptive knowledge and expressed in declarative sentences.
• It is simpler than procedural language.
2. Procedural Knowledge
It is also known as imperative knowledge.
Procedural knowledge is a type of knowledge which is responsible for knowing how to
do something.
It can be directly applied to any task.
It includes rules, strategies, procedures, agendas, etc.
• Procedural knowledge depends on the task on which it can be applied.
3. Meta-knowledge:
• Knowledge about the other types of knowledge is called Meta-knowledge.
4. Heuristic knowledge:
Heuristic knowledge is representing knowledge of some experts in a filed or subject.
• Heuristic knowledge is rules of thumb based on previous experiences, awareness of
approaches, and which are good to work but not guaranteed.
• 5. Structural knowledge:
• Structural knowledge is basic knowledge to problem-solving.
• It describes relationships between various concepts such as kind of, part of, and
grouping of something.
It describes the relationship that exists between concepts or objects
Issues in Knowledge Representation
• Important Attributed:
Any attribute of objects so basic that they occur in almost
every problem domain?
• Relationship among attributes:
Any important relationship that exists among object
attributed?
• Choosing Granularity:
At what level of detail should the knowledge be represented?
• Set of objects:
How should sets of objects be represented?
• Finding Right structure:
Given a large amount of knowledge stored in a database, how
can relevant parts are accessed when they are needed?
Frame problem
• The frame problem is a problem in AI that deals with the issue of how to
represent knowledge in a way that is useful for reasoning.
• The problem is that there is an infinite number of ways to represent any
given piece of information, and each representation has its own
advantages and disadvantages. The challenge is to find a representation
that is both expressive and efficient.
Monotonic Reasoning
Monotonic Reasoning is the process that does not change its direction or can say that it moves
in the one direction.
• Monotonic Reasoning will move in the same direction continuously means it will either move in
increasing order or decrease.
• But since Monotonic Reasoning depends on knowledge and facts, It will only increase and will
never decrease in this reasoning.
• Example:
Non-monotonic Reasoning is the process that changes its direction or values as the
knowledge base increases.
• Example:
• Consider a bowl of water, If we put it on the stove and turn the flame on it will obviously
boil hot and as we will turn off the flame it will cool down gradually.
Types of Reasoning Mechanisms in AI
Deductive Reasoning?
Deductive reasoning is a logical process where one draws a specific conclusion
from a general premise. It involves using general principles or accepted truths
to reach a specific conclusion.
For example, if the premise is "All birds have wings," and the specific
observation is "Robins are birds," then deducing that "Robins have wings" is a
logical conclusion.
• In deductive reasoning, the conclusion is necessarily true if the premises are
true.
Example of Abductive Reasoning : Let's take an example: Suppose you wake up one morning and find
that the street outside your house is wet.
2. Possible Hypotheses:
3. Additional Information: You recall that the weather forecast predicted rain for last night.
4. Abductive Reasoning Conclusion: The most plausible explanation for the wet street, given the forecast
and the lack of any other visible cause, is that it rained last night.
Sources of Uncertainty in Reasoning
Uncertainty is omnipresent because of incompleteness and incorrectness.
Uncertainty in Data : data derived from assumptions
Uncertainty in Knowledge Representation : limited expressiveness of the representation
mechanism
Uncertainty in Rules : conflict resolution and incomplete because some conditions are
unknown
Reasoning and KR
Non-Monotonic Reasoning:
In a non-monotonic reasoning system new information can be added which will
cause the deletion or alteration of existing knowledge. For example, imagine you
have invited someone to your house for dinner.
In the absence of any other information you may make an assumption that your
guest eats meat and will like chicken. Later you discover that the guest is in fact a
vegetarian and the inference that your guest likes chicken becomes invalid.
Step1: Say, The KB contains the propositions P, P->Q and modus ponens.
Step2: From this, the IE would rightfully conclude Q and add this conclusion to the KB.
Step3: Later, if it was learned that P was appropriate, it would be added to the KB
resulting in a contradiction.
Step4: Consequently, it would be necessary to remove P to eliminate the
inconsistency.
Truth Maintenance Systems can have different
characteristics:
• Justification-Based Truth Maintenance System (JTMS)
• It is a simple TMS where one can examine the consequences of the
current set of assumptions. The meaning of sentences is not known.
• Assumption-Based Truth Maintenance System (ATMS)
• It allows to maintain and reason with a number of simultaneous,
possibly incompatible, current sets of assumption. Otherwise it is
similar to JTMS, i.e. it does not recognise the meaning of sentences.
• Logical-Based Truth Maintenance System (LTMS)
• Like JTMS in that it reasons with only one set of current assumptions
at a time. More powerful than JTMS in that it recognises the
propositional semantics of sentences, i.e. understands the relations
between p and ~p, p and q and p&q, and so on.
Justification-Based Truth Maintenance
• A Justification-based truth maintenance system (JTMS) is a simple TMS where one can examine the
consequences of the current set of assumptions.
• In JTMS labels are attacched to arcs from sentence nodes to justification nodes. This label is either "+" or "-".
Then, for a justification node we can talk of its in-list, the list of its inputs with "+" label, and of its out-list, the list
of its inputs with "-" label.
• The meaning of sentences is not known. We can have a node representing a sentence p and one representing
~p and the two will be totally unrelated, unless relations are established between them by justifications.
• For example, we can write: