سورس کد هشت وزیر با fitness sharing
سلام دوستان خسته نباشید
من دونبال سورس هشت وزیر هستم که به جای یک جواب چند جواب بهینه بهمون بده یعنی فیتنس همه انها صفر باشه
باید قسمت فیتنس توسط
9.4.1 Fitness Sharing
This scheme is based upon the idea that the number of individuals within a
given niche is controlled by "sharing" their fitness immediately prior to selection.
In practice the scheme works by considering each possible pairing of
individuals i and j within the population (including i with itself) and calculating
a distance d(i,j) between them according to some distance metric
(phenotypic is preferred if possible, else genotypic, e.g., Hamming distance for
binary representations). The fitness F of each individual i is then adjusted according
to the number of individuals falling within some prespecified distance
(J"share using a power-law distribution:
I . F( i)
F (z) = Lj sh(d(i,j)) '
where the sharing function sh(d) is a function of the distance d given by
sh(d) = { 1 - (d/~share)a if d :::; (J"share,
otherwise.
As can be seen the constant value 0: determines the shape of the sharing
function: for 0:=1 the function is linear, but for values greater than this the
effect of similar individuals in reducing a solution's fitness falls off more rapidly
with distance.
The other parameter that needs to be set, and the one that decides both
how many niches can be maintained and the granularity with which different
niches can be discriminated, is the share radius (J"share. Deb [108] gives some
suggestions for how this might be set if the number of niches is known in
advance, but clearly this is not always the case. In [106] he suggests that a
default value in the range 5-10 should be used.
Finally, we should point out that the use of fitness proportionate selection is
implicit within the fitness-sharing method. Studies have indicated that the use
of alternative selection methods does not lead to the formation and preservation
of stable subpopulations in niches [294]. However, if fitness proportionate
selection is used, then there exists a stable distribution of solutions amongst
the niches when solutions from each peak have the same effective fitness F'.
This means that in each niche k the number of solutions present nk is proportional
to the niche fitness Fk , so that F£ = Fk/nk is constant and equal
for all niches2 . This point is illustrated in Fig. 9.2.
درست بشه
با الگوریتم ژنتیک نوشته بشه
|