コード例 #1
0
        /// <summary>
        /// Initialize the experiment with some optional XML configuration data.
        /// </summary>
        public void Initialize(string name, XmlElement xmlConfig)
        {
            _name                    = name;
            _populationSize          = XmlUtils.GetValueAsInt(xmlConfig, "PopulationSize");
            _specieCount             = XmlUtils.GetValueAsInt(xmlConfig, "SpecieCount");
            _activationScheme        = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation");
            _complexityRegulationStr = XmlUtils.TryGetValueAsString(xmlConfig, "ComplexityRegulationStrategy");
            _complexityThreshold     = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold");
            _description             = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions         = ExperimentUtils.ReadParallelOptions(xmlConfig);
            ExperimentUtils.ReadRbfAuxArgMutationConfig(xmlConfig, out _rbfMutationSigmaCenter, out _rbfMutationSigmaRadius);

            _eaParams                         = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount             = _specieCount;
            _neatGenomeParams                 = new NeatGenomeParameters();
            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;
            _neatGenomeParams.ConnectionWeightMutationProbability = 0.788;
            _neatGenomeParams.AddConnectionMutationProbability    = 0.001;
            _neatGenomeParams.AddConnectionMutationProbability    = 0.01;
            _neatGenomeParams.NodeAuxStateMutationProbability     = 0.2;
            _neatGenomeParams.DeleteConnectionMutationProbability = 0.001;

            // Determine what function to regress.
            string     fnIdStr = XmlUtils.GetValueAsString(xmlConfig, "Function");
            FunctionId fnId    = (FunctionId)Enum.Parse(typeof(FunctionId), fnIdStr);

            _fn = FunctionUtils.GetFunction(fnId);

            // Read parameter sampling scheme settings.
            int    sampleResolution = XmlUtils.GetValueAsInt(xmlConfig, "SampleResolution");
            double sampleMin        = XmlUtils.GetValueAsDouble(xmlConfig, "SampleMin");
            double sampleMax        = XmlUtils.GetValueAsDouble(xmlConfig, "SampleMax");

            _paramSamplingInfo = new ParamSamplingInfo(sampleMin, sampleMax, sampleResolution);
        }
        /// <summary>
        /// Initialize the experiment with some optional XML configutation data.
        /// </summary>
        public void Initialize(string name, XmlElement xmlConfig)
        {
            _name                    = name;
            _populationSize          = XmlUtils.GetValueAsInt(xmlConfig, "PopulationSize");
            _specieCount             = XmlUtils.GetValueAsInt(xmlConfig, "SpecieCount");
            _activationScheme        = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation");
            _complexityRegulationStr = XmlUtils.TryGetValueAsString(xmlConfig, "ComplexityRegulationStrategy");
            _complexityThreshold     = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold");
            _description             = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions         = ExperimentUtils.ReadParallelOptions(xmlConfig);
            ExperimentUtils.ReadRbfAuxArgMutationConfig(xmlConfig, out _rbfMutationSigmaCenter, out _rbfMutationSigmaRadius);

            _eaParams             = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount = _specieCount;
            _neatGenomeParams     = new NeatGenomeParameters();
            _neatGenomeParams.ConnectionWeightMutationProbability = 0.788;
            _neatGenomeParams.AddConnectionMutationProbability    = 0.001;
            _neatGenomeParams.AddConnectionMutationProbability    = 0.01;
            _neatGenomeParams.NodeAuxStateMutationProbability     = 0.2;
            _neatGenomeParams.DeleteConnectionMutationProbability = 0.001;
            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;
        }