Information Technology Reference
In-Depth Information
The second phase is to map all the values in the solution. The routine:
Pos = Position[Solution
,
#]&
/
@Range[Size];mapsthe
occurrence
of each value in the
solution.
The
repetitive
values are identified in the function:
Flatten[Position[Flatten[Dimensions
/
@
(Temp = Flatten[Pos[[#]]]&
/
@
Range[Size])]
,
?(1
<
#&)]]
The routine: Join[Temp[[#]]]&
/
@(#1[[#&
/
@Range[Length[#1]]]])& calculates the
positions of the
replicated
values in the solution.
These replicated positions are
randomly shuffled
, since the objective is not to create
any bias to replacement. This routine is given in the function:
MapIndexed[RandomRelist[#1]&
,
#]&
The variable
Po s
isolates the positions of replicated values which will be replaced as
given in:
Pos = Sort[Flatten[MapIndexed[Drop[#1
,
1]&
,
#1]&
The routine: Drop[Solution
,
{
#
}
]&
/
@ removes the replicated values from the
solution.
The final routine:
MapThread[(Solution = Insert[Solution
,
#1
,
#2])&
,
]; inserts the
missing values from the array
Missing Value
into randomly allocated indexs identified
by variable
Po s
.
DE is consequently modified so that before the function
CostFunction
a
Repair
/
@
DSH
function is used as in Fig 7.28.
{
MissingValue
,
Pos
}
DERand1Bin
Pop
:
MapThread
If
1
1
2
1
,
1,
2
&,
Pop,
CostFunction
1, Prob, Mach
,
1
&
Repair
DSH
Flatten
MapIndexed
CheckInterval
1,
2
&,
1
,1
&
Flatten
Table
If
Cr
Random
, Pop
i, 2, j
,
1
i, j
,
i, NP
,
j, Dim
&
F
1
1, 2
1
2, 2
1
3, 2
&
Pop
1
&
MapIndexed
SelectOtherRand1Bin
2
1
&, Pop
,1
Fig. 7.28.
Repair DSH routine
In[86]:=
DS
M1, M2, M3, M4, M5, M6, M7, M8, M9, M10
M1, M2, M3, M4, M5, M6, M7, M8, M9, M10
Out[86]=
Fig. 7.29.
Discrete Set
In[87]:=
DSH
Pop
:
Module
,
RoundPop
Round
Pop
;
DS
1
&
1&
RoundPop
Fig. 7.30.
Discrete Set
Search WWH ::
Custom Search