コード例 #1
0
 public NeuralNet(NeuralNet copyNet)
 {
     _inputLayer = new Layer(copyNet._inputLayer);
     foreach (Layer layer in copyNet._hiddenLayers)
     {
         _hiddenLayers.Add(new Layer(layer));
     }
     _outputLayer = new Layer(copyNet._outputLayer);
 }
コード例 #2
0
        /// <summary>
        /// Crosses over NeuralNet n1 and NeuralNet n2
        /// </summary>
        /// <param name="n1"></param>
        /// <param name="n2"></param>
        public NeuralNet(NeuralNet network1, NeuralNet network2) : this()
        {
            //crossover

            _inputLayer = new Layer(network1._inputLayer, network2._inputLayer);

            for (int i = 0; i < network1._hiddenLayers.Count; i++)
            {
                _hiddenLayers.Add(new Layer(network1._hiddenLayers[i], network2._hiddenLayers[i]));
            }
            _outputLayer = new Layer(network1._outputLayer, network2._outputLayer);
        }
コード例 #3
0
        public Generation(int numberPerGeneration, int inputCount, int hiddenLayerCount, int hiddenLayerSize, int outputCount)
        {
            _numberPerGeneration = numberPerGeneration;
            _inputCount          = inputCount;
            _hiddenLayerCount    = hiddenLayerCount;
            _hiddenLayerSize     = hiddenLayerSize;
            _outputCount         = outputCount;

            for (int i = 0; i < numberPerGeneration; i++)
            {
                NeuralNet ai = new NeuralNet(inputCount, hiddenLayerCount, hiddenLayerSize, outputCount);
                Players.Add(new Pig.Player(ai));
            }
        }