September 2018
Intermediate to advanced
328 pages
10h 46m
English
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());}
Read now
Unlock full access