Example #1
0
        /// <summary>
        /// Returns the default connection weight mutation scheme.
        /// </summary>

/*        private ConnectionMutationInfoList CreateConnectionWeightMutationScheme_Default()
 *      {
 *          ConnectionMutationInfoList list = new ConnectionMutationInfoList(12);
 *
 *          // Gaussian jiggle with sigma=0.02 (most values between +-0.04)
 *          // Jiggle 1,2 and 3 connections respectively.
 *          list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
 *                                              ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 0.02));
 *
 *          list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
 *                                              ConnectionSelectionType.FixedQuantity, 0.0, 2, 0.0, 0.02));
 *
 *          list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
 *                                              ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 0.02));
 *
 *          // Jiggle 2% of connections.
 *          list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
 *                                              ConnectionSelectionType.Proportional, 0.02, 0, 0.0, 0.02));
 *
 *          // Gaussian jiggle with sigma=1 (most values between +-2)
 *          // Jiggle 1,2 and 3 connections respectively.
 *          list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
 *                                              ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 1));
 *
 *          list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
 *                                              ConnectionSelectionType.FixedQuantity, 0.0, 2, 0.0, 1));
 *
 *          list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
 *                                              ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 1));
 *
 *          // Jiggle 2% of connections.
 *          list.Add(new ConnectionMutationInfo(0.11275, ConnectionPerturbanceType.JiggleGaussian,
 *                                              ConnectionSelectionType.Proportional, 0.02, 0, 0.0, 1));
 *
 *          // Reset mutations. 1, 2 and 3 connections respectively.
 *          list.Add(new ConnectionMutationInfo(0.03, ConnectionPerturbanceType.Reset,
 *                                              ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 0));
 *
 *          list.Add(new ConnectionMutationInfo(0.03, ConnectionPerturbanceType.Reset,
 *                                              ConnectionSelectionType.FixedQuantity, 0.0, 2, 0.0, 0));
 *
 *          list.Add(new ConnectionMutationInfo(0.03, ConnectionPerturbanceType.Reset,
 *                                              ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 0));
 *
 *          // Reset 2% of connections.
 *          list.Add(new ConnectionMutationInfo(0.001, ConnectionPerturbanceType.Reset,
 *                                              ConnectionSelectionType.Proportional, 0.02, 0, 0.0, 0));
 *          list.Initialize();
 *          return list;
 *      }*/
        private ConnectionMutationInfoList CreateConnectionWeightMutationScheme_Default()
        {
            ConnectionMutationInfoList list = new ConnectionMutationInfoList(2);

            // Inspired by original NEAT

/*			// Gaussian jiggle with sigma=0.02 (most values between +-0.04)
 *                      // Jiggle 90% of connections with 90% chance.
 *                      list.Add(new ConnectionMutationInfo(0.9, ConnectionPerturbanceType.JiggleGaussian,
 *                              ConnectionSelectionType.Proportional, 0.9, 0, 0.0, 0.02));
 *
 *                      // Reset 10% of connections with 10% chance.
 *                      list.Add(new ConnectionMutationInfo(0.1, ConnectionPerturbanceType.Reset,
 *                              ConnectionSelectionType.Proportional, 0.1, 0, 0.0, 0));*/

            // Gaussian jiggle with sigma=0.04
            // Jiggle 90% of connections with 90% chance.
            list.Add(new ConnectionMutationInfo(0.9, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.Proportional, 0.9, 0, 0.0, 0.02));

            // Reset 20% of connections with 10% chance.
            list.Add(new ConnectionMutationInfo(0.1, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.Proportional, 0.2, 0, 0.0, 0));

            list.Initialize();
            return(list);
        }
        /// <summary>
        /// Returns the default connection weight mutation scheme.
        /// </summary>
        private ConnectionMutationInfoList CreateConnectionWeightMutationScheme_Default()
        {
            ConnectionMutationInfoList list = new ConnectionMutationInfoList(6);

            // Gaussian jiggle with sigma=0.01 (most values between +-0.02)
            // Jiggle 1,2 and 3 connections respectively.
            list.Add(new ConnectionMutationInfo(0.5985, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 0.01));

            list.Add(new ConnectionMutationInfo(0.2985, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 2, 0.0, 0.01));

            list.Add(new ConnectionMutationInfo(0.0985, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 0.01));

            // Reset mutations. 1, 2 and 3 connections respectively.
            list.Add(new ConnectionMutationInfo(0.015, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 0));

            list.Add(new ConnectionMutationInfo(0.015, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 2, 0.0, 0));

            list.Add(new ConnectionMutationInfo(0.015, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 0));

            list.Initialize();
            return(list);
        }
Example #3
0
        private static ConnectionMutationInfoList CreateLargeMutationsScheme()
        {
            ConnectionMutationInfoList list = new ConnectionMutationInfoList(1);

            // Massive jiggle of 90% of the connections with 70% chance.
            list.Add(new ConnectionMutationInfo(0.7, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.Proportional, 0.9, 0, 0.0, 3.5));
            list.Initialize();
            return(list);
        }
        /// <summary>
        /// Returns the default connection weight mutation scheme.
        /// Customized
        /// </summary>
        private ConnectionMutationInfoList CreateConnectionWeightMutationScheme_Default()
        {
            ConnectionMutationInfoList list = new ConnectionMutationInfoList(2);

            // Jiggle 80% of connections.
            list.Add(new ConnectionMutationInfo(1, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.Proportional, 0.8, 0, 0.0, _connectionWeightRange * 0.1));

            list.Initialize();
            return(list);
        }
Example #5
0
        /// <summary>
        /// Returns the default connection weight mutation scheme.
        /// </summary>
        private ConnectionMutationInfoList CreateConnectionWeightMutationScheme_Default()
        {
            // DEFAULT scheme, it's crazy
            ConnectionMutationInfoList list = new ConnectionMutationInfoList(12);

            // Gaussian jiggle with sigma=0.02 (most values between +-0.04)
            // Jiggle 1,2 and 3 connections respectively.
            list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 0.02));

            list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 2, 0.0, 0.02));

            list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 0.02));

            // Jiggle 2% of connections.
            list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.Proportional, 0.02, 0, 0.0, 0.02));

            // Gaussian jiggle with sigma=1 (most values between +-2)
            // Jiggle 1,2 and 3 connections respectively.
            list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 1));

            list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 2, 0.0, 1));

            list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 1));

            // Jiggle 2% of connections.
            list.Add(new ConnectionMutationInfo(0.11275, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.Proportional, 0.02, 0, 0.0, 1));

            // Reset mutations. 1, 2 and 3 connections respectively.
            list.Add(new ConnectionMutationInfo(0.03, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 0));

            list.Add(new ConnectionMutationInfo(0.03, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 2, 0.0, 0));

            list.Add(new ConnectionMutationInfo(0.03, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 0));

            // Reset 2% of connections.
            list.Add(new ConnectionMutationInfo(0.001, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.Proportional, 0.02, 0, 0.0, 0));

            list.Initialize();
            return(list);
        }
Example #6
0
        /*
         * // Gaussian jiggle with sigma=0.02 (most values between +-0.04)
         * // Jiggle 1 connection
         * list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
         *                                  ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 0.02));
         * // Jiggle 2% of connections.
         * list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
         *                                  ConnectionSelectionType.Proportional, 0.02, 0, 0.0, 0.02));
         * // Gaussian jiggle with sigma=1 (most values between +-2)
         * // Jiggle 3 connections
         * list.Add(new ConnectionMutationInfo(0.11375, ConnectionPerturbanceType.JiggleGaussian,
         *                                  ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 1));
         * // Jiggle 2% of connections.
         * list.Add(new ConnectionMutationInfo(0.11275, ConnectionPerturbanceType.JiggleGaussian,
         *                                  ConnectionSelectionType.Proportional, 0.02, 0, 0.0, 1));
         * // Reset 3 connections
         * list.Add(new ConnectionMutationInfo(0.03, ConnectionPerturbanceType.Reset,
         *                                  ConnectionSelectionType.FixedQuantity, 0.0, 3, 0.0, 0));
         * // Reset 2% of connections.
         * list.Add(new ConnectionMutationInfo(0.001, ConnectionPerturbanceType.Reset,
         *                                  ConnectionSelectionType.Proportional, 0.02, 0, 0.0, 0));
         * }*/

        private ConnectionMutationInfoList CreateNormalMutationsScheme()
        {
            ConnectionMutationInfoList list = new ConnectionMutationInfoList(2);

            // Large jiggle 90% of connections with 50% chance.
            list.Add(new ConnectionMutationInfo(0.5, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.Proportional, 0.8, 0, 0.0, 0.75));
            // Small jiggle 70% of connections with 50% chance.
            list.Add(new ConnectionMutationInfo(0.5, ConnectionPerturbanceType.JiggleGaussian,
                                                ConnectionSelectionType.Proportional, 0.6, 0, 0.0, 0.4));
            list.Initialize();
            return(list);
        }
Example #7
0
        /// <summary>
        /// Copy constructor.
        /// </summary>
        public NeatGenomeParameters(NeatGenomeParameters copyFrom)
        {
            _feedforwardOnly                         = copyFrom._feedforwardOnly;
            _activationFn                            = copyFrom._activationFn;
            _connectionWeightRange                   = copyFrom._connectionWeightRange;
            _initialInterconnectionsProportion       = copyFrom._initialInterconnectionsProportion;
            _disjointExcessGenesRecombineProbability = copyFrom._disjointExcessGenesRecombineProbability;
            _connectionWeightMutationProbability     = copyFrom._connectionWeightMutationProbability;
            _addNodeMutationProbability              = copyFrom._addNodeMutationProbability;
            _addConnectionMutationProbability        = copyFrom._addConnectionMutationProbability;
            _nodeAuxStateMutationProbability         = copyFrom._nodeAuxStateMutationProbability;
            _deleteConnectionMutationProbability     = copyFrom._deleteConnectionMutationProbability;

            _rouletteWheelLayout = new RouletteWheelLayout(copyFrom._rouletteWheelLayout);
            _rouletteWheelLayoutNonDestructive = new RouletteWheelLayout(copyFrom._rouletteWheelLayoutNonDestructive);

            _connectionMutationInfoList = new ConnectionMutationInfoList(copyFrom._connectionMutationInfoList);
            _connectionMutationInfoList.Initialize();
            _fitnessHistoryLength = copyFrom._fitnessHistoryLength;
        }
Example #8
0
        /// <summary>
        /// Returns the connection weight mutation scheme from SharpNEAT version 1.x
        /// </summary>
        private ConnectionMutationInfoList CreateConnectionWeightMutationScheme_SharpNEAT1()
        {
            ConnectionMutationInfoList list = new ConnectionMutationInfoList(5);

            list.Add(new ConnectionMutationInfo(0.125, ConnectionPerturbanceType.JiggleUniform,
                                                ConnectionSelectionType.Proportional, 0.5, 0, 0.05, 0.0));

            list.Add(new ConnectionMutationInfo(0.125, ConnectionPerturbanceType.JiggleUniform,
                                                ConnectionSelectionType.Proportional, 0.1, 0, 0.05, 0.0));

            list.Add(new ConnectionMutationInfo(0.125, ConnectionPerturbanceType.JiggleUniform,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.05, 0.0));

            list.Add(new ConnectionMutationInfo(0.5, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.Proportional, 0.1, 0, 0.0, 0.0));

            list.Add(new ConnectionMutationInfo(0.125, ConnectionPerturbanceType.Reset,
                                                ConnectionSelectionType.FixedQuantity, 0.0, 1, 0.0, 0.0));
            list.Initialize();
            return(list);
        }