Artificial Intelligence Paper Solution May 2019
Artificial Intelligence Paper Solution May 2019
(Information Technology)
(Semester V)
2018-19
Artificial Intelligence
(USIT 504 Core)
University Paper Solution
By
Payal Shah
The Turing Test, proposed by Alan Turing (1950), was designed to provide a satisfactory
operational definition of intelligence. A computer passes the test if a human interrogator, after
posing some written questions, cannot tell whether the written responses come from a person or
from a computer. For now, we note that programming a computer to pass a rigorously applied
test provides plenty to work on. The computer would need to possess the following capabilities:
1. natural language processing to enable it to communicate successfully in English;
2. knowledge representation to store what it knows or hears;
3. automated reasoning to use the stored information to answer questions and to draw new
conclusions;
4. machine learning to adapt to new circumstances and to detect and extrapolate patterns.
Turing’s test deliberately avoided direct physical interaction between the interrogator and the
computer, because physical simulation of a person is unnecessary for intelligence. However, the
so-called total Turing Test includes a video signal so that the interrogator can test the subject’s
perceptual abilities, as well as the opportunity for the interrogator to pass physical objects
―through the hatch. To pass the total Turing Test,
1. the computer will need computer vision to perceive objects, and
2. robotics to manipulate objects and move about.
These six disciplines compose most of AI, and Turing deserves credit for designing a test that
remains relevant 60 years later. Yet AI researchers have devoted little effort to passing the Turing
Test, believing that it is more important to study the underlying principles of intelligence than to
duplicate an exemplar. The quest for ―artificial flight ‖ succeeded when the Wright brothers and
others stopped imitating birds and started using wind tunnels and learning about aerodynamics.
Aeronautical engineering texts do not define the goal of their field as making ―machines that fly
so exactly like pigeons that they can fool even other pigeons. ‖
1. An agent is anything that can perceive its environment through sensors and acts upon
that environment through effectors.
2. A human agent has sensory organs such as eyes, ears, nose, tongue and skin parallel to
the sensors, and other organs such as hands, legs, mouth, for effectors.
3. A robotic agent replaces cameras and infrared range finders for the sensors, and various
motors and actuators for effectors.
4. A software agent has encoded bit strings as its programs and actions.
Agent Terminology
In economics, game theory, decision theory, and artificial intelligence, a rational agent is an
agent that has clear preferences, models uncertainty via expected values of variables or functions
of variables, and always chooses to perform the action with the optimal expected outcome for
itself from among all feasible actions. A rational agent can be anything that makes decisions,
typically a person, firm, machine, or software.
Rational agents are also studied in the fields of cognitive science, ethics, and philosophy,
including the philosophy of practical reason.
Rationality is nothing but status of being reasonable, sensible, and having good sense of
judgment.
1. Rationality is concerned with expected actions and results depending upon what the
agent has perceived. Performing actions with the aim of obtaining useful information is an
important part of rationality.
2. Rationality of an agent depends on the following four factors –
a. The performance measures, which determine the degree of success.
Artificial Intelligence Page 4
b. Agent’s Percept Sequence till now.
c. The agent’s prior knowledge about the environment.
d. The actions that the agent can carry out.
Sometimes we do not need an extensive analysis of the game state to figure out our next
move. At times, the game is simple enough that we can make a general strategy and represent
it as a set of rules. A rule would specify that a if a certain condition is met, a certain action
should be taken. An agent built using such rules is called a Simple Reflex Agent
This agent selects actions based on the agents current perception or the world and not based
on past perceptions.
For example if a mars lander found a rock in a specific place it needed to collect then it would
collect it, if it was a simple reflex agent then if it found the same rock in a different place it would
still pick it up as it doesn't take into account that it already picked it up.
This is useful for when a quick automated response is needed, humans have a very similar
reaction to fire for example, our brain pulls our hand away without thinking about any possibility
that there could be danger in the path of your arm. We call these reflex actions.
This kind of connection where only one possibility is acted upon is called a condition-action rule,
written as:
The simple reflex agent has a library of such rules so that if a certain situation should arise and it
is in the set of Condition-action rules the agent will know how to react with minimal reasoning.
Simple Reflex agent choose actions only based on the current percept.
They are rational only if a correct decision is made only based on current precept.
Their environment is completely observable.
Question 2
Q2a. List and explain performance measuring ways for problem solving.
Ans:
We can evaluate an algorithm’s performance in four ways:
1. Completeness: Is the algorithm guaranteed to find a solution when there is one?
2. Optimality: Does the strategy find the optimal solution,
Time and space complexity are always considered with respect to some measure of the problem
difficulty.
In AI, the graph is often represented implicitly by the initial state, actions, and transition model
and is frequently infinite. For these reasons, complexity is expressed in terms of three quantities:
1. b, the branching factor or maximum number of successors of any node;
2. d, the depth of the shallowest goal node (i.e., the number of steps along the path from the
root);
m, the maximum length of any path in the state space.
Uniform Cost Search is the best algorithm for a search problem, which does not involve the use of
heuristics. It can solve any general graph for optimal cost. Uniform Cost Search as it sounds
searches in branches which are more or less the same in cost.
Uniform Cost Search again demands the use of a priority queue. Recall that Depth First Search
used a priority queue with the depth up to a particular node being the priority and the path from
the root to the node being the element stored. The priority queue used here is similar with the
priority being the cumulative cost up to the node. Unlike Depth First Search where the maximum
depth had the maximum priority, Uniform Cost Search gives the minimum cumulative cost the
maximum priority.
Global maxima: It is the best possible state in the state space diagram. This because at this state,
objective function has highest value.
Local maxima: a local maximum is a peak that is higher than each of its neighboring states but
lower than the global maximum. Hill-climbing algorithms that reach the vicinity of a local
maximum will be drawn upward toward the peak but will then be stuck with nowhere else to
go
A genetic algorithm makes uses of techniques inspired from evolutionary biology such as
selection, mutation, inheritance and recombination to solve a problem. The most commonly
employed method in genetic algorithms is to create a group of individuals randomly from a given
population. The individuals thus formed are evaluated with the help of the evaluation function
provided by the programmer. Individuals are then provided with a score which indirectly
highlights the fitness to the given situation. The best two individuals are then used to create one
or more offspring, after which random mutations are done on the offspring. Depending on the
needs of the application, the procedure continues until an acceptable solution is derived or until
a certain number of generations have passed.
A genetic algorithm differs from a classical, derivative-based, optimization algorithm in two ways:
Like A* algorithm here we will use two arrays and one heuristic function.
OPEN: It contains the nodes that has been traversed but yet not been marked solvable or unsolvable.
CLOSE: It contains the nodes that have already been processed.
Step 1:
In the above graph the solvable nodes A,B,C,D,E,F and the unsolvable nodes are G,H. Take A as
Step2:
The children of A are B and C which are solvable. So place them into OPEN and place A into the
close.
OPEN= B C
CLOSE= A
Step 3:
Now process the nodes B and C. The children of B and C are to be place into OPEN. Also
remove B and C from OPEN and place them into CLOSE.
So OPEN= G D E ABC
Step 4:
As the nodes G and H are unsolvable, so place them directly into CLOSE and process the nodes D
and E.
i.e. OPEN= A
Step 5:
Now we have been reached at our goal state. So place F into CLOSE.
A B C G(O) D E H(O) F
Step 6
Success and exit.
AO* graph
Question 3
Q3a. List and explain the elements used to define the game formally.
Ans:
A game can be formally defined as a kind of search problem with the following elements:
a. S0: The initial state, which specifies how the game is set up at the start.
b. PLAYER(s): Defines which player has the move in a state
c. ACTIONS(s): Returns the set of legal moves in a state.
d. RESULT(s, a): The transition model, which defines the result of a move.
e. TERMINAL-TEST(s): A terminal test, which is true when the game is over and false
f. TERMINAL STATES otherwise. States where the game has ended are called terminal states.
g. UTILITY(s, p): A utility function (also called an objective function or payoff
function),defines the final numeric value for a game that ends in terminal states 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.
Q3d. Write the connectives used to form complex sentence of propositional logic. Give
example for each.
Ans:
The syntax of propositional logic defines the allowable sentences. The atomic sentences
consist of a single proposition symbol.
Each such symbol stands for a proposition that can be true or false.
There are two proposition symbols with fixed meanings: True is the always-true
proposition and False is the always-false proposition.
Complex sentences are constructed from simpler sentences, using parentheses and logical
connectives. There are five connectives in common use:
1. ¬ (not). A sentence such as ¬W1,3 is called the negation of W1,3. A literal is
either an atomic sentence (a positive literal) or a negated atomic sentence (a
negative literal).
2. ∧ (and). A sentence whose main connective is ∧, such as W1,3 ∧ P3,1, is called a
conjunction; its parts are the conjuncts. (The ∧ looks like an “A” for “And.”).
3. ∨ (or). A sentence using ∨, such as (W1,3∧P3,1)∨W2,2, is a disjunction of the
disjuncts (W1,3 ∧ P3,1) and W2,2. (Historically, the ∨ comes from the Latin “vel,”
which means “or.” For most people, it is easier to remember ∨ as an upside-down
∧.)
We present here two techniques for logical theorem proving in propositional logic.
These are:
1. Semantic, and
1. Semantic Method:
The following notation will be used to represented a symbolic theorem, stating that
conclusion “c” follows from a set of premises p 1, p2…pn
2. Syntactic Methods
The syntactic approach for theorem proving can be done in two ways, namely:
Question 4
or
term1 = term2
An atomic sentence is formed from a predicate symbol followed by list of terms.
Examples:
LargeThan(2,3) is false.
Brother_of(Mary,Pete) is false.
Married(Father(Richard),Mother(John)) could be true or false.
Brother_of(Pete,Brother(Pete)) is True.
Binary relation Function
Complex Sentences
To make complex sentence with connectives (just like in propositional logic).
Q4e. Write and explain a simple backward-chaining algorithm for first-order knowledge
bases.
Ans:
Owns(Nono,M1)
Missile(M1)
3) All of its missiles were sold to it by Colonel West
Missile(x) ⇒ Weapon(x)
5) enemy of America counts as “hostile”:
Enemy(x,America) ⇒ Hostile(x) .
6) West, who is American ...”:
Enemy(Nono,America) .
Definite clause grammar (DCG) is a way of expressing grammar, either for natural or
formal languages, in a logic programming language such as Prolog. It is closely related to
the concept of attribute grammars / affix grammars from which Prolog was originally
developed. DCGs are usually associated with Prolog, but similar languages such as
Mercury also include DCGs. They are called definite clause grammars because they
represent a grammar as a set of definite clauses in first-order logic.
The term DCG refers to the specific type of expression in Prolog and other similar
languages; not all ways of expressing grammars using definite clauses are considered
DCGs. However, all of the capabilities or properties of DCGs will be the same for any
grammar that is represented with definite clauses in essentially the same way as in Prolog.
The definite clauses of a DCG can be considered a set of axioms where the validity of a
sentence, and the fact that it has a certain parse tree can be considered theorems that
follow from these axioms. This has the advantage of making it so that recognition and
parsing of expressions in a language becomes a general matter of proving statements,
such as statements in a logic programming language.
Question 5
This section shows how to extract a plan directly from the planning graph, rather than just
using the graph to provide a heuristic. The GRAPHPLAN algorithm repeatedly adds a level
to a planning graph with EXPAND-GRAPH. Once all the goals show up as non mutex in the
graph, GRAPHPLAN calls EXTRACT-SOLUTION to search for a plan that solves the problem.
If that fails, it expands another level and tries again, terminating with failure when there is
no reason to go on.
ii. Default logic: Default logic is a formalism in which default rules can be written to
generate contingent, nonmonotonic conclusions. A default rule looks like this:
Bird(x) : Flies(x)/Flies(x) .
---------------------------------------