Information Technology Reference
In-Depth Information
In[26]:=
Table
Random
Integer,
1, NP
,
i, 3
3, 6, 8
Out[26]=
Fig. 7.12.
Random values
SelectOther
active
:
Module
,
rand
0, 0, 0
;
While
rand
1
rand
2
rand
1
rand
3
rand
2
rand
3
active
rand
1
active
rand
2
active
rand
3
, rand
Table
Random
Integer,
1, NP
,
i, 3
;
Return
rand
Fig. 7.13.
SelectOther function
SelectOther
active
:
Module
rand
0, 0, 0, 0, 0
, allvals
,
While
allvals
Append
rand, active
;
Length
allvals
Length
Union
allvals
,
rand
Table
Random
Integer,
1, NP
,
i, 5
;
Return
rand
Fig. 7.14.
SelectOther compressed function
In[29]:=
SelectOther
1
2, 8, 3
Out[29]=
Fig. 7.15.
Three random indexes
This command returns the initial population of individuals with the structure Cost-
Value,parameter1,parameter2,..,parameterNP.
NP
is a size of the population.
Canonical version of the DE is based on the selection of the three (or more based on
DE version) randomly chosen individuals from the population. Random selection, or
more precisely, random selection of three pointers, can be done by command
Table
in
Fig 7.12.
The random values selects pointers to three individuals of
NP
. To avoid the possibil-
ity that two or more will be the same,
SelectOther
function is used. Its argument
active
is a pointer to the actively selected individual
−
parent.
SelectOther
function is shown
in Fig 7.13.
SelectOther function can also be given in a compressed form as in Fig 7.14.
Counters
are used for selection of three different individuals
from NP individuals. Fig 7.15 shows three individuals selected from the first solution
(parent). Note that all these individuals differ from the first one (position 3).
Till this point, the initial population has been initialized and three individuals have
been randomly selected from the population. In the following step, the function
Se-
lectOther
is applied to the entire population at once. Mathematica language allows
parallel
{
1
,
2
,..,
NP
}
and
{
i
,
3
}
like
programming, which is visible throughout of the code. This is also the
case of the following command of function
MapIndexed
whichisusedtoapply
Selec-
tOther
on all individuals, so that the
virtual
population of pointers (randomly selected
−
Search WWH ::
Custom Search