A Journal of Software Engineering and Applications, 2012, 5, 66-71
doi:10.4236/jsea.2012.512b014 Published Online December 2012 (http://www.scir p.org/journal/jsea)
Copyright © 2012 SciRes. JSEA
Magnetotactic Bacteria Algor ithm for Function
Optimization
Hongwei Mo1, Lifang Xu2
1Automation College, Harbin Engineering University, Harbi n, China; 2Engineering Training Center, Harbin Engineering University,
Harbin, China
Email: honwei2004@126.com
ABSTRACT
Magnetotactic bacteria is a kind o f polyphyletic group of prokaryotes with the characteristics of magnetotaxis that ma ke
them orient and swim along geomagnetic field lines. A magnetota c tic b acteria op timizatio n algorith m(M BOA) inspired
by the characteristics of magnetotactic bacteria is researched in the paper. Experiment results show that the MBOA is
effective in function optimization problems and has good and competitive performance compared with the other clas-
sical opti mization algorithms.
Keywords: Magnetotactic bacteria op timization algorithm; Function op timization; Nature inspired computing
1. Introduction
Learning from life system, people have developed many
nature inspired computing(NIC) methods to solve com-
plicated optimization computation problems in recent
decades. There has been a considerable attention paid for
employing algorithms inspired from natural processes
and/or events in order to solve optimization problems.
For example, genetic algorithms(GAs) which was first
introduced by Holland are now a standard optimization
tool in engineering. Since 1980s, more and more NIC
algorithms were developed following GAs, including
Ant Colony Optimization(ACO)[1] and Particle Swarm
Optimizatio n(PSO)[2], Immune Algorithm(IA)[3], Ar-
tificial Bee Colony(ABC) [4], Bacterial Chemotaxis Al-
gorithm[5], Biogeography based Optimization[6] and so
on.
Since many studies were carried out with inspirations
from ecological phenomena for developing optimization
techniques, we still pay attention to find new inspiration
source. ‘No free lunch theoremhad told us that there is
no universal algorithm which can be better over all
possible problems. So it is necessary for us to develop
new algorithms for problem solving. Tayarani proposed
a magnetic opti mization algorithm whic h is base d on the
principle of particlesinteraction in magnetic optimiza-
tion [7]. In nature, there is a kind of polyphyletic group
of prokaryotes that can orient and swim along magnetic
field li nes. The y are called magnetota ctic b ac teria ( MT B s)
[8]. A striking property of MTBs is their ability to orient
and propel themselves along geomagnetic field lines
(magnetotaxis) in the earth magnetic field. Propelled by
their flagella, the bacteria migrate in a net downward
direction, following the declination of the field lines of
the earth, toward oxygen-poor regions with advantages
for survival.
In[9], we have proposed a new algorithm called mag-
netotactic bacteria optimization algorithm (MBOA) in-
spired by the distinct behavior of MTBs. It had been
tested on so me standard benchmarks and compared with
some op timization algorithms, and it shows good per-
formance in solving some optimization problems of
stand ard func tio ns. I n this paper, MBOA is researched in
further.
The remainder of this paper is organized as follows:
Section 2 describes the basic procedure of MBOA. In
Section 3, experiments on 14 standard functions optimi-
zation and analysis are provided. Finally, the co nclusions
are drawn in Section 4 .
2. MBOA
2.1. Principles of MBOA
MTBs occur widely in natural sediments from both ma-
rine and freshwater habitats. They produce intracellular,
membrane-bounded magnetite particles and synthesize a
kind o f magnetite co lloids with enveloping membrane. It
is called magnetosomes, which are typically arranged in
the form of one or several cha ins and impart a permanent
magnetic dipo le moment to the bacterium[10].
Magnetotactic Bacteria Optimization Algorithm
Copyright © 2012 SciRes. JSEA
67
In magne to tac tic b acteria, magnetosomes play impo r-
tant role in regulating the movement of MTBs. The
magnetic field lines bend in some of the magnetosomes
to minimize their magnetostatic energy[11], whereas in
others their direction differs slightly from that of the
chain axis. In fact, the MTBs have evolved to be adap-
tive to the magnetic field. Based on the biology know-
ledge, we k n ow t h a t one kind of MT B s has multiple ce lls
with chains of magnetosome s. Only those MTBs with
magnetosomes in their cells which can make magnetic
field lines bend in some of the magnetosomes to minim-
ize their magnetostatic energy can survive in nature.
Each magn et o some can pro duce momen t[11]. The MTBs
with multi-cell need to produce mag n et os ome moments
with whic h can minimize thei r magnetostatic energy. We
can consider such a pro cess as an op timization one.
When the MBA runs to solve a problem, it corres-
ponds to the process of producing magnetosomes to be
adaptive to magnetic field. It needs to regulate the mo-
ments of each ma gnetosome, just like producing feasible
solutions. MBOA obtains the optimal solution by regu-
lating the mo ments of cells conti nually.
Consider a problem solving inspired by MTBs, the
minimal magnetostatic energy is looked as optimal solu-
tion. The multiple cells are looked as feasible solutions.
The magnetosomes in each cell can be looked as the fea-
tures of a candidate solution. The moment of a magneto-
some corresponds to feature value.
2.2. Procedures of MBOA
Considering a chain of magnetosomes as a cylinder of
infinite length in a magnetic field B, its energy
a
E
of
the bacterial, moment can be estimated as follows.
θ
cosMBBMEm−=⋅−= (1)
where
θ
is the angle between M and B.
According to[9], the interaction energy between two
dipoles from different magnetosome chains in a MTB
with multi cell s is:
3
,
1
++
=mDnD
D
E
mn
(2)
where
...2,1,0, =mn
are the number of magnetosomes
of two cells,
d
is the distance between neighbor centers
in a chain.
Suppose that the interaction energy between two cells
in a MTB a s follows:
mnmn EEE ,
)(
2
1=+
(3)
where
are the energy of two cells, respectively.
If two cells have the same number of magnetosomes,
that is
mn =
, and suppose
mn EE =
, then we ha ve
mnmn
EE
,,
=
(4)
The total procedure of MBOA is described as follows:
1: Generate initial cells population
n
C
and set con-
stant
a,,
ρλ
.
2: While (
ionMaxGeneratt<
)
3: calculate cost of each cell
4: normalize cost to calculate magnetic field
B
5: for
ni :1=
6: for
nj :1=
7: If
ji
8: calculate the distance
D
9: If
D
r>
10: calculate interaction energy
E
of two cells
11: else
12:
RprandE*),1(=
13: end
14: end
15: for
ni :1=
16: calculate moment
M
of each cell
17 regulate the moment o f each cell by
M
18: end
19: calculate the cost
J
of each cell, rank the cells, re-
place some proportional cells by randomly produced
moments.
20: rank the c ells and find t he op timal solution
21: end while
The procedure of MBA is described as follows in de-
tail:
Step 1: All of the moments of magn et osomes in cell
population (for t=0) are initialized randomly between
upper and lower limit of feature value.
In step 4: The
i
th magnetic field value
i
f
is no rmalized
as follows:
)min()max(
)min(
ii
ii
i
ff
ff
f
=
(5)
ni ...,2,1=
,
n
is the size of population.
The magnetic field of a cell is defined as [9].
Magnetotactic Bacteria Optimization Algorithm
Copyright © 2012 SciRes. JSEA
68
ρλ
+=
ii
fB
(6)
where
λ
and
ρ
are constant.
In step 8: we define the distance b etween two cells as:
=
=
n
ji ji
dD
1, ,
/U (7)
Suppose that
],[, ,, ULxx kjki −∈
are the
k
th
feature value (moment) of
ji
xx  ,
, respectively.
n
is the
population size.
L
and
U
are the lower limit and
upper limit of feature value. Then
D
can be defined as
the following function.
=
=
p
k
kjki
ji
U
xx
p
xxD
1
,,
1
),( 
(8)
In step 9,
pUar *)2/(∗=
, where
a
is a distance
threshol d cons tant.
In step 10, suppose that
),...,,(
21 pi
mmmM =
,
ni ,...,1=
is the
i
th moment of magnetosome of a
cell. Assume the interaction energy
E
between two
cells as Equation (9).
3
,
21
+
=mD
D
E
ji
(9)
According to Equation (1), and for simplification,
suppose
θ
cos
=1, then we get
i
ji
i
B
E
M
,
=
(10)
So we have the ways of regulating moments of mag-
netoso mes in a cell (individual) as follo ws:
t
i
t
i
t
i
Mxx+=
1
(11)
where
are the
i
th moment of the
i
th indi-
vidual(cell) in
t
generation.
t
i
M
is the moment of
correspond ing individual in
t
generation.
In step 19: after the r egulation, the solutions are sor ted
according to their costs in ascending. The last half of
cells is replaced by the following way:
Rmrandmrandxi/)),1()1),1((( ∗−∗=
λ
(12)
In general, the generation number is set as the stop-
ping conditio n. At last, find t he o ptimal result and o utput
the result.
3. Experiment Results and Analysis
3.1. Problem Definition
Global numerical optimization problems are frequently
arisen in almost every field of engineering design, ap-
plied sciences, molecular biology and other scientific
applicatio ns. Without loss of generality, the global mi-
nimization problem can be formalized as a pair
),( fS
,
where
D
RS
is a bounded set on D
R
and
RSf :
is a D-dimensional real value function.
The problem is to find a point
SX
*
such that
)( *
Xf is the global minimum on S. More specifically,
it is required to find an
SX
*
such that
)()(: *XfXfSX ≤∈∀
(13)
where f does not need to be continuous but it must be
bounded.
3.2. Parameter Settings
In all experiments in this section, all algorithms are the
basic ones without any improvement. The values of the
common parameters used in each algorithm such as pop-
ulation size and total evaluation number were chosen to
be the same. Population size was 50 and the maximum
evaluation number was 500 for all functions. The other
specific parameters of algorithms are given below[12]:
GA Settings: Single point crossover operation with the
rate of 0.8 was employed. Mutation rate was 0.01. Sto-
chastic uniform sampling technique was our selection
method.
DE Settings: F is a real constant which affects t he dif-
ferential variatio n b et ween two so lutions and set to 0. 5 in
our experiments. Value of crossover rate was chosen to
be 0.9.
PSO Settings: Cognitive and social components are
constants that can be used to change the weighting be-
tween personal and population experience, respectively.
In our experiments cognitive and social components
were both set to 1.8. Inertia weight, which determines
how the previous velocity of the particle influences the
velocity in the next iteratio n, wa s 0.6.
Magnetotactic Bacteria Optimization Algorithm
Copyright © 2012 SciRes. JSEA
69
MBOA: For MB OA, we only need to set
λ
and
ρ
to decide magnetic field. In our experiments ,
5.0=
λ
,
0001.0=
ρ
.
3.3. Experiment Results
In order to characterize the type of problems for which
the algorithm is suitable and test the performance of
MBOA, we used 14 benchmark problems in order to
comparison the performance of these algorithms. This set
is large enough to include many different kinds of prob-
lems such as unimodal( U), multimodal(M), regular, ir-
regular, separable(S), non-sep arable(N) and multidimen-
sional. Initial range, formulation, the dimensions(D),
parameters setting and characteristics(C) of these prob-
lems are listed in Table 1. T he minimal values of Easom
and Dropwave are -1. The mini mal value of all the other
functions is 0. The formulations of benchmark functions
are s hown in Table 2.
The compared results of the MAB with GA, PSO, DE
on a large set of functions are listed in Table 3 and Ta-
ble 4. Each of the experiments in this section was re-
peated 30 times with different random seeds and the
mean best values produced by the algorithms have been
recorded. In order to make comparison clear, the values
below
12
10
are assumed to be 0.
Table 1. Characteri s t ic of benc hmark functions
No. Function Range D C
1 Step [-100, 100] 30 US
2 Sphere [-100, 100] 30 US
3 SumSquares [-10, 10] 30 US
4 Qua rtic [-1.28, 1. 28] 30 US
5 Easom [-100, 100] 2 UN
6 Schwefel1.2 [-100, 100] 30 UN
7 Zakharov [-5, 10] 10 UN
8 P o we l l [-4, 5] 24 UN
9 Rotatedhyper [-65.536,65.536] 30 UN
10 Rastrigin [-5.12, 5, 12] 30 MS
11 Branin
[ 5,10][0,15]−×
2 MS
12 Dropwave [-5.1 2,5.1 2 1] 2 MS
13 Schaffer [-100, 100] 2 MN
14 Gri e wan k [-600, 600] 30 MN
Table 2. Be nc hmar k fun ction formulatio ns
No. Formulations
1
( )
2
1
( )0.5
n
i
i
fx x
=
= +


2
2
1
()
n
i
i
fx x
=
=
3
2
1
() n
i
i
f xix
=
=
4
4
1
( )[0,1)
n
i
i
f xixrandom
=
= +
5
22
12 12
()cos()cos()exp(()() )fxx xxx
ππ
=−−−− −
6
2
11
() ()
ni
j
ij
fx x
= =
=
∑∑
7
224
11 1
()(0.5 )(0.5 )
nn n
ii i
ii i
f xxixix
= ==
=++
∑∑ ∑
8
/22 4
434241442 41
1
4
43 4
( )(10)5()()
10( )
nk
iiiii i
i
ii
fxxxx xxx
xx
− −−−−
=
=++−+ −
+−
9
∑ ∑
= =
=
n
i
i
jj
xxf
1
2
1
)(
10
2
1
( )[10cos(2)10
n
ii
i
fx xx
π
=
=−+
11
22
2 111
2
5.1 51
( )(6)10(1)cos10
48
fx xxxx
ππ π
=−+−+ −+
12
2)(2/1
)12cos(1
),(
2
2
2
1
2
2
2
21
++
++
−= xx
xx
xxf
13
2 22
12
2 22
12
sin ()0.5
( )0.5(1 0.001())
xx
fx xx
+−
=+ ++
14
2
11
1
( )cos1
4000
n
ni
i
ii
x
fx xi
==

=−+


Because of space limit, we separate expe riment r esults
to t wo sets a s sho wn i n Table 3 and Table 4, resp ective-
ly. Statistical results of 30 runs obtained by GA, DE
MBOA are shown in Table 3 and those of PSO and
MBOA are sho wn in Table 4, where Mean: Mean of the
Best Values, Std: Standard Deviation o f the Be st Values.
Table 3. Comparison results of GA, DE and MBOA
No.
GA
DE
MBOA
1 Mean 78.2333 0 0
41.1563
0
0
2
91.1986
0
0
36.4409
0
0
3 Mean 0.4881 0 0
1.1443
0
0
4
0.2670
0.006891
2.7511e-05
0.2237
0.00148
3.8863e-05
5
-0.6413
-1
-0.9966
Std 0.4614 0 0.0037
6
2.4527e+04
18324.1
0
6.4361e+03
3022.165
0
7
0.2301
0
0
0.6375
0
0
8 Mean 2.5631 0.059135 0
1.6810
0.02199
0
9
395.4911
1.9523e-09
0
182.5482
2.3682e-09
0
10
0
98.21781
1.3281e-10
Std 0 7.976648 1.5040e-11
11
0.4075
0.3979
0.3984
Magnetotactic Bacteria Optimization Algorithm
Copyright © 2012 SciRes. JSEA
70
0.0127
0
4.9229e-04
12
-0.9793
-1
-1
Std 0.0561 0 0
13
0.0010
0
0
Std 0.0031 0 0
14
0.7959
0
0
0.4205
0
0
As seen fro m Tables 3 and Tables 4, there are 8 func-
tions with 30 varia bles. MBOA outperforms all the other
algorithms on 4( Quartic, Powell, Rotatedhyper, Rastrigin)
and has the same performance on 1(Matyas) with GA,
DE, PSO. It has the same performance on 5 (Step,
Sphere, Sumsquares, Schaffer, Griewank) with DE, PSO,
GA has the worst performance on these functions. It is
better than GA on Step, Sphere, Schaffer, Griewank,
Eas om, Sc hwefel1.2, but is worse than PSO, DE on Ea-
som, Branin. It is bette r than GA, PSO o n Zakhavo v. And
it has the same performance as DE on Dropwave. It is
better than DE, PSO on Rastrigi n and worse than GA. It
is better tha n GA but worse than PSO , DE on Br anin. In
total, it is better than PSO on 6, GA on 12, DE on 5 of
these 14 functions. So, MBOA has better performance
than GA o n t he se f unctions and is co mpetitive with P SO,
DE o n these functions.
Table 4. Comparison results of PSO and MBOA
No. PSO MBOA
1 Mean 0 0
Std
0
0
2
Mean
0
0
Std 0 0
3
Mean
0
0
Std
0
0
4
Mean
0.00115659
2.7511e-05
Std
0.000276
3.8863e-05
5 Mean -1 -0.9966
Std
0
0.0037
7
Mean
0
0
Std
0
0
8
Mean
91.8336
0
Std
50.8704
0
9
Mean
403.7601
0
Std
886.0659
0
10
Mean
2.3695e+06
0
Std
8.6174e+06
0
11 Mean 43.9771369 1.3281e-10
Std
11.728676
1.5040e-11
12
Mean
0.3978
0.3984
Std
0
4.9229e-04
13
Mean
-0.8473
-1
Std 0.1643 0
14
Mean
0
0
Std
0
0
050 100 150 200 250 300 350400450 500
0
0.5
1
1.5
2
2.5
3x 10
5
Generation
Cos t
Sphere
GA
DE
PSO
MBOA
(a)
050100 150 200250 300 350400450500
-1
-0. 9
-0. 8
-0. 7
-0. 6
-0. 5
-0. 4
-0. 3
-0. 2
-0. 1
0
Generation
Cos t
Easom
GA
DE
PSO
MBOA
(b)
050100 150 200 250 300350 400 450 500
0
100
200
300
400
500
600
700
Generation
Cos t
Rastrigi n
GA
DE
PSO
MBOA
(c)
050 100 150 200250300350 400 450 500
0
500
1000
1500
2000
2500
3000
Generation
Cos t
Griewank
GA
DE
PSO
MBOA
(d)
Figure 1. Compar iso n on convergence of the four algorithms.
In Figure 1, the performance of convergence of the
four algorithms on four functions is shown as examples.
Magnetotactic Bacteria Optimization Algorithm
Copyright © 2012 SciRes. JSEA
71
The four functions have difference characteristics as
shown in Table1. We can see that MBOA converges
much faster tha n PSO, DE and GA.
4. Conclusions
In this paper, a new nature inspired computing method-
Magnetotactic Bacteria Optimization Algorithm is re-
searched. It adopts the principles of energy and moment
of magnetosomes in magnetotactic bacteria to produce
optimal solution for engineering problems. It has simple
procedure and is easy to implement. The experimental
results show that it is effective in solving optimization
problems and is competitive with the compared classical
algorithms PSO and DE. And it converges faster than
PSO, DE and GA. It shows competitive performance
with some cla ssic al a l gor ith ms, suc h as G A, DE, PSO. In
future, it needs to be analyzed in theory and improved its
performance for solving more complex problems.
5. Acknowledgemen t s
This work is supported by the National Natural Science
Foundation of China under Grant No.61075113, the Ex-
cellent Youth Foundation of Heilongjiang Province of
ChinaNo.JC201212 and the Fundamental Research
Funds for the Central U niversities No.HEUCFZ12 09.
REFERENCES
[1] L. N. De Castro, F. J. Von Zuben. “Learning and Opti-
mization Using the Clonal Selection Principle,” IEEE
Trans. on Evolutionary Computation, Vol.6,No.3,
pp.239251, 2002. doi: 10.1109/TEVC.2002.1011539
[2] M. Dorigo, V. Manianiezzo, A. Colorni. “The Ant Sys-
tem: Optimization by a Colony of Cooperating Agents,”
IEEE Trans.Sys. Man and Cybernetics, Vol.26, No.1,pp.
1-13.
doi:10.1109/3477.484436
[3] R. E. Dunin-Borkowski, M. R. McCartney, R. B. Frankel,
D. A. Bazylinski, M. Posfai , P. R Buseck. “Magnetic Mi-
crostructure of Magnetotactic Bacteria by Electron Holo-
graphy,” Science, Vol. 282, 1998,
pp.1868-1870. doi:10.1126/science.282.5395.1868
[4] D. Karab oga, B. Akay. “A Comparative Study of Artifi-
cial Bee Colony Algorithm,” Applied Mathematics and
Computation, Vol 214, No.1,2009, pp.108–132.
doi: 10.1016/j.amc.2009.03.090
[5] J. Kennedy, R. Eberhart. Particle swarm optimization.
IEEE Int Conf on Neural Networks. Piscataway, NJ,
1995,pp.1942-1948. doi:10.1109/ICNN.1995.488968
[6] S. Müeller, J. Marchetto, S. Airaghi, P. Koumoutsakos.
“Optimization Based on Bacterial Chemotaxis,” IEEE
Trans on Evolutionary Computation, Vol.6, No.1 , 2002,
pp.16-29.
doi:10.1109/4235.985689
[7] A. P. Philipse, D. Maas. “Magnetic Colloids from Mag-
netotactic Bacteria: Chain Formation and Colloidal Sta-
bility,” Langmuir, Vol.18, 2002,pp.9977-9984.
doi:10.1021/la0205811
[8] D. Simon. “Biogeography-based Optimization,” IEEE
Trans on Evolutionary Computation, Vol. 12, 2008,
pp.702-713.doi:10.1109/TEVC.2008.919004
[9] Mo Hongwei,Research on Magnetotactic Bacteria Op-
timization Algorithm,The Fifth International Confe-
rence on Advanced Computational Intelli-
gence,Nanjing,Oct,2012,pp.417-422.
[10] M. H. N. Tayarani, T. Akbarzadeh. “Magnetic Op timiza-
tion Algorithms A New Synthesis,” in Proc. of IEEE
Congress on Evolutionary Computation. Hong Kong,
China, 1-6,June,2008,pp. 2659-2665.
doi:10.1109/CEC.2008.4631155
[11] M. Winklhofer, L. G. Abraçado, A. F. Davila, C. N.
Keim, H. G. Lins de Barros. P. “Magnetic Optimization
in A Multicellular Magnetotactic Organism,” Biophysical
Journal, Vol 92, 2007,pp. 661-670.
doi:10.1529/biophysj.106.093823
[12] V. Tereshko. “Reactiondiffusion Model of A Honeybee
Colony’s Foraging Behaviour,” in Parallel Problem
Solving from Nature VI, Lecture Notes in Computer
Science, Vol. 1917, SpringerVerlag, Berlin, 2000,pp.
807–816. doi:10.1007/3-540-45356-3_79