Example #1
0
    public void AddConnection(NeuralGeneNode _inputNeuron, NeuralGeneNode _outputNeuron, float _bias, bool _connectionIsEnabled,
                              bool _increaseInnovation = true)
    {
        if (connections == null)
        {
            connections = new List <NeuralGeneConnection>();
        }

        NeuralGeneConnection tmpSynapse = new NeuralGeneConnection(_inputNeuron, _outputNeuron, _connectionIsEnabled, _increaseInnovation ? currInnovation : localInnovation);

        _outputNeuron.AddConnection(_inputNeuron, tmpSynapse, _bias, _connectionIsEnabled, _increaseInnovation ? currInnovation : localInnovation);
        connections.Add(tmpSynapse);
        if (_increaseInnovation)
        {
            currInnovation++;
            if (IncreaseGlobalInnovation != null)
            {
                IncreaseGlobalInnovation(currInnovation);
            }
        }
        else
        {
            localInnovation++;
        }
    }
Example #2
0
 public void AddConnection(IEnumerable <NeuralGeneNode> _inputNeurons, NeuralGeneNode _outputNeuron, bool _connectionIsEnabled,
                           bool _increaseInnovation = true)
 {
     if (connections == null)
     {
         connections = new List <NeuralGeneConnection>();
     }
     foreach (var inputNeuron in _inputNeurons)
     {
         NeuralGeneConnection tmpSynapse = new NeuralGeneConnection(inputNeuron, _outputNeuron, _connectionIsEnabled, _increaseInnovation ? currInnovation : localInnovation);
         _outputNeuron.AddConnection(inputNeuron, tmpSynapse, _connectionIsEnabled, _increaseInnovation ? currInnovation : localInnovation);
         connections.Add(tmpSynapse);
         if (_increaseInnovation)
         {
             currInnovation++;
             if (IncreaseGlobalInnovation != null)
             {
                 IncreaseGlobalInnovation(currInnovation);
             }
         }
         else
         {
             localInnovation++;
         }
     }
 }
Example #3
0
    public void AddConnection(NeuralGeneNode _inputNeuron, NeuralGeneNode _outputNeuron, bool _connectionIsEnabled,
                              int _innovation)
    {
        if (connections == null)
        {
            connections = new List <NeuralGeneConnection>();
        }

        NeuralGeneConnection tmpSynapse = new NeuralGeneConnection(_inputNeuron, _outputNeuron, _connectionIsEnabled, _innovation);

        _outputNeuron.AddConnection(_inputNeuron, tmpSynapse, _connectionIsEnabled, _innovation);
        connections.Add(tmpSynapse);
        localInnovation++;
    }