Information Technology Reference
In-Depth Information
NewPop
Pop
:
Module
,
TRVIndex
MapIndexed
SelectOther
2
1
&, Population
;
TRV
Population
1
&
TRVIndex;
Noisy
F
1
1, 2
1
2, 2
1
3, 2
&
TRV;
Trial
Flatten
Table
If
Cr
Random
, Pop
i, 2, j
,
1
i, j
,
i, NP
,
j, Dim
&
Noisy
,1
;
BoundaryChecking
Flatten
MapIndexed
CheckInterval
1,
2
&,
1
,1
&
Trial
;
IndividualsCostValue
CostFunction
1
,
1
&
BoundaryChecking
;
NewPopulation
MapThread
If
1
1
2
1
,
1,
2
&,
Population,
IndividualsCostValue
Fig. 7.23.
Compiled DE crossover code
In[47]:=
np
NewPop
Population
;
MatrixForm
np
Out[48]//MatrixForm=
1.65327
5, 11.2
86.0232
297.175,
437.931
70.135
127.976, 99.3825
208.07
214.324, 244.138
41.6243
236.027,
128.204
161.461
335.943, 355.91
341.433
297.175,
150.458
216.653
499.82, 163.852
464.407
507.525, 502.251
62.8734
160.401,
149.99
Fig. 7.24.
Function call of New population
If all the preceding steps are joined together, then final DE code in Mathematica is
given in Fig 7.23.
When the function
NewPop
in Fig 7.23 is called with the variable
Population
like an
argument the new population is created as shown in Fig 7.24.
When the output of
NewPop
in Fig 7.24 is repeatedly used as an input in some loop
procedure (one loop
one generation), the
DE
algorithm is iterated.
Some additive procedures can also be used, like selection of the best individual from
the population. An example is given in Fig 7.25.
A more compressed (but less readable) and similar version of DE is shown in
Fig 7.26.
Canonical version of the DE described is a priori suitable for the real valued vari-
ables. However, due to the problems being solved here are based on integer
−
valued
variables and permutative problems, some additional subroutines have been added to
the DE code. The first one is a
Repair
subroutine. An input of this subroutine is an in-
fesible solution and the output is a repaired solution so that each variable only appears
once in the solution.The routine is shown in Fig 7.27.
−
Search WWH ::
Custom Search