private void CreateParticleForSwarm(NeuralNetworkConfiguration configuration, double[][] dataVectors, int i)
        {
            var properties = new ParticleProperties(_vectorSize);
            var randomPosition = InitializeRandomPosition();

            var error = Error(configuration, dataVectors, randomPosition);

            var particleError = new ParticleError
            {
                Error = error,
                BestError = error
            };

            var randomVelocity = InitializeRandomVelocity();

            Array.Copy(randomPosition, properties.Position, randomPosition.Length);
            Array.Copy(randomPosition, properties.BestPosition, randomPosition.Length);
            Array.Copy(randomVelocity, properties.Velocity, randomVelocity.Length);

            _swarm[i] = new Particle(particleError, properties);
        }
Beispiel #2
0
 public Particle(ParticleError particleError, ParticleProperties properties)
 {
     _properties = properties;
     _particleError = particleError;
 }