Controlling randomness

As the initialize process continues, position, speed, and fitness are initialized in the Swarm Initialization section. Here's a brief look at how we do randomization. We start with each of those hyperparameters, and then randomize the values between the upper and lower bounds we stated in our hyperparameters:

public double[] Swarm_Random(double a, double b, int n)
{
double[] x = new double[n];
for (int i = 0; i < n; i++)
{
x[i] = Swarm_Random(a, b);
}
return x;
}
public double Swarm_Round(double x) => decP != -1 ? Math.Round(x, decP) : x;
public double Swarm_Random() => Swarm_Round(Randd.NextDouble());
public double Swarm_Random(double a, double b)
{
Return (a + (b - a) * Swarm_Random());
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset