با سلام دوستان عزیز کسی میتونه کد الگوریتم ژنتیک زیر رو برام توضیح بده؟
ممنون


int value(chrom popcurrent)
{
int z;
z = (popcurrent.bit[15] * 1) + (popcurrent.bit[14] * 2) + (popcurrent.bit[13] * 4) + (popcurrent.bit[12] * 8) + (popcurrent.bit[11] * 16) + (popcurrent.bit[10] * 32) + (popcurrent.bit[9] * 64) + (popcurrent.bit[8] * 128) + (popcurrent.bit[7] * 256) + (popcurrent.bit[6] * 512) + (popcurrent.bit[5] * 1024) + (popcurrent.bit[4] * 2048) + (popcurrent.bit[3] * 4096) + (popcurrent.bit[2] * 8192) + (popcurrent.bit[1] * 16384);
if (popcurrent.bit[0] == 1)
z = z * (-1);
return z;
return 0;
}

float fitness(int x1, int y1, int z1, int asgn)
{
float y;
y = (y1 - x1) + ((2 * z1) - y1);
if (y == 0 & asgn == 1)
{
solve = true;
return (0);
}
else
{
float result = 1 / y;
return (result);
}
}

chrom DesToBin(chrom ch_value, int Des)
{
int i;

if (Des > 0 & Des <= 32768)
{
for (i = 15; i >= 0; i--)
{
ch_value.bit[i] = Des % 2;

Des = Des / 2;
}
ch_value.bit[0] = 0;
// ch_value.bit[6] = 0;
}
else
if (Des < 0)
{
for (i = 15; i >= 0; i--)
{
ch_value.bit[i] = abs(Des % 2);
Des = Des / 2;
}
ch_value.bit[0] = 1;
}

return chrom(ch_value);
}

void print_gen(chrom input_1[50], chrom input_2[50], chrom input_3[50])
{
int i, j, z, j1;
int val_x, val_y, val_z;

for (j1 = 0; j1 < fix; j1++)
{
printf(&quot;%d) &quot;, j1);
printf(&quot;x=&quot;

for (i = 0; i < 16; i++)
{
printf(&quot;%d&quot;, input_1[j1].bit[i]);
}

val_x = value(input_1[j1]);
printf(&quot; value=%d&quot;, val_x);

printf(&quot; y=&quot;
for (j = 0; j < 16; j++)
{
printf(&quot;%d&quot;, input_2[j1].bit[j]);
}
val_y = value(input_2[j1]);
printf(&quot; value=%d&quot;, val_y);

printf(&quot; z=&quot;

for (int k = 0; k < 16; k++)
{
printf(&quot;%d&quot;, input_3[j1].bit[k]);
}
val_z = value(input_3[j1]);
printf(&quot; value=%d&quot;, val_z);

float fn = fitness(val_x, val_y, val_z, 0);
printf(&quot; fitness=%f&quot;, fn);
printf(&quot;\n&quot;
}