Natural Algorithms

A new paradigm for algorithm development
A.
Joshua Jeyasooriyan* and R. Soodamani**
* josh@mailcity.com ** sooda@bharathi.ernet.in
Department of Computer Science & Engineering
Bharathiar University, Coimbatore 46, India
Abstract
In
this paper, we propose a new paradigm for algorithm development that gives a new dimension to the process of
building an algorithm. The algorithm developed using the new approach is here defined as a
Natural Algorithm
because it emulates natural physical
processes.
Whenever posed with a problem, say sorting numbers, a computer scientist racks his brain to develop an algorithm
such as
Bubble sort
to solve it with a computer. He unlike a mechanical engineer is not provided with a ready

made
design data bo
ok
to augment his
thought process
and make him stumble on an algorithm. The proposed paradigm
helps the computer scientist do the
thought process
that accompanies the task of developing an algorithm in a new
way.
In this paper, the concept of natural algo
rithms is defined and the technique is validated through illustrative
examples.
1 Notion of Natural Algorithms
Nature, a source of minerals and precious stones is a mine of algorithms too. In nature there are phenomena that
resemble
sorting
action, ph
enomena which closely resemble
division
operation and so on. By observing and
studying these phenomena computer algorithms can be extracted. For instance, a sorting action can be seen in the
system shown in Fig. 1
(a merry

go

round)
when the central spin
dle is rotated.
Fig. 1 Sorting action in a merry

go

round
Balls moving away from the spindle due to centrifugal force get
sorted
in the air according to their masses, the
smaller ones moving farther away from the spindle than the bigger ones.
The term
Natural Systems
in the present context will refer to systems that function by obeying simple and systematic
laws of nature. As soon as a natural system with a phenomenon resembling the problem to be solved is located, it is
simply emulated in the compute
r as a solution process. The following examples of natural algorithms make the
theory clear and concrete.
2 Natural Algorithm for Sorting
The system to be emulated consists of three cylindrical containers as shown in Fig. 2.1 together with objects
similar
to balls.
Fig 2.1 System for sorting
The number of cylinders is dictated by the largest number in the data set to be sorted. In Fig. 2.1, the markings
along the X

axis indicate cylinder number and that along the Y

axis different levels across th
e containers. Let the
data set to be sorted be A = {3,1,2}. A sorting action can be seen after carrying out the following steps.
1.
Drop three balls (unshaded ones) representing the first data in A, into the system, one per container starting
from left to
right (Fig. 2.2)
2.
Repeat step(1) with one ball (shaded one) representing the second data in A (Fig. 2.3)
3.
Repeat step(1) with two balls (dotted ones) representing the third data in A (Fig. 2.4)
Fig. 2.2
Fig. 2.3
Fig. 2.4
Sortin
g {3,1,2}
One can notice the balls arranging themselves in descending order by level, starting from level 1 to 3 of the
container (Fig.2.4). This sorting action can be noticed even when balls are dropped in a different order depending
on the order in wh
ich elements occur in the data set. Fig. 2.5 shows the system after dropping balls in the following
order : two balls (dotted ones) first, then three balls (unshaded ones) and finally one ball (shaded one) corresponding
to the set {2,3,1}.
Fig. 2.5
Fig. 2.6
Sorting {2,3,1} Sorting {1,1,3,2}
It is to be noted that the arrangement of balls, cylinder

wise (across the X

axis) too seems to represent the sorted set
as in Fig. 2.4 and Fig. 2.5. This will not be true fo
r all data sets. Fig. 2.6 showing the final state of the system after
sorting the data set {1,1,3,2} illustrates the above point. Only the level

wise arrangement of balls across the Y

axis
will always represent the final sorted data.
Thus any data set c
an be sorted in this fashion by choosing the number of cylinders based on the largest number in
the set. Note that the total number of balls dropped will be equal to the sum of elements in A. The system can be
emulated thereby deriving an algorithm for s
orting numbers. The algorithm thus derived[1] is given below.
2.1
Algorithm
Ball Sort
Array
Cylinder
[
CYL_MAX
] is used to keep track of the number of balls in each cylinder and
Level
[
LEV_MAX
] to
record the number of balls in each level (Fig. 2.7)
Fig. 2.7
Data structure showing a snap

shot of the process
CYL_MAX
specifies the largest element in the set that can be sorted and
LEV_MAX
the maximum number of
elements (cardinality of the set) that can be sorted. Let
A
be the data set to be sorted.
1.
{Initializ
e arrays
Cylinder
&
Level
}
For I = 1 to
CYL_MAX
Cylinder
[I] = 0
For J = 1 to
LEV_MAX
Level
[J] = 0
2.
For every element
x
in
A
repeat step(3)
3.
{Drop
x
balls}
For I = 1 to
x
{
Cylinder
[I]++;
Level
[
Cylinder
[I] ]++;
}
4.
Print
Level
array con
taining sorted data
5.
Exit
3 Natural Algorithm for Shortest Path
A natural algorithm for determining the shortest path between two vertices in a graph is detailed here.
Consider a system that consists of metal strips of different lengths joined together
in the form of a network as shown
in Fig. 3.1.
Fig. 3.1 Graph depicted with metal strips
The strips are assumed to be flexible. Now hold the source(B) and the destination(E) vertices and pull them apart
along the imaginary straight line joining them as
shown in Fig. 3.2.
Fig. 3.2 Source & Destination pulled apart
As they are pulled apart, the other nodes tend to move towards the imaginary straight line. What happens as you
keep on pulling is that the set of strips in the network that comprises the
shortest path forms a straight line between
the source and destination (Fig. 3.3).
Fig. 3.3 BCDE forms straight line between B(source) and E(Destination)
Even if there are more than one path with the same minimal distance, they together will form straig
ht lines
simultaneously. In the network shown in Fig. 3.1 BCDE is the shortest path between B and E.
The above argument is based on the intuitive suggestion that the straight line formed between the source and
destination vertices must be the shortest be
cause the shortest path between any two points is the straight line joining
them. The system and the pulling action described can be emulated using principles of
mechanics
[2].
The complexity of this new stretch algorithm does not depend much on the total
number of vertices but rather on the
physical arrangement of vertices; for instance, how close the set of vertices that are part of the shortest route lies to
the imaginary straight line determines the complexity to a great extent.
4 Natural Algorithm f
or Travelling Salesman Problem
The travelling salesman problem(TSP) is defined as follows :
A salesman must start from a specified city and visit each of n

1 other cities exactly once and then return to the
initial city through the shortest route possibl
e. More formally, the problem is to choose the shortest circuit
containing all vertices in a given graph. Fig. 4.1 shows a map of four cities A,B,C,D depicted using metal strips.
Fig. 4.1 Metal strips depicting map of four cities
A natural algorithm f
or solving TSP can be improvised using the natural algorithm for shortest path discussed
above. In Fig. 4.1, both the source and the destination are the same vertex and hence can not be pulled apart.
Therefore a set

up similar to the one shown in Fig. 4.
2 is used

the set

up shown in Fig. 4.1 is merged with a replica
of its own at a common point.
Fig. 4.2 The set

up used for solving TSP
Here the initial city is found at two places (A & A') and can be pulled apart. Paths with repeated edges due to th
e
replication and paths that do not contain all vertices are unacceptable. In Fig. 4.2 ABCD'A’ and ADCB'A' are the
only acceptable shortest routes.
5 Essence of Natural Algorithms
Based on the above case studies, a natural algorithm can now be defined
as a ready

made solution embedded in a
natural system which one has to simply discover. Like a mathematical transform, the new approach transforms the
problem in the abstract domain to another in the
natural
domain which is tackled in a
natural
way with e
ase. Like
any other paradigm natural algorithms is not a panacea. The merits of this approach are that it is
A new way of looking at the algorithm development process.
A
natural
solution to the problem, hence very understandable.
6 Search for Natural A
lgorithms
It is possible to identify or observe natural phenomena from which algorithms can be derived, by accident or
through a random search. At the same time, it is difficult to propose a formal procedure ( a set of well

defined
steps) to search for a
natural system that
solves
the problem at hand. Nevertheless, the following suggestions given
in the form of an algorithm will be useful in hunting for a suitable natural system.
1.
Try to associate the data items that are central to the problem with entit
ies in nature. Let their attributes (mass,
length, volume etc.) represent the magnitude of the data items.
2.
Any algorithm transforms the input data which is in a particular state into another form which is the output data.
Therefore, keeping the entities
in mind, try imagining a particular state of the system that depicts the input data
and another state that depicts the output.
3.
Now try to conceive a set of activities that can change the system state from the input state to the output state.
The above st
eps augmented with a little intuition should help the problem solver to zero

in onto a suitable natural
system.
7 Analysis of
Ball Sort

Natural Algorithm for Sorting
In this section, the performance of the
Ball Sort
algorithm discussed in Section 2 i
s analysed and compared with that
of common sorting algorithms like
Bubble Sort
and
Quick Sort
. The time complexity of Ball Sort is a function of
both number of data to be sorted and average size of data. The time complexity T is derived considering
incr
ement
as the key operation. Let A = {d
1
,d
2
,d
3
…d
n
} be the data set to be sorted, n its cardinality and s the average size of
data.
T(n,s) = 2d
1
+ 2d
2
+ 2d
3
+ … + 2d
n
= 2(d
1
+ d
2
+ d
3
+ … + d
n
)
= 2 * ((d
1
+d
2
+d
3
+…d
n
)/n) * n
= 2.s.n
=
O
(s.n.)
The factor 2 corresponds to incrementing
Cylinder
and
Level
arrays every time a ball gets dropped, and note that
d
balls are dropped corresponding to every element
d
in
A
. The execution time in seconds for the three sorting
techniques experimentally determined by varying the number of data to be sorted and the average size of data is
tabulated below.
n
–
Cardinality of data set to be sorted
T1

Bubble Sort
T2

Quick Sort
T3

Ball Sort
Average Size of Data 0

50
n
100
0 3000 5000 7000 9000 10000
T1
2.58 22.47 62.14 121.7 201.15 248.62
T2
0.05 0.38 1.04 1.75 2.74 3.02
T3
0.16 0.38 0.60 0.82 1.09 1.20
Average Size of Data 100

500
n
1000 3000 5
000 7000 9000 10000
T1
2.52 21.97 61.20 120.2 197.25 244.17
T2
0.10 0.27 0.43 0.65 0.93 1.04
T3
1.31 3.90 6.59 9.06 11.75 13.02
Average Size of Data 500

5000
n
1000 3000 5000 7000
9000 10000
T1
2.52 22.14 60.82 119.6 197.8 244.83
T2
0.05 0.21 0.43 0.60 0.82 0.93
T3
13.35 38.4 62.96 89.61 115.49 127.47
Fig. 5(a) Performance over small range of data
Fig. 5(b) Performance over me
dium range data
Fig. 5(c) Performance over large range data
Fig. 5(a) reveals that Ball Sort is the fastest among the three techniques for a small range of data. Fig. 5(b) shows
that for a medium range of data the performance of Ball Sort is
in

between that of the other two and Fig. 5(c)
indicates that it is close to Bubble Sort for a larger range of data.
8 Possible Areas of Enquiry
Research on Natural Algorithms can be pursued in the following possible directions :
Discovering n
atural algorithms for newer problems
Natural algorithms for problems such as sorting and determining the shortest path in a graph have been discussed.
Natural algorithms for various other fundamental problems can be discovered.
Developing a systematic
Natural Algorithms Search Procedure
Though the natural algorithms presented in this paper are outcomes of imagination and intuition, a formal systematic
procedure should be evolved to enable problem

solvers to associate a given problem with a natural syst
em
effortlessly.
Tackling the Travelling Salesman Problem in polynomial time
The travelling salesman problem is one that has drawn the attention of researchers world

wide and has till now
remained unsolved by conventional computing techniques in polynom
ial time. The possibility of developing a
polynomial time natural algorithm for the problem is speculated.
9 Future Research
The ultimate product that should evolve over a period of time from these theoretical foundations is an environment
that would
facilitate practical software development using the new approach. The environment can be provided
with a set of icons depicting natural system components along with certain predefined operations on them. The
problem solver could use them as if they were
a
mechano
set and
create
on the screen a natural phenomenon that
solves
the problem. An intelligent software running in the background can map each of his manipulations on the
screen to a single step or a sequence of steps in an algorithm.
References
[1
] A. Joshua Jeyasooriyan, “Ball Sort
–
a natural algorithm for sorting”, Sysreader, pp. 13

16, May 1995
[2] Irving Shames, Engineering mechanics, Prentice Hall of India, 1998
[3] A. Joshua Jeyasooriyan, “Natural Algorithms
–
a new paradigm for algorithm
development”, M.E. thesis,
Bharathiar University, 1996
[4] Ellis Horowitz, Sartaj Sahni, Fundamentals of Computer Algorithms, New Delhi, Galgotia Publications, 1996
[5] Jean

Paul Tremblay, Paul Sorenson, An introduction to data structures with applicatio
ns, New Delhi, Tata Mc
Graw Hill Publishing Company, 1991
B
a
l
l
Enter the password to open this PDF file:
File name:

File size:

Title:

Author:

Subject:

Keywords:

Creation Date:

Modification Date:

Creator:

PDF Producer:

PDF Version:

Page Count:

Preparing document for printing…
0%
Σχόλια 0
Συνδεθείτε για να κοινοποιήσετε σχόλιο