Beispiel #1
0
        public void createGraph()
        {
            // Input Nodes (Sensor)
            var in1 = new Node("in1");
            var in2 = new Node("in2");
            var in3 = new Node("in3");
            var in4 = new Node("in4");
            var in5 = new Node("in5");

            InputNodes = new List<Node> { in1, in2, in3, in4, in5 };

            // Bias Node
            BiasNode = new Node("bias");
            BiasNode.Output = 1.0;

            // Hidden Nodes
            var hidden1 = new Node("hidden1");
            hidden1.InternalState = 0;
            var hidden2 = new Node("hidden2");
            hidden2.InternalState = 0;

            hidden1.addConnections(in1, in2, in3, in4, in5, hidden1, hidden2, BiasNode);
            hidden2.addConnections(in1, in2, in3, in4, in5, hidden1, hidden2, BiasNode);

            HiddenNodes = new List<Node> { hidden1, hidden2 };

            //  Output Nodes (Motor)
            var out1 = new Node("out1");
            var out2 = new Node("out2");

            out1.addConnections(hidden1, hidden2, out1, out2, BiasNode);
            out2.addConnections(hidden1, hidden2, out1, out2, BiasNode);

            OutputNodes = new List<Node> { out1, out2 };
        }
Beispiel #2
0
 public MinCogPhenotype(List<Node> inputNodes, List<Node> hiddenNodes, List<Node> outputNodes, Node bias)
 {
     InputNodes = inputNodes;
     HiddenNodes = hiddenNodes;
     OutputNodes = outputNodes;
     BiasNode = bias;
 }
Beispiel #3
0
 /// <summary>
 ///     Updates Activation level and output on a node
 /// </summary>
 /// <param name="node">Node to be updated</param>
 private void updateNode(Node node)
 {
     double s = 0.0; // Sum of weighted input
     double dy = 0.0; // Change in activation level
     foreach (var upstreamConnection in node.UpstreamConnections)
     {
         s += upstreamConnection.left.Output*upstreamConnection.right;
     }
     dy = (-node.InternalState + s)/node.TimeConstant; // Bias included in s
     node.InternalState = node.InternalState + dy;
     node.Output = 1 / (1 + Math.Pow(Math.E, -(node.Gain * node.InternalState)));
 }