You are on page 1of 41

Artificial intelligence

Artificial intelligence is the simulation of


human intelligence processes by machines,
especially computer systems. Specific
applications of AI include expert systems,
natural language processing, speech
recognition and machine vision.

Artificial Intelligence is composed of two


words Artificial and Intelligence, where
Artificial defines "man-made," and intelligence
defines "thinking power", hence AI means "a
man-made thinking power."

define AI as:

"It is a branch of computer science by which we


can create intelligent machines which can
behave like a human, think like humans, and
able to make decisions."
Artificial Intelligence exists when a machine can
have human based skills such as learning,
reasoning, and solving problems
Why Artificial Intelligence?

Before Learning about Artificial Intelligence,


we should know that what is the importance of
AI and why should we learn it. Following are
some main reasons to learn about AI:

o With the help of AI, you can create such


software or devices which can solve real-
world problems very easily and with
accuracy such as health issues, marketing,
traffic issues, etc.
o With the help of AI, you can create your
personal virtual Assistant, such as Cortana,
Google Assistant, Siri, etc.
o With the help of AI, you can build such
Robots which can work in an environment
where survival of humans can be at risk.
o AI opens a path for other new
technologies, new devices, and new
Opportunities.
Advantages of Artificial Intelligence

Following are some main advantages of


Artificial Intelligence:

o High Accuracy with less errors: AI


machines or systems are prone to less
errors and high accuracy as it takes
decisions as per pre-experience or
information.

o High-Speed: AI systems can be of very


high-speed and fast-decision making,
because of that AI systems can beat a
chess champion in the Chess game.

o High reliability: AI machines are highly


reliable and can perform the same action
multiple times with high accuracy.

o Useful for risky areas: AI machines can be


helpful in situations such as defusing a
bomb, exploring the ocean floor, where to
employ a human can be risky.
o Digital Assistant: AI can be very useful to
provide digital assistant to the users such
as AI technology is currently used by
various E-commerce websites to show the
products as per customer requirement.

o Useful as a public utility: AI can be very


useful for public utilities such as a self-
driving car which can make our journey
safer and hassle-free, facial recognition for
security purpose, Natural language
processing to communicate with the
human in human-language, etc.

Disadvantages of Artificial Intelligence

Every technology has some disadvantages, and


the same goes for Artificial intelligence. Being
so advantageous technology still, it has some
disadvantages which we need to keep in our
mind while creating an AI system. Following
are the disadvantages of AI:

o High Cost: The hardware and software


requirement of AI is very costly as it
requires lots of maintenance to meet
current world requirements.
o Can't think out of the box: Even we are
making smarter machines with AI, but still
they cannot work out of the box, as the
robot will only do that work for which they
are trained, or programmed.
o No feelings and emotions: AI machines
can be an outstanding performer, but still
it does not have the feeling so it cannot
make any kind of emotional attachment
with human, and may sometime be
harmful for users if the proper care is not
taken.
o Increase dependency on machines: With
the increment of technology, people are
getting more dependent on devices and
hence they are losing their mental
capabilities.
o No Original Creativity: As humans are so
creative and can imagine some new ideas
but still AI machines cannot beat this
power of human intelligence and cannot
be creative and imaginative.
Prerequisite

Before learning about Artificial Intelligence,


you must have the fundamental knowledge of
following so that you can understand the
concepts easily:

o any computer language such as C, C++,


Java, Python, etc.(knowledge of Python will
be an advantage)
o Knowledge of essential Mathematics such
as derivatives, probability theory, etc.

What Comprises to Artificial Intelligence?

Artificial Intelligence is not just a part of


computer science even it's so vast and requires
lots of other factors which can contribute to it.
To create the AI first we should know that how
intelligence is composed, so the Intelligence is
an intangible part of our brain which is a
combination of Reasoning, learning,
problem-solving perception, language
understanding, etc.
To achieve the above factors for a machine or
software Artificial Intelligence requires the
following discipline:

o Mathematics
o Biology
o Psychology
o Sociology
o Computer Science
o Neurons Study
o Statistics
Application of AI

Artificial Intelligence has various applications


in today's society. It is becoming essential for
today's time because it can solve complex
problems with an efficient way in multiple
industries, such as Healthcare, entertainment,
finance, education, etc. AI is making our daily
life more comfortable and fast.

1. AI in Astronomy
o Artificial Intelligence can be very useful to
solve complex universe problems. AI
technology can be helpful for
understanding the universe such as how it
works, origin, etc.
2. AI in Healthcare

o In the last, five to ten years, AI becoming


more advantageous for the healthcare
industry and going to have a significant
impact on this industry.
o Healthcare Industries are applying AI to
make a better and faster diagnosis than
humans. AI can help doctors with
diagnoses and can inform when patients
are worsening so that medical help can
reach to the patient before hospitalization.
3. AI in Gaming

o AI can be used for gaming purpose. The AI


machines can play strategic games like
chess, where the machine needs to think
of a large number of possible places.
4. AI in Finance
o AI and finance industries are the best
matches for each other. The finance
industry is implementing automation,
chatbot, adaptive intelligence, algorithm
trading, and machine learning into
financial processes.
5. AI in Data Security

o The security of data is crucial for every


company and cyber-attacks are growing
very rapidly in the digital world. AI can be
used to make your data more safe and
secure. Some examples such as AEG bot,
AI2 Platform,are used to determine
software bug and cyber-attacks in a better
way.
6. AI in Social Media

o Social Media sites such as Facebook,


Twitter, and Snapchat contain billions of
user profiles, which need to be stored and
managed in a very efficient way. AI can
organize and manage massive amounts of
data. AI can analyze lots of data to identify
the latest trends, hashtag, and
requirement of different users.
7. AI in Travel & Transport

o AI is becoming highly demanding for


travel industries. AI is capable of doing
various travel related works such as from
making travel arrangement to suggesting
the hotels, flights, and best routes to the
customers. Travel industries are using AI-
powered chatbots which can make
human-like interaction with customers for
better and fast response.
8. AI in Automotive Industry

o Some Automotive industries are using AI


to provide virtual assistant to their user for
better performance. Such as Tesla has
introduced TeslaBot, an intelligent virtual
assistant.
o Various Industries are currently working
for developing self-driven cars which can
make your journey more safe and secure.
9. AI in Robotics:

o Artificial Intelligence has a remarkable role


in Robotics. Usually, general robots are
programmed such that they can perform
some repetitive task, but with the help of
AI, we can create intelligent robots which
can perform tasks with their own
experiences without pre-programmed.
o Humanoid Robots are best examples for AI
in robotics, recently the intelligent
Humanoid robot named as Erica and
Sophia has been developed which can talk
and behave like humans.
10. AI in Entertainment

o We are currently using some AI based


applications in our daily life with some
entertainment services such as Netflix or
Amazon. With the help of ML/AI
algorithms, these services show the
recommendations for programs or shows.
11. AI in Agriculture

o Agriculture is an area which requires


various resources, labor, money, and time
for best result. Now a day's agriculture is
becoming digital, and AI is emerging in
this field. Agriculture is applying AI as
agriculture robotics, solid and crop
monitoring, predictive analysis. AI in
agriculture can be very helpful for farmers.
12. AI in E-commerce

o AI is providing a competitive edge to the


e-commerce industry, and it is becoming
more demanding in the e-commerce
business. AI is helping shoppers to
discover associated products with
recommended size, color, or even brand.
13. AI in education:

o AI can automate grading so that the tutor


can have more time to teach. AI chatbot
can communicate with students as a
teaching assistant.
o AI in the future can be work as a personal
virtual tutor for students, which will be
accessible easily at any time and any place.
Real Life Applications of Research Areas
There is a large array of applications where AI is
serving common people in their day-to-day lives −
Sr.No. Research Areas Real Life
Application

1 Expert Systems
Examples − Flight-tracking systems,
Clinical systems.

2 Natural Language Processing


Examples: Google Now feature,
speech recognition, Automatic voice
output.

3 Neural Networks
Examples − Pattern recognition
systems such as face recognition,
character recognition, handwriting
recognition.

4 Robotics
Examples − Industrial robots for
moving, spraying, painting, precision
checking, drilling, cleaning, coating,
carving, etc.

5 Fuzzy Logic Systems


Examples − Consumer electronics,
automobiles, etc.
Humans learn mundane (ordinary) tasks since
their birth. They learn by perception, speaking,
using language, and locomotives. They learn
Formal Tasks and Expert Tasks later, in that order.
For humans, the mundane tasks are easiest to
learn. The same was considered true before trying
to implement mundane tasks in machines. Earlier,
all work of AI was concentrated in the mundane
task domain.
Later, it turned out that the machine requires more
knowledge, complex knowledge representation,
and complicated algorithms for handling mundane
tasks. This is the reason why AI work is more
prospering in the Expert Tasks domain now, as
the expert task domain needs expert knowledge
without common sense, which can be easier to
represent and handle.

Problem Characteristics in Artificial


Intelligence

o To choose an appropriate method for a


particular problem first we need to
categorize the problem based on the
following characteristics.
o Is the problem decomposable into small
sub-problems which are easy to solve?
o Can solution steps be ignored or undone?
o Is the universe of the problem is
predictable?
o Is a good solution to the problem is
absolute or relative?
o Is the solution to the problem a state or a
path?
o What is the role of knowledge in solving a
problem using artificial intelligence?
o Does the task of solving a problem require
human interaction?
o

o 1. Is the problem decomposable into small


sub-problems which are easy to solve?
o Can the problem be broken down into
smaller problems to be solved
independently?
o The decomposable problem can be solved
easily.
o Example: In this case, the problem is
divided into smaller problems. The smaller
problems are solved independently. Finally,
the result is merged to get the final result.

2. Can solution steps be ignored or undone?


In the Theorem Proving problem, a lemma that has been proved can be
ignored for the next steps.

Such problems are called problems.

In the 8-Puzzle, Moves can be undone and backtracked.

Such problems are called Recoverable problems.

In Playing Chess, moves can be retracted.

Such problems are called Irrecoverable problems.

Ignorable problems can be solved using a simple control structure that never
backtracks. Recoverable problems can be solved using
backtracking. Irrecoverable problems can be solved by recoverable style
methods via planning.
3. Is
the universe of the problem is
predictable?
In Playing Bridge, We cannot know exactly where all the cards are or what the
other players will do on their turns.

Uncertain outcome!

For certain-outcome problems, planning can be used to generate a


sequence of operators that is guaranteed to lead to a solution.

For uncertain-outcome problems, a sequence of generated operators can


only have a good probability of leading to a solution. Plan revision is made as
the plan is carried out and the necessary feedback is provided.

4. Is a good solution to the problem is absolute or relative?

The Travelling Salesman Problem, we have to try all paths to find the shortest
one.

Any path problem can be solved using heuristics that suggest good paths to
explore.

For best-path problems, a much more exhaustive search will be performed.

5. Is the solution to the problem a state or a path

The Water Jug Problem, the path that leads to the goal must be reported.

A path-solution problem can be reformulated as a state-solution problem by


describing a state as a partial path to a solution. The question is whether that
is natural or not.
6. What is the role of knowledge in solving a problem using
artificial intelligence?

Playing Chess

Consider again the problem of playing chess. Suppose you had unlimited
computing power available. How much knowledge would be required by a
perfect program? The answer to this question is very little—just the rules for
determining legal moves and some simple control mechanism that
implements an appropriate search procedure.
Additional knowledge about such things as good strategy and tactics could of
course help considerably to constrain the search and speed up the execution
of the program. Knowledge is important only to constrain the search for a
solution.

Reading Newspaper

Now consider the problem of scanning daily newspapers to decide which are
supporting the Democrats and which are supporting the Republicans in some
upcoming election. Again assuming unlimited computing power, how much
knowledge would be required by a computer trying to solve this problem?
This time the answer is a great deal.

It would have to know such things as:

 The names of the candidates in each party.


 The fact that if the major thing you want to see done is have taxes
lowered, you are probably supporting the Republicans.
 The fact that if the major thing you want to see done is improved
education for minority students, you are probably supporting the
Democrats.
 The fact that if you are opposed to big government, you are probably
supporting the Republicans.
 And so on …
Knowledge is required even to be able to recognize a solution.

7. Does the task of solving a problem require human interaction?

Sometimes it is useful to program computers to solve problems in ways that


the majority of people would not be able to understand.
This is fine if the level of the interaction between the computer and its human
users is problem-in solution-out.

But increasingly we are building programs that require intermediate


interaction with people, both to provide additional input to the program and
to provide additional reassurance to the user.

The solitary problem, in which there is no intermediate communication and


no demand for an explanation of the reasoning process.

The conversational problem, in which intermediate communication is to


provide either additional assistance to the computer or additional information
to the user.

Production System in
Artificial Intelligence
If a system with production rules and a rule-
interpreter then the system is known as a production
system. In these systems, the working memory of the
system models human short-term memory while
productions are part of long-term memory.

Rules of Production System:


Rule-1: Production systems represent both knowledge as
well as action.
Rule-2: Production systems provide a language in which
the representation of expert knowledge is very natural.
Rule-3: Production systems provides a heuristics model for
human behaviour.
Rule-4: Production systems model strong data-driven
nature of intelligent action. Whenever new inputs enter
the database, the behaviour of the system changes.
Rule-5: Production systems allow us to add new rules
easily without disturbing the rest of the system.

knowledge-based systems (KBS)


A knowledge-based system (KBS) is a form of artificial


intelligence (AI) that aims to capture the knowledge of
human experts to support decision-making. Examples of
knowledge-based systems include expert systems, which
are so called because of their reliance on human expertise.

The typical architecture of a knowledge-based system,


which informs its problem-solving method, includes a
knowledge base and an inference engine. The knowledge
base contains a collection of information in a given field --
medical diagnosis, for example. The inference engine
deduces insights from the information housed in the
knowledge base. Knowledge-based systems also include
an interface through which users query the system and
interact with it.

A knowledge-based system may vary with respect to its


problem-solving method or approach. Some systems
encode expert knowledge as rules and are therefore
referred to as rule-based systems. Another approach,
case-based reasoning, substitutes cases for rules. Cases
are essentially solutions to existing problems that a case-
based system will attempt to apply to a new problem.

Knowledge-based systems represent a rules-based or


case-based approach to AI

Where knowledge-based systems are used

Over the years, knowledge-based systems have been


developed for a number of applications. MYCIN, for
example, was an early knowledge-based system created
to help doctors diagnose diseases. Healthcare has
remained an important market for knowledge-based
systems, which are now referred to as clinical decision-
support systems in the health sciences context.

Knowledge-based systems have also been employed in


applications as diverse as avalanche path analysis,
industrial equipment fault diagnosis and cash
management.

State Space Search Problem Example


State Space Search:
A state-space defined as a set of all possible states
of a problem. A State Space Search representation
allows for the formal definition of a problem that
makes the move from the initial state to the goal
state.
Advantages:
1. It is very useful in AI because of it provides a set of all
possible states, operations and goals.
2. If the entire state space is for a problem then it is
possible to trace the path from the initial to the goal state
and identify the sequence of operation required for doing it.
Disadvantages:
1. It is not possible to visualize all states for a problem.
2. The resources of the computer system are very limited
to handle huge combinational state-space.

1.Water Jug Problem

Problem: There are two jugs


of volume A litre and B litre. Neither has
any measuring mark on it.There is a pump that can be
used to fill the jugs with water.How can you get
exactly x litre of water into the A litre jug.Assuming
that we have unlimited supply of water.
Note:Let's assume we have A=4 litre and B= 3 litre
jugs. And we want exactly 2 Litre water into jug A (i.e
4 litre jug) how we will do this.
Solution:
The state space for this problem can be described as the
set of ordered pairs of integers (x,y)
Where,
x represents the quantity of water in the 4-gallon jug x=
0,1,2,3,4
y represents the quantity of water in 3-gallon
jug y=0,1,2,3
Start State: (0,0)
Goal State: (2,0)
Generate production rules for the water jug problem
We basically perform three operations to achieve the
goal.
1. Fill water jug.
2. Empty water jug
3. and Transfer water jug
Water jug problem in Artificial
Intelligence
we will learn about the very popular problem dealt with
Artificial Intelligence: the water jug problem. We will
learn what this problem is, what set of rules were made to
solve it, and what was the final set of rules in solving the
problem?

In the water jug problem in Artificial Intelligence, we


are provided with two jugs: one having the capacity to
hold 3 gallons of water and the other has the capacity to
hold 4 gallons of water. There is no other measuring
equipment available and the jugs also do not have any
kind of marking on them. So, the agent’s task here is to fill
the 4-gallon jug with 2 gallons of water by using only
these two jugs and no other material. Initially, both our
jugs are empty.

So, to solve this problem, following set of rules were


proposed:

Production rules for solving the water jug problem

Here, let x denote the 4-gallon jug and y denote the 3-


gallon jug.

Initial Final
S.No. Condition Description of action taken
State state
1. (x,y) If x<4 (4,y) Fill the 4 gallon jug completely
2. (x,y) if y<3 (x,3) Fill the 3 gallon jug completely
3. (x,y) If x>0 (x-d,y) Pour some part from the 4 gallon jug
4. (x,y) If y>0 (x,y-d) Pour some part from the 3 gallon jug
5. (x,y) If x>0 (0,y) Empty the 4 gallon jug
6. (x,y) If y>0 (x,0) Empty the 3 gallon jug
(4, y-[4- Pour some water from the 3 gallon jug to fill
7. (x,y) If (x+y)<7
x]) the four gallon jug
(x-[3- Pour some water from the 4 gallon jug to fill
8. (x,y) If (x+y)<7
y],y) the 3 gallon jug.
Pour all water from 3 gallon jug to the 4
9. (x,y) If (x+y)<4 (x+y,0)
gallon jug
Pour all water from the 4 gallon jug to the 3
10. (x,y) if (x+y)<3 (0, x+y)
gallon jug

The listed production rules contain all the actions that


could be performed by the agent in transferring the
contents of jugs. But, to solve the water jug problem in a
minimum number of moves, following set of rules in the
given sequence should be performed:

Solution of water jug problem according to the


production rules:

S.No. 4 gallon jug contents 3 gallon jug contents Rule followed


1. 0 gallon 0 gallon Initial state
2. 0 gallon 3 gallons Rule no.2
3. 3 gallons 0 gallon Rule no. 9
4. 3 gallons 3 gallons Rule no. 2
5. 4 gallons 2 gallons Rule no. 7
6. 0 gallon 2 gallons Rule no. 5
7. 2 gallons 0 gallon Rule no. 9

On reaching the 7th attempt, we reach a state which is our


goal state. Therefore, at this state, our problem is solved.

Rule State Process

(4,Y)
1 (X,Y | X<4)
{Fill 4-gallon jug}

2 (X,Y |Y<3) (X,3)


Rule State Process

{Fill 3-gallon jug}

(0,Y)
3 (X,Y |X>0)
{Empty 4-gallon jug}

(X,0)
4 (X,Y | Y>0)
{Empty 3-gallon jug}

(4,Y-(4-X))
(X,Y |
5 X+Y>=4 ^ {Pour water from 3-gallon jug into
Y>0) 4-gallon jug until 4-gallon jug is
full}

(X-(3-Y),3)
(X,Y |
6 X+Y>=3 {Pour water from 4-gallon jug into
^X>0) 3-gallon jug until 3-gallon jug is
full}

(X+Y,0)
(X,Y | X+Y<=4
7 {Pour all water from 3-gallon jug into 4-gallon
^Y>0)
jug}

(0,X+Y)
(X,Y | X+Y <=3^
8 {Pour all water from 4-gallon jug into 3-gallon
X>0)
jug}
Rule State Process

(2,0)
9 (0,2) {Pour 2 gallon water from 3 gallon jug into 4
gallon jug}

Initialization:
Start State: (0,0)
Apply Rule 2:
Fill 3-gallon jug
Now the state is (x,3)
Iteration 1:
Current State: (x,3)
Apply Rule 7:
Pour all water from 3-gallon jug into 4-gallon jug
Now the state is (3,0)
Iteration 2:
Current State : (3,0)
Apply Rule 2:
Fill 3-gallon jug
Now the state is (3,3)
Iteration 3:
Current State:(3,3)
Apply Rule 5:
Pour water from 3-gallon jug into 4-gallon jug until 4-
gallon jug is full
Now the state is (4,2)
Iteration 4:
Current State : (4,2)
Apply Rule 3:
Empty 4-gallon jug
Now state is (0,2)
Iteration 5:
Current State : (0,2)
Apply Rule 9:
Pour 2 gallon water from 3 gallon jug into 4 gallon jug

Now the state is (2,0)-- Goal Achieved.


Water Jug Solution using DFS (Depth First Search)
Problem: (Tower of Hanoi)
Tower of hanoi is mathematical game puzzle where we
have three pile (pillars) and n numbers of disk.
This game has some rules (Rules of game)
Only one disk will move at a time.
The larger disk should always be on the bottom and the
smaller disk on top of it.(Even during intermediate move)
Move only the uppermost disk.
All disk move to destination pile from source pile.

So, here we are trying to solve that how many moves are
required to solve a problem (It depends on number of disk).

When we have two disk and 3 pillars (pile, A, B, C)


In the above diagram, following the rule of the game our target
is move the disks from source pile (pillar) to the destination
pillar. (let's take a look how many steps/ moves are required to
make this happen).
Step1: Move small disk to the auxiliary pillar (A).
Step2: Move large disk to the Destination pillar (B).
Step3: Move small disk to the Destination pillar(B).4
So, basically when we have 2 disks we required 3 move to reach
the destination .
What if we have 3 , 4, 5...n disks ?
Eventually, you figure out that there is some pattern to the
puzzle and with each increment in disks, the pattern could be
followed recursively.

Total move required to reach destination pillar is means


if we have 3 disks we required (4 moves to reach destination
pillar) , if 4 disks 8 moves required and so on ...
Note: Tower of hanoi problem is an example of recursion and
backtracking.
Recursion and backtracking: When a function calls itself, its
called Recursion. (Breaking problem into smaller problems).
Let's suppose we have a problem A we subdivided it into B, C,
and D. In Backtracking we attempt solving a sub-problem,
and if we don't reach the desired solution, then undo whatever
we did for solving that sub-problem, and try solving another
sub-problem (Until we get to the goal).
Note: There must be a termination condition in the recursion
problems.

missionaries and cannibals problem

The problem
In the missionaries and cannibals problem, three missionaries and three
cannibals must cross a river using a boat which can carry at most two
people, under the constraint that, for both banks
if there are missionaries present on the bank,
they cannot be outnumbered by cannibals (if they were, the cannibals
would eat the missionaries).
The boat cannot cross the river by itself with no people on board. And, in
some variations, one of the cannibals has only one arm and cannot row.
Missionaries and Cannibals
 Difficulty Level : Medium
 Last Updated : 07 Feb, 2018

Question: In this problem, three missionaries and three


cannibals must cross a river using a boat which can carry at
most two people, under the constraint that, for both banks, that
the missionaries present on the bank cannot be outnumbered by
cannibals. The boat cannot cross the river by itself with no
people on board.

Solution:
First let us consider that both the missionaries (M) and
cannibals(C) are on the same side of the river.
Left Right
Initially the positions are : 0M , 0C and 3M , 3C (B)

Now let’s send 2 Cannibals to left of bank : 0M , 2C (B) and


3M , 1C

Send one cannibal from left to right : 0M , 1C and 3M , 2C (B)

Now send the 2 remaining Cannibals to left : 0M , 3C (B) and


3M , 0C
Send 1 cannibal to the right : 0M , 2C and 3M , 1C (B)

Now send 2 missionaries to the left : 2M , 2C (B) and 1M . 1C

Send 1 missionary and 1 cannibal to right : 1M , 1C and 2M ,


2C (B)

Send 2 missionaries to left : 3M , 1C (B) and 0M , 2C


Send 1 cannibal to right : 3M , 0C and 0M , 3C (B)

Send 2 cannibals to left : 3M , 2C (B) and 0M , 1C

Send 1 cannibal to right : 3M , 1C and 0M , 2C (B)’

Send 2 cannibals to left : 3M , 3C (B) and 0M , 0C

• Here (B) shows the position of the boat after the action is
performed.
Therefore all the missionaries and cannibals have crossed the
river safely.

Solving
A system for solving the Missionaries and Cannibals problem
whereby the current state is represented by a simple vector ⟨m, c,
b⟩.
The vector's elements represent the number of missionaries,
cannibals, and whether the boat is on the wrong side, respectively.
Since the boat and all of the missionaries and cannibals start on
the wrong side, the vector is initialized to ⟨3,3,1⟩. Actions are
represented using vector subtraction/addition to manipulate the
state vector. For instance, if a lone cannibal crossed the river, the
vector ⟨0,1,1⟩ would be subtracted from the state to yield ⟨3,2,0⟩.
The state would reflect that there are still three missionaries and
two cannibals on the wrong side, and that the boat is now on the
opposite bank. To fully solve the problem, a simple tree is formed
with the initial state as the root. The five possible actions (⟨1,0,1⟩,
⟨2,0,1⟩, ⟨0,1,1⟩, ⟨0,2,1⟩, and ⟨1,1,1⟩) are then subtracted from the
initial state, with the result forming children nodes of the root. Any
node that has more cannibals than missionaries on either bank is
in an invalid state, and is therefore removed from further
consideration. The valid children nodes generated would be ⟨3,2,0⟩,
⟨3,1,0⟩, and ⟨2,2,0⟩. For each of these remaining nodes, children
nodes are generated by adding each of the possible action vectors.
The algorithm continues alternating subtraction and addition for
each level of the tree until a node is generated with the vector
⟨0,0,0⟩ as its value. This is the goal state, and the path from the
root of the tree to this node represents a sequence of actions that
solves the problem.
Travel Salesman
Problem
Algorithm
Travel Salesman Problem:
It is a classical problem in graph theory. It has no
closed, analytic and algorithmic solution. This problem
is soluble for a smaller number(n) of cities but it
breaks down as the number of cities grows.
If there are n-cities, the number of different paths
among them is (n-1)! The time to examine a single
path is proportional to n. So, the total time to search
is n!. If n is large then the time taken is also large.
This phenomenon is known as combinatorial explosion.

Problem Formulation: “It involves n-cities with paths


connecting the cities. A tour is any path which begins
with some starting city, visits each of the other cities
exactly once and returns to the starting city”.

Objectives of Travel Salesman Problem:


The Objectives of TSP is to find a minimal distance
tour. To explore all such tours requires an exponential
amount of time. As long as n is small, this approach
works but it breaks down quickly as several cities
grow. If there are N-cities then the number of
different paths among them is 1,2, …, (N-1) or (N-1)!
The time to examine a single path is proportional to N.
So, the total time required to perform this search is
proportional to N!, it requires O(N!) transverse
through the graph, an exponential number.

You might also like