AI-IAE 3 QP Answer Key
AI-IAE 3 QP Answer Key
(AUTONOMOUS)
B.E/B.TechINTERNAL ASSESSMENT EXAMINATION–III,November-2024
III-Semester
B.E/B.Tech– Artificial Intelligence and Data Science 20AI301-Artificial
Intelligence
(Regulation2023)
Time:01.30Hours MaximumMarks:50
AnswerAllQuestions PART - A (9 x 2= 18 Marks)
∀x ¬ P ≡ ¬ ∃x P ¬ P Λ ¬ Q ≡ ¬ (P V Q)
quantified sentences.
¬ ∀x P ≡ ∃x ¬ P ¬ (P Λ Q) ≡ ¬ P V ¬ Q
∀x P ≡ ¬ ∃x ¬ P PΛ Q ≡ ¬ (¬ P V ¬ Q)
∃x P ≡ ¬ ∀x ¬P PV Q ≡ ¬ (¬ P Λ ¬ Q.
Let us watch a knowledge-based wumpus agent exploring the environment shown in Figure.
The first percept is [None, None, None, None, None], from which the agent can conclude that its neighboring
squares, [1,2] and [2,1], are free of dangers—they are OK.
A cautious agent will move only into a square that it knows to be OK. Let us suppose the agent decides to move
forward to [2,1].
The agent perceives a breeze (denoted by “B”) in [2,1], so there must be a pit in a neighboring square.
The pit cannot be in [1,1], by the rules of the game, so there must be a pit in [2,2] or [3,1] or both. Denoted as P?.
At this point, there is only one known square that is OK and that has not yet been visited. So the prudent agent will
turn around, go back to [1,1], and then proceed to [1,2].
The agent perceives a stench in [1,2], resulting in the state of knowledge.
The stench in [1,2] means that there must be a wumpus nearby.
wumpus cannot be in [1,1], by the rules of the game, and it cannot be in [2,2] (or the agent would have detected a
stench when it was in [2,1]).
Therefore, the agent can infer that the wumpus is in [1,3]. The notation W! indicates this inference.
Moreover, the lack of a breeze in [1,2] implies that there is no pit in [2,2].
Yet the agent has already inferred that there must be a pit in either [2,2] or [3,1], so this means it must be in [3,1].
This is a fairly difficult inference, because it combines knowledge gained at different times in different places and
relies on the lack of a percept to make one crucial step.
The agent has now proved to itself that there is neither a pit nor a wumpus in [2,2], so it is OK to move there.
We do not show the agent’s state of knowledge at [2,2];
we just assume that the agent turns and moves to [2,3], giving us Figure 7.4(b).
In [2,3], the agent detects a glitter, so it should grab the gold and then return home.
(or)
10(b) i. How do the processes of universal and existential instantiation affect the efficiency and completeness of an inference CO4 2,3 K3
system in first-order logic? Analyze the potential limitations of these inference rules in handling complex, real-world
knowledge bases, particularly regarding scalability and the management of variables and constants."
Mary admires every artist."
Everystudenthasatextbook."
Aliceknowsatleastonephilosopher.""John knows
everyone in the room." All programmers write code."
Inference in First-Order Logic is used to deduce new facts or sentences from existing sentences. Before understanding the
FOL inference rule, let's understand some basic terminologies used in FOL.
Substitution:
Substitution is a fundamental operation performed on terms and formulas. It occurs in all inference systems in first-order
logic. The substitution is complex in the presence of quantifiers in FOL. If we write F[a/x], so it refers to substitute a constant
"a" in place of variable "x".
Equality:
Skip Ad First-Order logic does not only use predicate and terms for making atomic sentences but also uses another way,
which is equality in FOL. For this, we can use equality symbols which specify that the two terms refer to the same object.
Example: Brother (John) = Smith.
As in the above example, the object referred by the Brother (John) is similar to the object referred by Smith. The equality
symbol can also be used with negation to represent that two terms are not the same objects.
: ¬(x=y) which is equivalent to x ≠y
Universal Generalization:
This rule can be used if we want to show that every element has a similar property.
In this rule, x must not appear as a free variable. Example: Let's represent, P(c): "A byte contains 8 bits", so for ∀ x P(x)
"All bytes contain 8 bits.", it will also be true.
Universal Instantiation:
Universal instantiation is also called as universal elimination or UI is a valid inference rule. It can be applied multiple times
to add new sentences.
The new KB is logically equivalent to the previous KB.
The UI rule state that we can infer any sentence P(c) by substituting a ground term c (a constant within domain x) from ∀ x
As per UI, we can infer any sentence obtained by substituting a ground term for the variable.
Example:1. IF "Every person like ice-cream"=> ∀x P(x) so we can infer that "John likes ice-cream" => P(c)
So from this information, we can infer any of the following statements using Universal Instantiation:
3. Existential Instantiation:
Existential instantiation is also called as Existential Elimination, which is a valid inference rule in first-order logic.
It can be applied only once to replace the existential sentence.
The new KB is not logically equivalent to old KB, but it will be satisfiable if old KB was satisfiable.
This rule states that one can infer P(c) from the formula given in the form of for a new constant symbol c.
The restriction with this rule is that c used in the rule must be a new term for which P(c ) is true.
So we can infer: Crown(K) ∧ OnHead( K, John), as long as K does not appear in the knowledge base.
4.Existential introduction
An existential introduction is also known as an existential generalization, which is a valid inference rule in first-order logic
This rule states that if there is some element c in the universe of discourse which has a property P, then we can infer that
there exists something in the universe which has the property P.
Example: Let's say that, "Priyanka got good marks in English." "Therefore, someone got good marks in English.
11 (a) i. Apply both forward planning and backward planning in state space to transfer 20 CO5 2,3 K3
parcelsfromoneplaceAtoanotherplaceBusingtwocargoflights.Describethesteps you would take for each planning method,
including any challenges you might face in applying these approaches
The following are the two types of state space search ,
o Forward state-space search
o Backward state-space search
Forward state-space search
Planning with forward state-space search is similar to the problem-solving. It is sometimes called progression planning,
because it moves in the forward direction.
We start in the problem's initial state, considering sequences of actions until we find a sequence
that reaches a goal state. The formulation of planning problems as state-space search problems is as follows:
The initial state of the search is the initial state from the planning problem. In general,each state will be a set of
positive ground literals; literals not appearing are false.
The actions that are applicable to a state are all those whose preconditions are satisfied. The successor state
resulting from an action is generated by adding the positive effectliterals and deleting the negative effect literals.
The goal test checks whether the state satisfies the goal of the planning problem.
The step cost of each action is typically 1.
Why forward state space search is inefficient?
It does not address the irrelevant action problem-all applicable actions are considered from each state.
The approach quickly bogs down without a good heuristic.
Backward state-space search
Backward search is similar to bidirectional search.
Disadvantages
o Difficult to implement when the goal states are described by a set of constraints rather than being listed
explicitly.
o It is not always obvious how to generate a description of the possible predecessors of the set of goal
states.
Advantages
o It allows us to consider only relevant actions.
o An action is relevant to a conjunctive goal if it achieves one of the conjuncts of the goal.
Searching backwards is sometimes called regression planning.
The principal question is:- what are the states from which applying a given action leads to the goal?
Computing the description of these states is called regressing the goal through the action.
consider the air cargo example;- we have the goal as,
At(C1,B) ˄At(C2,B) ˄…… ˄At(C20,B)
o and the relevant action Unload(C1,p,B), which achieves the first conjunct.
o The action will work only if its preconditions are satisfied.
o Therefore , any predecessor state must include these preconditions : In(C1,p) At(p,B), Moreover the
subgoal At(C1,B) should not be true in the predecessor state.
o The predecessor description is
In(C1,p) ˄ At(p,B) ˄ At(C2,B) ˄ …… ˄ At(C20,B)
o In addition to insisting that actions achieve some desired literal, we must insist that the actions not undo
any desired literals.
o An action that satisfies this restriction is called consistent.
Given definitions of relevance and consistency, we can describe the general process ofconstructing predecessors for
backward search.
Given a goal description G, let A be an actionthat is relevant and consistent.
The corresponding predecessor is as follows:
o Any positive effects of A that appear in G are deleted.
o Each precondition literal of A is added, unless it already appears.
Any of the standard search algorithms can be used to carry out the search.
Termination occurs when a predecessor description is generated that is satisfied by the initial state of the planning
problem
(or)
11 (b) i. How would you structure a hierarchical task network planning plant o build a house, CO3 2,3 K3
breaking down high-level tasks into manageable subtasks while considering dependencies, resource constraints, and
timelines? Discuss how each primary task—
o One of the most pervasive ideas for dealing with complexity is hierarchical decomposition.
o The key benefit of hierarchical structure is that, at each level of the hierarchy, a computational task, military mission, or
administrative function is reduced to a small number of activities at the next lower level, so that the computational cost
of finding the correct way to arrange those activities for the current problem is small.
o Hierarchical task networks or HTNs approach combines ideas from both partial-order planning and the area known as
"HTN planning."
o In HTN planning, the initial plan, which describes the problem, is viewed as a very high-level description
o Plans are refined by applying action decompositions.
o Each action decomposition reduces a high-level action to a partially ordered set of lower-level actions.
o Action decompositions, therefore, embody knowledge about how to implement actions.
o Forexample, building a house might be reduced to obtaining a permit, hiring a contractor, doing
the construction, and paying the contractor.
o The process continues until only primitive actions remain in the plan.
o Typically, the primitiveactions will be actions that the agent can execute automatically.
Representing action decompositions
o General descriptions of action decomposition methods are stored in a plan library, fromwhich they are extracted and
instantiated to fit the needsof the plan being constructed.
o Eachmethod is an expression of the form Decompose(a, d).
o This says that an action a can bedecomposed into the plan d, which is represented as a partial-order plan.
o Building a house is a nice, concrete example, so we will use it to illustrate the conceptof action decomposition.
o Figure 12.5 depicts one possible decomposition of the BuildHouseaction into four lower-level actions.
o Figure 12.6 shows some of the action descriptions for thedomain, as well as the decomposition for BuildHouse as it
would appear in the plan library.
o The Start action of the decomposition supplies all those preconditions of actions in theplan that are not supplied by other
actions.
o These are called external preconditions.
o In the example, the external preconditions of the decomposition are Land and Money. Similarly, the external effects,
which are the preconditions of Finish, are all those effects ofactions in the plan that are not negated by other actions.
o In our example, the external effectsof BuildHouse are House and money.
o Some HTN planners also distinguish between primary effects, such as House, and secondary effects, such as money.
o Only primary effectsmay be used to achieve goals, whereas both kinds of effects might cause conflicts with
otheractions; this can greatly reduce the search space.
Modifying the planner for decompositions
o To incorporate HTN planning POP is modified.
o It is done by modifying the successor function of the to allow decomposition methods to be applied to thecurrent partial
plan P.
o The new successor plans are formed by first selecting some nonprimitive action a' in P and then, for any Decompose(a,
d) method from the plan library such thata and a' unify with substitution, replacing a' with d' = SUBST(θ, d).
o Figure 12.7 shows an example.
o At the top, there is a plan P for getting a house.
o Thehigh-level action, a' = BuildHouse, is selected for decomposition.
o The decomposition d isselected from Figure 12.5, and BuildHouseis replaced by this decomposition.
o An additional step, GetLoan, is then introduced to resolve the new open condition, Money, that is createdby the
decomposition step.