Пример #1
0
        public UnsureNetworkForm()
        {
            InitializeComponent();

            NodeSavingReading reader = new NodeSavingReading();

            net = new NeuralNet(7, 7, ANNfilename, KFoldFilename);
            inputTrainingData  = reader.GetStoredDataFromFile(Globals.inputDataStorage);
            outputTrainingData = reader.GetStoredDataFromFile(Globals.outputDataStorage);

            //inputTrainingData = new List<double[]>();
            //outputTrainingData = new List<double[]>();

            controls = new PatsControlScheme();
            controls.Initialize();
            controls.timeNeededForChange = 7000;

            serial = new SerialReader();
            serial.Read();

            UnityCommunicationHub.InitializeUnityCommunication();
            UnityCommunicationHub.TwoWayTransmission();


            indexList        = Globals.GetBasicValues();
            reverseIndexList = Globals.GetBasicValuesReversed();
            setPointList     = Globals.GetBasicPositions();

            foreach (KeyValuePair <string, int> position in indexList)
            {
                DefaultPositionsBox.Items.Add(position.Key);
            }
        }
Пример #2
0
        public NeuralTreeWindow()
        {
            this.Size         = new System.Drawing.Size(1710, 1301);
            this.FormClosing += Globals.CloseAllForms;
            InitializeComponent();

            updateFingerDisplay();

            UnityCommunicationHub.InitializeUnityCommunication();

            //initialize tree structure
            controls = new PatsControlScheme();
            controls.Initialize();

            loadPositions(controls.root);

            List <Node> newList = controls.allNodes.Values.ToList <Node>();

            //order the list from lowest to highest to ensure all nodes are populated in order
            newList.OrderBy(o => o.id);

            //make sure the list of nodes is clear
            NeuronTreeView.Nodes.Clear();

            //sequentially add all the nodes to the tree
            foreach (Node n in newList)
            {
                if (n.id != Globals.CONTROLNODE)
                {
                    //figure out what the parent id is
                    int parentID = n.parent;
                    //if it's the root node, just add it to the tree
                    if (parentID == Globals.NULLPARENT)
                    {
                        TreeNode newNode = new TreeNode(n.name);
                        newNode.Tag = n.id;
                        NeuronTreeView.Nodes.Add(newNode);
                        activeNode = newNode;
                    }
                    //in the case that it's a child node, figure out what display node to add it to
                    else
                    {
                        //iterate through until you find the parent
                        TreeNode parentNode = findNodeInTree(parentID);
                        //once we find the parent, add it to the parent's children
                        TreeNode newNode = new TreeNode(n.name);
                        newNode.Tag = n.id;
                        parentNode.Nodes.Add(newNode);
                    }
                }
            }

            foreach (Node n in newList)
            {
                if (n.id != Globals.CONTROLNODE && n.children.Contains(Globals.CONTROLNODE))
                {
                    TreeNode tn   = findNodeInTree(n.id);
                    bool     done = false;
                    foreach (TreeNode tnn in tn.Nodes)
                    {
                        if (!done && (int)tnn.Tag == Globals.CONTROLNODE)
                        {
                            tnn.Remove();
                            done = true;
                        }
                    }
                    TreeNode newControlNode = new TreeNode("Controls");
                    newControlNode.Tag = Globals.CONTROLNODE;
                    tn.Nodes.Add(newControlNode);
                }
            }
        }