public PsoParticle(NeuralNetwork network, ParticleProperties props, Random rnd)
        {
            this.bestAccuracy = 0.0;
            this.Network = network;
            var data = network.Data;
            this.props = props;
            this.rnd = rnd;

            var numvelocities = /*weights: */(data.Props.NumInput * data.Props.NumHidden) + (data.Props.NumHidden * data.Props.NumOutput) /*bias: */ + data.Props.NumHidden + data.Props.NumOutput;
            this.velocities = new double[numvelocities];
            Array.Clear(this.velocities, 0, numvelocities);
        }
        public void MoveTowards(NeuralNetwork socialbest)
        {
            if (null == socialbest)
            {
                throw new ArgumentNullException("socialbest");
            }

            if (this.Best == null)
            {
                this.Best = this.Network.Clone();
            }

            var data = this.Network.Data;
            var bestData = this.Best.Data;
            var socialBestData = socialbest.Data;
            var k = 0;

            this.SwarmMulti(data.ihWeights, bestData.ihWeights, socialBestData.ihWeights, ref k);
            this.Swarm(data.hBiases, bestData.hBiases, socialBestData.hBiases, ref k);
            this.SwarmMulti(data.hoWeights, bestData.hoWeights, socialBestData.hoWeights, ref k);
            this.Swarm(data.oBiases, bestData.oBiases, socialBestData.oBiases, ref k);
        }