modify TSEA

This commit is contained in:
JQSakaJoo
2024-04-30 16:04:43 +05:00
parent 314ef87bcc
commit bcf8ee834d
3 changed files with 71 additions and 27 deletions
Binary file not shown.
@@ -319,7 +319,7 @@ class C_AO_TSEA : public C_AO
popSize = 100; //population size popSize = 100; //population size
vClusters = 3; //number of vertical clusters vClusters = 3; //number of vertical clusters
hClusters = 10; //number of horizontal clusters hClusters = 20; //number of horizontal clusters
neighbNumb = 5; //number of nearest neighbors neighbNumb = 5; //number of nearest neighbors
maxAgentsInCell = 3; //max agents in cell maxAgentsInCell = 3; //max agents in cell
@@ -465,6 +465,8 @@ void C_AO_TSEA::Moving ()
} }
for (int i = 0; i < popSize; i++) for (int i = 0; i < popSize; i++)
{
if (u.RNDprobab () < 0.8)
{ {
while (true) while (true)
{ {
@@ -501,6 +503,48 @@ void C_AO_TSEA::Moving ()
agent [i].c [c] = a [i].c [c]; agent [i].c [c] = a [i].c [c];
} }
} }
else
{
int size2 = 0;
int hPos2 = 0;
int pos2 = 0;
while (true)
{
rnd = u.RNDprobab ();
rnd = (-rnd * rnd + 1.0) * vClusters;
vPos = (int)rnd;
if (vPos > vClusters - 1) vPos = vClusters - 1;
hPos = u.RNDminusOne (hClusters);
size = ArraySize (cell [vPos].cell [hPos].agent);
hPos2 = u.RNDminusOne (hClusters);
size2 = ArraySize (cell [vPos].cell [hPos2].agent);
if (size > 0 && size2 > 0) break;
}
pos = u.RNDminusOne (size);
pos2 = u.RNDminusOne (size2);
for (int c = 0; c < coords; c++)
{
val = (cell [vPos].cell [hPos ].agent [pos ].c [c] +
cell [vPos].cell [hPos2].agent [pos2].c [c]) * 0.5;
a [i].c [c] = u.SeInDiSp (val, rangeMin [c], rangeMax [c], rangeStep [c]);
agent [i].c [c] = a [i].c [c];
}
}
}
} }
//—————————————————————————————————————————————————————————————————————————————— //——————————————————————————————————————————————————————————————————————————————
+1 -1
View File
@@ -5,11 +5,11 @@ A list of implemented (+) optimization algorithms, (-) not included in the repos
+SDSm (stochastic diffusion search M) +SDSm (stochastic diffusion search M)
+ESG (evolution of social groups) +ESG (evolution of social groups)
+SIA (simulated isotropic annealing) +SIA (simulated isotropic annealing)
+TSEA (turtle shell evolution algorithm)
-DE (differential evolution) -DE (differential evolution)
+BSA (bird swarm algorithm) +BSA (bird swarm algorithm)
-HS (harmony search) -HS (harmony search)
-SSG (saplings sowing and growing) -SSG (saplings sowing and growing)
+TSEA (turtle shell evolution algorithm)
-(PO)ES ((PO) evolution strategies) -(PO)ES ((PO) evolution strategies)
+BSO (brain storm optimization) +BSO (brain storm optimization)
+WOAm (wale optimization algorithm M) +WOAm (wale optimization algorithm M)