Пример #1
0
 public MultilayerPerceptron(int nInputs, int nHidden, int nOutputs)
 {
     for (int i = 0; i < nOutputs; ++i)
     {
         OutputNodes.Add(new Node());
     }
     for (int i = 0; i < nHidden; ++i)
     {
         var node = new Node();
         foreach (var hiddenNode in HiddenNodes)
         {
             node.Connectors.Add(new Connector()
             {
                 Weight = 1, Node = hiddenNode
             });
         }
     }
     for (int i = 0; i < nInputs; ++i)
     {
         var node = new Node();
         foreach (var output in OutputNodes)
         {
             node.Connectors.Add(new Connector()
             {
                 Weight = 1, Node = output
             });
         }
         InputNodes.Add(node);
     }
 }
Пример #2
0
        public void InitialiseNetwork()
        {
            //Clear all the nodes
            foreach (Node Node in Nodes)
            {
                Node.ClearValue();
            }


            //Check if we have 'shortcuts' to the input and output nodes
            if (InputNodes.Count == 0 || OutputNodes.Count == 0)
            {
                InputNodes.Clear();
                OutputNodes.Clear();

                foreach (Node Node in Nodes)
                {
                    switch (Node.Type)
                    {
                    case eNeuralNodeType.eInput:
                        InputNodes.Add(Node);
                        break;

                    case eNeuralNodeType.eOutput:
                        OutputNodes.Add(Node);
                        break;
                    }
                }
            }
        }
Пример #3
0
 protected void AddOutputNode(BaseOutputNode node)
 {
     node.OnConnected  += OnNodeConnected;
     node.OnDisconnect += OnNodeDisconnected;
     OutputNodes.Add(node);
     OnNodeAdded?.Invoke(this, node);
 }
Пример #4
0
 protected override void CreateNodes(ref Blocks.BlockBase root)
 {
     this.Interpolate = true;
     InputNodes.Add(new Blocks.BlockInputNode(ref root, "input1", "in1"));
     InputNodes.Add(new Blocks.BlockInputNode(ref root, "input2", "in2"));
     InputNodes.Add(new Blocks.BlockInputNode(ref root, "select", "sel"));
     OutputNodes.Add(new Blocks.BlockOutputNode(ref root, "output", "out"));
 }
Пример #5
0
 protected override void CreateNodes(ref Blocks.BlockBase root)
 {
     InputNodes = new List <Blocks.BlockInputNode>();
     foreach (var item in _inputs)
     {
         InputNodes.Add(new Blocks.BlockInputNode(ref root, item, item));
     }
     OutputNodes.Add(new Blocks.BlockOutputNode(ref root, "output", "out"));
 }
Пример #6
0
        public void AddNode(int plLayer, eNeuralNodeType peType)
        {
            Node       oNode;
            Connection oConnection;
            int        lNodeIndex;

            //create node
            oNode          = new Node(peType, plLayer);
            oNode.Treshold = 0;
            oNode.Id       = Nodes.Count;
            Nodes.Add(oNode);

            switch (peType)
            {
            case eNeuralNodeType.eInput:
            {
                InputNodes.Add(oNode);
                break;
            }

            case eNeuralNodeType.eOutput:
            {
                OutputNodes.Add(oNode);
                break;
            }
            }

            lNodeIndex = Nodes.Count - 1;

            //create connections to all nodes in previous layer
            for (int lIndex = 0; lIndex < (int)Nodes.Count; lIndex++)
            {
                if (Nodes[lIndex].lLayer == plLayer - 1)
                {
                    oConnection = new Connection(lIndex, lNodeIndex);

                    oConnection.fWeight = 0;

                    oNode.Connections.Add(oConnection);
                }
            }

            //create connections to all nodes in next layer
            foreach (Node Node in Nodes)
            {
                if (Node.lLayer == plLayer + 1)
                {
                    oConnection = new Connection(lNodeIndex, Node.Id);

                    oConnection.fWeight = 0;

                    Node.Connections.Add(oConnection);
                }
            }
        }
Пример #7
0
        private void N_OnOutputAddedToNode(Node n, NodeOutput inp)
        {
            UINodePoint outpoint = new UINodePoint(this, Graph);

            outpoint.Output            = inp;
            outpoint.VerticalAlignment = VerticalAlignment.Center;
            OutputNodes.Add(outpoint);
            OutputStack.Children.Add(outpoint);
            outpoint.UpdateColor();

            ResizeHeight();
        }
        public FirstLevelEquipment(int number, Point stackLocation) : base(
                "АПП",
                "First Level Equipment " + number,
                new Point(stackLocation.X, number * (verticalOffset) + stackLocation.Y))
        {
            Height          = 370;
            inputEquipments = new List <IndividualEquipment>();
            CreateInputNodes();
            OutputNodes.Add(new Point(Location.X + Width, Location.Y + Height / 2));
            int numberIE = 0;

            foreach (Point inputNode in inputNodes)
            {
                inputEquipments.Add(new IndividualEquipment(false, numberIE, number, GetStackLocationIE(number, stackLocation)));
                arrows.Add(new BigArrow(inputEquipments[numberIE++].OutputNodes[0], inputNode));
            }
        }
Пример #9
0
        private void N_OnOutputAddedToNode(Node n, NodeOutput inp, NodeOutput previous = null)
        {
            UINodePoint outpoint = new UINodePoint(this, Graph);

            outpoint.Output            = inp;
            outpoint.VerticalAlignment = VerticalAlignment.Center;
            OutputNodes.Add(outpoint);
            OutputStack.Children.Add(outpoint);
            outpoint.UpdateColor();

            if (previous != null)
            {
                foreach (var cinp in inp.To)
                {
                    LoadConnection(cinp.Node.Id);
                }
            }
        }
Пример #10
0
 public IndividualEquipment(bool small, int equipmentNumber, int signalNumber, Point stackLocation) : base(
         "АИП",
         "Individual Equipment " + equipmentNumber,
         new Point(stackLocation.X, equipmentNumber * (verticalOffset) + stackLocation.Y))
 {
     this.small   = small;
     inputNumbers = new List <SchemaLablel>();
     inputNodes.Add(new Point(Location.X, Location.Y));
     inputNodes.Add(new Point(Location.X, Location.Y + Height));
     OutputNodes.Add(new Point(Location.X + Width, Location.Y + Height / 2));
     foreach (Point inputNode in inputNodes)
     {
         bool isFirst = (inputNodes.IndexOf(inputNode) == 0);
         arrows.Add(new BigArrow(new Point(inputNode.X + inputArrowOffset, inputNode.Y), inputNode));
         inputNumbers.Add(new SchemaLablel(
                              Convert.ToString(GetInputNumberValue(equipmentNumber, signalNumber, isFirst)),
                              "Input " + (GetInputNumberValue(equipmentNumber, signalNumber, isFirst)),
                              new Point(inputNode.X + inputNumberOffsetX, inputNode.Y + inputNumberOffsetY)));
     }
 }
Пример #11
0
        public virtual bool Add(Node n)
        {
            if (NodeLookup.ContainsKey(n.Id))
            {
                return(false);
            }

            if (n is OutputNode)
            {
                OutputNodes.Add(n.Id);
            }
            else if (n is InputNode)
            {
                InputNodes.Add(n.Id);
            }

            NodeLookup[n.Id] = n;
            Nodes.Add(n);

            n.OnUpdate += N_OnUpdate;

            return(true);
        }
Пример #12
0
 protected override void CreateNodes(ref Blocks.BlockBase root)
 {
     this.Frequencies = new string[] { "10", "20" };
     this.Length      = this.SampleRate = 22100;
     OutputNodes.Add(new Blocks.BlockOutputNode(ref root, "output", "out"));
 }
Пример #13
0
 protected override void CreateNodes(ref Blocks.BlockBase root)
 {
     InputNodes.Add(new Blocks.BlockInputNode(ref root, "actual", "tx", "transmitted bitstream"));
     InputNodes.Add(new Blocks.BlockInputNode(ref root, "actual", "rx", "received bitstream"));
     OutputNodes.Add(new Blocks.BlockOutputNode(ref root, "ber", "ber", "scalar value representing ber"));
 }
Пример #14
0
 protected override void CreateNodes(ref Blocks.BlockBase root)
 {
     Operation = LineCodingOps.Encode; LineCoding = LineCodings.None;
     InputNodes.Add(new Blocks.BlockInputNode(ref root, "instream", "in"));
     OutputNodes.Add(new Blocks.BlockOutputNode(ref root, "outstream", "out"));
 }
Пример #15
0
        public void AddNode(INode node)
        {
            string colorName = "";

            switch (node.GetNodeType())
            {
            case INodeType.LINE:
                colorName = ConfigurationManager
                            .ConnectionStrings["LineColor"]
                            .ConnectionString;
                break;

            case INodeType.HOOK:
                colorName = ConfigurationManager
                            .ConnectionStrings["HookColor"]
                            .ConnectionString;
                break;

            default:
                colorName = "Fuchsia";
                logger.Warn("No color assigned for input node type");
                // Logger.Log(Severity.WARN, LogCategory.CONTROL, "No color assigned for input node type");
                break;
            }



            var innerContainer = new StackPanel();

            innerContainer.Name              = "nodeContainer";
            innerContainer.Tag               = node;
            innerContainer.Orientation       = Orientation.Vertical;
            innerContainer.VerticalAlignment = VerticalAlignment.Top;


            var label = new Label();

            label.Padding           = new Thickness(0);
            label.Content           = node.GetDisplayName();
            label.VerticalAlignment = VerticalAlignment.Bottom;

            innerContainer.Children.Add(label);

            var circleControl = CreateNodeVisual(colorName);

            circleControl.VerticalAlignment = VerticalAlignment.Top;

            innerContainer.Children.Add(circleControl);


            if (node is BaseOutputNode)
            {
                innerContainer.HorizontalAlignment = HorizontalAlignment.Left;
                label.HorizontalAlignment          = HorizontalAlignment.Left;
                circleControl.HorizontalAlignment  = HorizontalAlignment.Left;

                OutputNodes.Add(new RenderNode(this, circleControl, node));
                spOutputNodes.Children.Add(innerContainer);
            }
            else if (node is InputNode)
            {
                innerContainer.HorizontalAlignment = HorizontalAlignment.Right;
                label.HorizontalAlignment          = HorizontalAlignment.Right;
                circleControl.HorizontalAlignment  = HorizontalAlignment.Right;

                InputNodes.Add(new RenderNode(this, circleControl, node));
                spInputNodes.Children.Add(innerContainer);
            }
        }
Пример #16
0
 protected override void CreateNodes(ref Blocks.BlockBase root)
 {
     SampleRate = 22100; DataStream = "0101";
     OutputNodes.Add(new Blocks.BlockOutputNode(ref root, "bin_output", "bin"));
 }
Пример #17
0
 protected override void CreateNodes(ref Blocks.BlockBase root)
 {
     this.BitsPerSymbol = 1;
     InputNodes.Add(new Blocks.BlockInputNode(ref root, "instream", "bin"));
     OutputNodes.Add(new Blocks.BlockOutputNode(ref root, "outstream", "syms"));
 }
Пример #18
0
 protected override void CreateNodes(ref Blocks.BlockBase root)
 {
     SampleRate = 22100; LineCoding = LineCodings.None; OneTimeGeneration = false;
     Length     = 10;
     OutputNodes.Add(new Blocks.BlockOutputNode(ref root, "bin_output", "bin"));
 }