예제 #1
0
        // This method creates a Metanework cognitive array
        public static MetaNode createRSV2CognitiveArray(ref MetaNode limbs, ref MetaNode[] camlines)
        {
            MetaNode[] children;

            // creating Leaves
            // 1. Creating 1st level (0) STANN (1 MetaNode) for Right/Left Arm/Foot Sensors, including the pickups (Limbs)
            MetaNode Limbs = MetaNode.createTreeLeaf(12,      // number of inputs for each leaf
                                                     4,       // range of input (0-3)
                                                     3,       // 3 STANN Layers
                                                     20,      // Number of Neurons in each layer (except the output layer)
                                                     4,       // Number of binary outputs of the node
                                                     0.5,     // STANN Threshold
                                                     0.6,     // STANN Learning Rate (Quick)
                                                     null,    // parents should be linked here
                                                     RandGen, // random number generator
                                                     0        // leaf index is 0
                                                     );


            // 4. Creating 1st level STANN MetaNode for the Camera Input (8x8 frame abstraction)
            MetaNode[] CamFrameLines = MetaNode.createTreeLeaves(8,       // 8 metanodes, 1 for each line
                                                                 8,       //  8 line inputs
                                                                 2,       // thresholded input range (0 black, 1 -white)
                                                                 3,       // 3 STANN Layers
                                                                 20,      // 20 neurons per layer (except output)
                                                                 3,       // 3 STANN binary ouputs
                                                                 0.5,     // STANN threshold
                                                                 0.5,     // STANN Learning Rate (Quick)
                                                                 null,    // Parents are null for now...
                                                                 RandGen, // Random Number Generator
                                                                 2        // the starting index for these leaves is 2
                                                                 );

            // Creating TOP node (although if things go nice, we may create a level before the top node)
            children    = new MetaNode[9];
            children[0] = Limbs;
            int i;

            for (i = 0; i < 8; i++)
            {
                children[1 + i] = CamFrameLines[i];
            }

            // ATTENTION! this node will using its output as input, therefore should include
            // itself in the children array following creation

            MetaNode Top = MetaNode.createHigherLevelNode(children, //  children array
                                                          2,        // 2 children
                                                          3,        // 3 STANN Layers
                                                          30,       // 30 neurons per layer
                                                          6,        // 6 binary outputs (may have to reduce/increase it)
                                                          0.5,      // STANN threshold
                                                          0.7,      // fast learning rate
                                                          null,     // NO Parents. we're at the top
                                                          0,        // 0 number of parents
                                                          RandGen,  // Random Number Generator
                                                          false,    // node is NOT self trained
                                                          false,    // Q-Learning disabled (for now...)
                                                          0.3,      // Q -learning a param is 0.3
                                                          0.6,      // Q - learning γ param is 0.6
                                                          1         // Level 2
                                                          );

            // *** ADDING self into the children list
            Top.addChild(Top);


            // *************** Updating the parents entries of the MetaNodes in a bottom-up fashion *************



            limbs    = Limbs;
            camlines = CamFrameLines;

            return(Top);
        }
예제 #2
0
        // This method creates a Metanework cognitive array
        public static MetaNode createLMCartCognitiveArray(ref MetaNode sonarnode, ref MetaNode[] camlinesnodes)
        {
            MetaNode[] children;

            // creating Leaves
            // 1. Creating 1st level (0) STANN (1 MetaNode) for Sonar Sensors
            MetaNode TransducersNode = MetaNode.createTreeLeaf(8,       // number of inputs
                                                               4,       // range of input (0-3)
                                                               3,       // 3 STANN Layers
                                                               20,      // Number of Neurons in each layer (except the output layer)
                                                               5,       // Number of binary outputs of the node
                                                               0.5,     // STANN Threshold
                                                               0.6,     // STANN Learning Rate (Quick)
                                                               null,    // parents should be linked here
                                                               RandGen, // random number generator
                                                               0        // leaf index is 0
                                                               );


            // 4. Creating 1st level STANN MetaNode for the Camera Input (8x8 frame abstraction)
            MetaNode[] CamFrameLinesNodes = MetaNode.createTreeLeaves(8,       // 8 metanodes, 1 for each line
                                                                      8,       //  8 line inputs
                                                                      2,       // thresholded input range (0 black, 1 -white)
                                                                      3,       // 3 STANN Layers
                                                                      20,      // 20 neurons per layer (except output)
                                                                      3,       // 3 STANN binary ouputs
                                                                      0.5,     // STANN threshold
                                                                      0.5,     // STANN Learning Rate (Quick)
                                                                      null,    // Parents are null for now...
                                                                      RandGen, // Random Number Generator
                                                                      2        // the starting index for these leaves is 2
                                                                      );

            // Creating TOP node (although if things go nice, we may create a level before the top node)
            children    = new MetaNode[10];
            children[0] = TransducersNode;
            int i;

            for (i = 0; i < 8; i++)
            {
                children[1 + i] = CamFrameLinesNodes[i];
            }

            // ATTENTION! this node will using its output as input, therefore should include
            // itself in the children array following creation

            MetaNode Top = MetaNode.createHigherLevelNode(children, //  children array
                                                          3,        // 3 children
                                                          3,        // 3 STANN Layers
                                                          25,       // 25 neurons per layer
                                                          4,        // 4 binary outputs
                                                          0.5,      // STANN threshold
                                                          0.5,      // fast learning rate
                                                          null,     // NO Parents. we're at the top
                                                          0,        // 0 number of parents
                                                          RandGen,  // Random Number Generator
                                                          false,    // node is NOT self trained
                                                          true,     // Q-Learning enabled
                                                          0.3,      // Q -learning a param is 0.3
                                                          0.6,      // Q - learning γ param is 0.6
                                                          1         // Level 2
                                                          );

            // *** ADDING self into the children list
            Top.addChild(Top);



            sonarnode     = TransducersNode;
            camlinesnodes = CamFrameLinesNodes;

            return(Top);
        }