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;
                    }
                }
            }
        }
 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);
     }
 }
Esempio n. 3
0
 protected void AddInputNode(BaseInputNode node)
 {
     node.OnConnected  += OnNodeConnected;
     node.OnDisconnect += OnNodeDisconnected;
     InputNodes.Add(node);
     OnNodeAdded?.Invoke(this, node);
 }
Esempio n. 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"));
 }
        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);
                }
            }
        }
Esempio n. 6
0
        private void N_OnInputAddedToNode(Node n, NodeInput inp)
        {
            UINodePoint inputpoint = new UINodePoint(this, Graph);

            inputpoint.Input             = inp;
            inputpoint.VerticalAlignment = VerticalAlignment.Center;
            InputStack.Children.Add(inputpoint);
            InputNodes.Add(inputpoint);
            inputpoint.UpdateColor();

            ResizeHeight();
        }
Esempio n. 7
0
        public Perceptron(int nInputs, int nOutputs)
        {
            for (int i = 0; i < nOutputs; ++i)
            {
                OutputNodes.Add(new Node());
            }

            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);
            }
        }
        protected LeafNodeDictionaryEntry ProcessInputNode(HtmlNode n)
        {
            var input_types_toWatch = InputTypesToWatch.or(DefaultInputTypesToWatch);

            LeafNodeDictionaryEntry entry = AddOrGet(n);

            if (entry.MetaData == null)
            {
                var formParentNode      = n.GetFirstParent(x => x.Name.Equals("form", StringComparison.InvariantCultureIgnoreCase));
                InputFormDefinition inf = null;
                if (formParentNode != null)
                {
                    if (!FormNodes.Any(x => x.entry.XPath == formParentNode.XPath))
                    {
                        LeafNodeDictionaryEntry form_entry = Add(formParentNode);
                        inf = new InputFormDefinition(form_entry, formParentNode);
                        FormNodes.Add(inf);
                    }
                    else
                    {
                        inf = FormNodes.FirstOrDefault(x => x.entry.XPath == formParentNode.XPath);
                    }
                }


                InputNodeDefinition ind = new InputNodeDefinition(entry, n);

                if (input_types_toWatch.Contains(ind.type))
                {
                    ind.DoWatch = true;
                }

                if (!InputNodes.Any(x => x.xkey == ind.xkey))
                {
                    InputNodes.Add(ind);
                    if (inf != null)
                    {
                        inf.Add(ind);
                    }
                }
            }
            return(entry);
        }
Esempio n. 9
0
        private void N_OnInputAddedToNode(Node n, NodeInput inp, NodeInput previous = null)
        {
            //need to take into account previous
            //aka we are just replacing the previous one
            UINodePoint previousNodePoint       = null;
            UINodePoint previousNodePointParent = null;

            if (previous != null)
            {
                previousNodePoint = InputNodes.Find(m => m.Input == previous);
            }

            if (previousNodePoint != null)
            {
                previousNodePointParent = previousNodePoint.ParentNode;
            }

            UINodePoint inputpoint = new UINodePoint(this, Graph);

            inputpoint.Input             = inp;
            inputpoint.VerticalAlignment = VerticalAlignment.Center;
            InputStack.Children.Add(inputpoint);
            InputNodes.Add(inputpoint);
            inputpoint.UpdateColor();

            //try and reconnect previous parent node to it graphically
            if (previousNodePointParent != null)
            {
                previousNodePointParent.ConnectToNode(inputpoint, true);
            }

            if (previous != null)
            {
                N_OnInputRemovedFromNode(n, previous);
            }

            ResizeHeight();
        }
Esempio n. 10
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);
        }
        private void AddNode(object item)
        {
            NodeDisplay newNode = new() { CoreNode = item as INodeBase };

            newNode.ShowConnectors      = false;
            newNode.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center;
            InputNodes.Add(newNode);
            newNode.PointerPressed += (o, e) =>
            {
                _lastClickedDisplay = new NodeDisplay()
                {
                    CoreNode = item as INodeBase
                };
                _dragOffset = e.GetPosition(newNode);
            };

            newNode.PointerReleased += (o, e) =>
            {
                _lastClickedDisplay = null;
            };

            newNode.CoreNode.NameLabel.NeedsEditing = true;
        }
Esempio n. 12
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"));
 }
Esempio n. 13
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"));
 }
Esempio n. 14
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);
            }
        }
Esempio n. 15
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"));
 }
Esempio n. 16
0
 public void Add(InputNodeDefinition ind)
 {
     InputNodes.Add(ind);
     //switch(ind.)
 }