Exemple #1
0
        public virtual 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,
                                                                    "DefaultComplexityRegulationStrategy");
            _complexityThreshold = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold");
            _description         = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions     = ExperimentUtils.ReadParallelOptions(xmlConfig);

            _eaParams                         = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount             = _specieCount;
            _neatGenomeParams                 = new NeatGenomeParameters();
            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;

            DefaultComplexityRegulationStrategy = ExperimentUtils.CreateComplexityRegulationStrategy(
                _complexityRegulationStr,
                _complexityThreshold);
            DefaultSpeciationStrategy     = new KMeansClusteringStrategy <NeatGenome>(new ManhattanDistanceMetric(1.0, 0.0, 10.0));
            DefaultNeatEvolutionAlgorithm = new NeatEvolutionAlgorithm <NeatGenome>(
                NeatEvolutionAlgorithmParameters,
                DefaultSpeciationStrategy,
                DefaultComplexityRegulationStrategy);
        }
Exemple #2
0
 public BundledExperimentSettings(int population, int batchSize, NeatEvolutionAlgorithmParameters eaParams, NeatGenomeParameters genomeParams)
 {
     Population   = population;
     BatchSize    = batchSize;
     EAParams     = eaParams;
     GenomeParams = genomeParams;
 }
Exemple #3
0
        public Experiment()
        {
            this.InputCount  = 36;
            this.OutputCount = 3;

            this.eaParams                              = new NeatEvolutionAlgorithmParameters();
            this.eaParams.SpecieCount                  = 200;   // default: 10
            this.eaParams.ElitismProportion            = 0.05;  // default: 0.2
            this.eaParams.SelectionProportion          = 0.15;  // default: 0.2
            this.eaParams.OffspringAsexualProportion   = 0.7;   // default: 0.5
            this.eaParams.OffspringSexualProportion    = 0.3;   // default: 0.5
            this.eaParams.InterspeciesMatingProportion = 0.01;  // default: 0.01

            this.neatGenomeParams = new NeatGenomeParameters();
            this.neatGenomeParams.ConnectionWeightRange = 3.0;                  // default: 5
            this.neatGenomeParams.ConnectionWeightMutationProbability = 0.95;   // default: 0.94;
            this.neatGenomeParams.AddNodeMutationProbability          = 0.01;   // default: 0.01;
            this.neatGenomeParams.AddConnectionMutationProbability    = 0.075;  // default: 0.025;
            this.neatGenomeParams.DeleteConnectionMutationProbability = 0.075;  // default: 0.025;

            this.parallelOptions = new ParallelOptions();
            //this.parallelOptions.MaxDegreeOfParallelism = 8;

            this.activationScheme = NetworkActivationScheme.CreateAcyclicScheme(); //NetworkActivationScheme.CreateCyclicFixedTimestepsScheme(1);
            this.neatGenomeParams.FeedforwardOnly = this.activationScheme.AcyclicNetwork;
        }
        /// <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);

            _eaParams                              = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount                  = _specieCount;
            _eaParams.SelectionProportion          = 0.5;
            _eaParams.ElitismProportion            = 0.5;
            _eaParams.OffspringAsexualProportion   = 0.95;
            _eaParams.OffspringSexualProportion    = 0.05;
            _eaParams.InterspeciesMatingProportion = 0.00;

            _neatGenomeParams = new NeatGenomeParameters();
            _neatGenomeParams.AddConnectionMutationProbability    = 0.1;
            _neatGenomeParams.AddNodeMutationProbability          = 0.01;
            _neatGenomeParams.ConnectionWeightMutationProbability = 0.89;
            _neatGenomeParams.InitialInterconnectionsProportion   = 0.05;
        }
Exemple #5
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");

            _trialsPerEvaluation = XmlUtils.GetValueAsInt(xmlConfig, "TrialsPerEvaluation");
            _gridSize            = XmlUtils.GetValueAsInt(xmlConfig, "GridSize");
            _preyInitMoves       = XmlUtils.GetValueAsInt(xmlConfig, "PreyInitMoves");
            _preySpeed           = XmlUtils.GetValueAsDouble(xmlConfig, "PreySpeed");
            _sensorRange         = XmlUtils.GetValueAsDouble(xmlConfig, "SensorRange");
            _maxTimesteps        = XmlUtils.GetValueAsInt(xmlConfig, "MaxTimesteps");
            _description         = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions     = ExperimentUtils.ReadParallelOptions(xmlConfig);

            _eaParams                     = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount         = _specieCount;
            _eaParams.ElitismProportion   = 0.66;
            _eaParams.SelectionProportion = 0.66;

            _neatGenomeParams = new NeatGenomeParameters();
            _neatGenomeParams.ActivationFn = LeakyReLU.__DefaultInstance;
        }
Exemple #6
0
        public IEnumerator Start()
        {
            Debug.Assert(_populationSize > 5);
            Debug.Log($"Main thread is {Thread.CurrentThread.ManagedThreadId}");
            Application.runInBackground = true;

            _activationScheme = NetworkActivationScheme.CreateCyclicFixedTimestepsScheme(2, true);

            _eaParams = new NeatEvolutionAlgorithmParameters();
            _eaParams.ElitismProportion = _elitismProportion;
            _eaParams.SpecieCount       = _specieCount;

            _neatGenomeParams = new NeatGenomeParameters();
            _neatGenomeParams.AddConnectionMutationProbability    = _AddConnectionMutationProbability;
            _neatGenomeParams.DeleteConnectionMutationProbability = _DeleteConnectionMutationProbability;
            _neatGenomeParams.AddNodeMutationProbability          = _AddNodeMutationProbability;
            _neatGenomeParams.ConnectionWeightMutationProbability = _ConnectionWeightMutationProbability;
            _neatGenomeParams.InitialInterconnectionsProportion   = _InitialInterconnectionsProportion;
            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;

            Debug.Log("Creating evaluator");
            yield return(new WaitForSeconds(0.1f));

            _evaluator = CreateEvaluator();

            Debug.Log("Creating algorithm");
            yield return(new WaitForSeconds(0.1f));

            _ea              = CreateEvolutionAlgorithm(_evaluator, _populationSize);
            _ea.UpdateEvent += _ea_UpdateEvent;
        }
Exemple #7
0
        private void Initialize_private(string name, ExperimentInitArgs args)
        {
            Name        = name;
            Description = args.Description;

            _inputCount  = args.InputCount;
            _outputCount = args.OutputCount;

            DefaultPopulationSize = args.PopulationSize;

            IsHyperNEAT = args.IsHyperNEAT;
            if (args.IsHyperNEAT)
            {
                _activationSchemeCppn = GetActivationScheme_CPPN();
            }

            _activationDefinition = args.Activation;
            _activationScheme     = GetActivationScheme(args.Activation);

            _complexityRegulationStr = args.Complexity_RegulationStrategy?.ToString();
            _complexityThreshold     = args.Complexity_Threshold;

            _parallelOptions = args.MaxDegreeOfParallelism == null ?
                               new ParallelOptions() :
                               new ParallelOptions {
                MaxDegreeOfParallelism = args.MaxDegreeOfParallelism.Value
            };

            NeatEvolutionAlgorithmParameters             = new NeatEvolutionAlgorithmParameters();
            NeatEvolutionAlgorithmParameters.SpecieCount = args.SpeciesCount;
        }
    /// <summary>
    /// Initialize the experiment with some optional XML configutation data.
    /// </summary>
    public void Initialize(string name, XmlElement xmlConfig)
    {
        _name        = name;
        _description = "Just a test experiment class";

        // Dont use xml, just hard code the values for now
        _populationSize = 50;
        _specieCount    = 5;

        // PicBreeder appears to use acyclic networks, so we will do the same.
        // Cyclic ("recurrent") networks seem better for realtime reactive controllers, e.g. predator-prey, where the recurrent connections allow for memory of past events
        _activationScheme = NetworkActivationScheme.CreateAcyclicScheme();

        // Next two values just seem to be commen.
        // Relative just means that limit of complexification is relative to the last simplification process (so it can continue to grow)
        // Alternative is "Absolute", which means, with a threshold of 10, network wont ever be more complex than 10 connections
        _complexityRegulationStr = "Absolute";
        _complexityThreshold     = 50;

        //_parallelOptions = new ParallelOptions();


        // Param constructors set defaul param values, a lot of experiments just leave them as default
        _eaParams                         = new NeatEvolutionAlgorithmParameters();
        _eaParams.SpecieCount             = _specieCount;
        _neatGenomeParams                 = new NeatGenomeParameters();
        _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;
    }
Exemple #9
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);

            _eaParams             = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount = _specieCount;

            _neatGenomeParams = new NeatGenomeParameters();
            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;

            // 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");
            _complexityThreshold = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold");
            _description         = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions     = ExperimentUtils.ReadParallelOptions(xmlConfig);

            _guesses          = XmlUtils.GetValueAsInt(xmlConfig, "Guesses");
            Hashed            = XmlUtils.TryGetValueAsBool(xmlConfig, "Hashed").HasValue ? XmlUtils.GetValueAsBool(xmlConfig, "Hashed") : false;
            ValidationGuesses = XmlUtils.GetValueAsInt(xmlConfig, "ValidationGuesses");

            // Load the passwords from file
            string pwdfile = XmlUtils.TryGetValueAsString(xmlConfig, "ValidationPasswordFile");

            if (pwdfile != null)
            {
                Console.Write("Loading passwords from [{0}]...", pwdfile);
                if (_passwords == null || _passwords.Count == 0)
                {
                    int?pwLength = XmlUtils.TryGetValueAsInt(xmlConfig, "PasswordLength");
                    if (pwLength.HasValue)
                    {
                        Console.Write("Filtering to {0}-character passwords...", pwLength.Value);
                    }
                    _passwords = PasswordUtil.LoadPasswords(pwdfile, pwLength);
                }
                else
                {
                    Console.WriteLine("WARNING: Not loading passwords for experiment (already set)");
                }
            }
            else
            {
                Console.WriteLine("WARNING: Not loading passwords for experiment (not provided in config file)");
            }
            _eaParams                                          = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount                              = _specieCount;
            _neatGenomeParams                                  = new NeatGenomeParameters();
            _neatGenomeParams.FeedforwardOnly                  = false;
            _neatGenomeParams.AddNodeMutationProbability       = 0.03;
            _neatGenomeParams.AddConnectionMutationProbability = 0.05;

            // TODO: Load states from XML config file
            // Generates all the valid states in the MC using all viable ASCII characters
            var stateList = new List <string>();

            for (uint i = 32; i < 127; i++)
            {
                stateList.Add(((char)i).ToString());
            }
            stateList.Add(null);
            _states = stateList.ToArray();
            _activationFnLibrary = MarkovActivationFunctionLibrary.CreateLibraryMc(_states);
        }
        /// <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);

            _eaParams = new NeatEvolutionAlgorithmParameters();
            _eaParams.OffspringAsexualProportion = 1.0;
            _eaParams.OffspringSexualProportion  = 0.0;
            _eaParams.SpecieCount = _specieCount;
            _eaParams.InterspeciesMatingProportion = 0.0;

            _neatGenomeParams = new NeatGenomeParameters();

            if (name == "Small mutation")
            {
                // Small mutation parameters
                _neatGenomeParams.ConnectionWeightMutationProbability = 0.43;
                _neatGenomeParams.AddConnectionMutationProbability    = 0.25;
                _neatGenomeParams.AddNodeMutationProbability          = 1.0;
                _neatGenomeParams.DeleteConnectionMutationProbability = 0.003;
                _neatGenomeParams.NodeAuxStateMutationProbability     = 0.0;
                _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;
                //_neatGenomeParams.ConnectionMutationInfoList.Add(new ConnectionMutationInfo(1, ConnectionPerturbanceType.JiggleGaussian, ConnectionSelectionType.Proportional, 0.15, 0, 0.0, 0.4));
            }

            if (name == "Big mutation")
            {
                // Big mutation parameters
                _neatGenomeParams.ConnectionWeightMutationProbability = 0.65;
                _neatGenomeParams.AddConnectionMutationProbability    = 0.48;
                _neatGenomeParams.AddNodeMutationProbability          = 1.0;
                _neatGenomeParams.DeleteConnectionMutationProbability = 0.003;
                _neatGenomeParams.NodeAuxStateMutationProbability     = 0.0;
                _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;
                //_neatGenomeParams.ConnectionMutationInfoList.Add(new ConnectionMutationInfo(1, ConnectionPerturbanceType.JiggleGaussian, ConnectionSelectionType.Proportional, 0.9, 0, 0.0, 0.4));
            }

            if (name == "Novelty")
            {
                //Novelty parameters
                _neatGenomeParams.ConnectionWeightMutationProbability = 0.87;
                _neatGenomeParams.AddConnectionMutationProbability    = 0.67;
                _neatGenomeParams.AddNodeMutationProbability          = 1.0;
                _neatGenomeParams.DeleteConnectionMutationProbability = 0.003;
                _neatGenomeParams.NodeAuxStateMutationProbability     = 0.0;
                _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;
                //_neatGenomeParams.ConnectionMutationInfoList.Add(new ConnectionMutationInfo(1, ConnectionPerturbanceType.JiggleGaussian, ConnectionSelectionType.Proportional, 0.9, 0, 0.0, 0.4));
            }
        }
Exemple #12
0
        private NeatEvolutionAlgorithm <NeatGenome> GenerateTeam()
        {
            NeatEvolutionAlgorithmParameters neatParams = new NeatEvolutionAlgorithmParameters();

            IDistanceMetric distanceMetric = new ManhattanDistanceMetric(0.4, 1.0, 0.0);
            ISpeciationStrategy <NeatGenome> speciationStrategy = new ParallelKMeansClusteringStrategy <NeatGenome>(distanceMetric);

            IComplexityRegulationStrategy complexityStrategy = new NullComplexityRegulationStrategy();

            return(new NeatEvolutionAlgorithm <NeatGenome>(neatParams, speciationStrategy, complexityStrategy));
        }
Exemple #13
0
 public Module(int id, NeatEvolutionAlgorithmParameters evolutionAlgorithmParameters,
               ISpeciationStrategy <NeatGenome> speciationStrategyPitch, ISpeciationStrategy <NeatGenome> speciationStrategyRhythm,
               IComplexityRegulationStrategy complexityRegulationStrategyPitch, IComplexityRegulationStrategy complexityRegulationStrategyRhythm)
 {
     Name = "M" + id;
     Id   = id;
     //RhythmEvolutionAlgorithm = new NeatEvolutionAlgorithm<NeatGenome>(evolutionAlgorithmParameters, speciationStrategyRhythm, complexityRegulationStrategyRhythm);
     //PitchEvolutionAlgorithm = new NeatEvolutionAlgorithm<NeatGenome>(evolutionAlgorithmParameters, speciationStrategyPitch, complexityRegulationStrategyPitch);
     RhythmEvolutionAlgorithm = new ModuleNeatEvolutionAlgorithm <NeatGenome>(Name + "_R", Id, evolutionAlgorithmParameters, speciationStrategyRhythm, complexityRegulationStrategyRhythm);
     PitchEvolutionAlgorithm  = new ModuleNeatEvolutionAlgorithm <NeatGenome>(Name + "_P", Id, evolutionAlgorithmParameters, speciationStrategyPitch, complexityRegulationStrategyPitch);
 }
Exemple #14
0
        /// <summary>
        /// Creates a set of parameters based on the current set and that are suitable for the simplifying
        /// phase of the evolution algorithm when running with complexity regulation enabled.
        /// </summary>
        public NeatEvolutionAlgorithmParameters CreateSimplifyingParameters()
        {
            // Make a copy of the current 'complexifying' parameters (as required by complexity regulation)
            // and modify the copy to be suitable for simplifcation. Basically we disable sexual reproduction
            // whle in simplifying mode to prevent proliferation of structure through sexual reproduction.
            NeatEvolutionAlgorithmParameters eaParams = new NeatEvolutionAlgorithmParameters(this);

            eaParams._offspringAsexualProportion = 1.0;
            eaParams._offspringSexualProportion  = 0.0;
            return(eaParams);
        }
Exemple #15
0
 public void Initialize(string name, XmlElement xmlConfig)
 {
     NeatEvolutionAlgorithmParameters             = new NeatEvolutionAlgorithmParameters();
     NeatEvolutionAlgorithmParameters.SpecieCount = 10;
     // The NeatGenomeParameters object is passed to the NeatGenomeFactory.
     // The NeatGenomeFactory creates a NeatGenome (which is an INetworkDefinition).
     // The NeatGenome is constructed using the NeatGenomeParameters.
     // For example, the NeatGenomeParameters define what activation function to use.
     NeatGenomeParameters = new NeatGenomeParameters();
     // Create fast cyclic activation scheme with 3 evaluations for convergence
     _activationScheme = NetworkActivationScheme.CreateCyclicFixedTimestepsScheme(3, true);
 }
        /// <summary>
        ///     Creates a set of parameters based on the current set and that are suitable for the simplifying
        ///     phase of the evolution algorithm when running with complexity regulation enabled.
        /// </summary>
        public NeatEvolutionAlgorithmParameters CreateSimplifyingParameters()
        {
            // Make a copy of the current 'complexifying' parameters (as required by complexity regulation)
            // and modify the copy to be suitable for simplifcation. Basically we disable sexual reproduction
            // whle in simplifying mode to prevent proliferation of structure through sexual reproduction.
            NeatEvolutionAlgorithmParameters eaParams = new NeatEvolutionAlgorithmParameters(this)
            {
                OffspringAsexualProportion = 1.0,
                OffspringSexualProportion = 0.0
            };

            return eaParams;
        }
        /// <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");

            //snake specific params
            _swparams = SnakeUtils.GetParamsFromXml(xmlConfig);

            _trialsPerEvaluation   = XmlUtils.TryGetValueAsInt(xmlConfig, "TrialsPerEvaluation") ?? _trialsPerEvaluation;
            _maxTicksWithoutEating = XmlUtils.TryGetValueAsInt(xmlConfig, "MaxTicksWithoutEating") ?? (_swparams.Height * _swparams.Width + _swparams.TicksBetweenFood);


            _inputMapperName  = XmlUtils.TryGetValueAsString(xmlConfig, "InputMapping") ?? _inputMapperName;
            _outputMapperName = XmlUtils.TryGetValueAsString(xmlConfig, "OutputMapping") ?? _outputMapperName;

            _description     = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions = ExperimentUtils.ReadParallelOptions(xmlConfig);

            _eaParams                         = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount             = _specieCount;
            _neatGenomeParams                 = new NeatGenomeParameters();
            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;

            //string nameoftype = (string ) typeof(GridInputMapper).GetProperty("Name", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null, null);

            Type inputType = Assembly.GetAssembly(typeof(IInputMapper)).GetTypes().Where(myType => myType.IsClass && !myType.IsAbstract && (typeof(IInputMapper).IsAssignableFrom(myType)) &&
                                                                                         _inputMapperName == (string)myType.GetProperty("Name", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null, null)).First();

            _inputMapper = (IInputMapper)Activator.CreateInstance(inputType, _swparams);

            Type outputType = Assembly.GetAssembly(typeof(IOutputMapper)).GetTypes().Where(myType => myType.IsClass && !myType.IsAbstract && (typeof(IOutputMapper).IsAssignableFrom(myType)) &&
                                                                                           _outputMapperName == (string)myType.GetProperty("Name", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null, null)).First();

            _outputMapper = (IOutputMapper)Activator.CreateInstance(outputType);

            //foreach (Type type in
            //Assembly.GetAssembly(typeof(IInputMapper)).GetTypes().Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(IInputMapper) )))
            //{
            //    SnakeRunnerFactory srf = (SnakeRunnerFactory) Activator.CreateInstance(type, swOriginal);
            //    if (srf.Name == _ioLayers)
            //    {
            //        _srf = srf;
            //        break;
            //    }
            //}
        }
        /// <summary>
        ///     Copy constructor.
        /// </summary>
        public NeatEvolutionAlgorithmParameters(NeatEvolutionAlgorithmParameters copyFrom)
        {
            SpecieCount = copyFrom.SpecieCount;
            ElitismProportion = copyFrom.ElitismProportion;
            SelectionProportion = copyFrom.SelectionProportion;

            OffspringAsexualProportion = copyFrom.OffspringAsexualProportion;
            OffspringSexualProportion = copyFrom.OffspringSexualProportion;
            InterspeciesMatingProportion = copyFrom.InterspeciesMatingProportion;

            BestFitnessMovingAverageHistoryLength = copyFrom.BestFitnessMovingAverageHistoryLength;
            MeanSpecieChampFitnessMovingAverageHistoryLength = copyFrom.MeanSpecieChampFitnessMovingAverageHistoryLength;
            ComplexityMovingAverageHistoryLength = copyFrom.ComplexityMovingAverageHistoryLength;
        }
Exemple #19
0
        /// <summary>
        /// Copy constructor.
        /// </summary>
        public NeatEvolutionAlgorithmParameters(NeatEvolutionAlgorithmParameters copyFrom)
        {
            _specieCount         = copyFrom._specieCount;
            _elitismProportion   = copyFrom._elitismProportion;
            _selectionProportion = copyFrom._selectionProportion;

            _offspringAsexualProportion   = copyFrom._offspringAsexualProportion;
            _offspringSexualProportion    = copyFrom._offspringSexualProportion;
            _interspeciesMatingProportion = copyFrom._interspeciesMatingProportion;

            _bestFitnessMovingAverageHistoryLength            = copyFrom._bestFitnessMovingAverageHistoryLength;
            _meanSpecieChampFitnessMovingAverageHistoryLength = copyFrom._meanSpecieChampFitnessMovingAverageHistoryLength;
            _complexityMovingAverageHistoryLength             = copyFrom._complexityMovingAverageHistoryLength;
        }
        /// <summary>
        /// Copy constructor.
        /// </summary>
        public NeatEvolutionAlgorithmParameters(NeatEvolutionAlgorithmParameters copyFrom)
        {
            _specieCount = copyFrom._specieCount;
            _elitismProportion = copyFrom._elitismProportion;
            _selectionProportion = copyFrom._selectionProportion;

            _offspringAsexualProportion = copyFrom._offspringAsexualProportion;
            _offspringSexualProportion = copyFrom._offspringSexualProportion;
            _interspeciesMatingProportion = copyFrom._interspeciesMatingProportion;

            _bestFitnessMovingAverageHistoryLength = copyFrom._bestFitnessMovingAverageHistoryLength;
            _meanSpecieChampFitnessMovingAverageHistoryLength = copyFrom._meanSpecieChampFitnessMovingAverageHistoryLength;
            _complexityMovingAverageHistoryLength = copyFrom._complexityMovingAverageHistoryLength;
        }
Exemple #21
0
 public ModuleNeatEvolutionAlgorithm(String name, int id,
                                     NeatEvolutionAlgorithmParameters evolutionAlgorithmParameters,
                                     ISpeciationStrategy <TGenome> speciationStrategy,
                                     IComplexityRegulationStrategy complexityRegulationStrategy)
     : base(evolutionAlgorithmParameters, speciationStrategy, complexityRegulationStrategy)
 {
     Name            = name;
     Id              = id;
     NextParasite    = 0;
     ParasiteGenomes = new List <TGenome> [MusicEnvironment.MODULE_COUNT - 1];
     for (int i = 0; i < ParasiteGenomes.Length; i++)
     {
         ParasiteGenomes[i] = new List <TGenome>();
     }
 }
Exemple #22
0
        /// <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);

            _eaParams             = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount = _specieCount;
            _neatGenomeParams     = new NeatGenomeParameters();
        }
    private void Start()
    {
        int populationSize = 100;
        NetworkActivationScheme activationScheme = NetworkActivationScheme.CreateAcyclicScheme();

        NeatGenomeParameters neatParams = new NeatGenomeParameters();

        neatParams.ActivationFn    = TanH.__DefaultInstance;
        neatParams.FeedforwardOnly = activationScheme.AcyclicNetwork;

        IGenomeDecoder <NeatGenome, IBlackBox> neatDecoder = new NeatGenomeDecoder(activationScheme);

        IGenomeFactory <NeatGenome> neatFactory = new NeatGenomeFactory(3, 3, neatParams);
        List <NeatGenome>           genomeList  = neatFactory.CreateGenomeList(populationSize, 0);
        ArenaEvaluator evaluator = GetComponent <ArenaEvaluator>();

        evaluator.Initialize(neatDecoder);

        IDistanceMetric distanceMetric = new ManhattanDistanceMetric(1.0, 0.0, 10.0);

        // Evolution parameters
        NeatEvolutionAlgorithmParameters neatEvolutionParams = new NeatEvolutionAlgorithmParameters();

        neatEvolutionParams.SpecieCount = 10;
        ISpeciationStrategy <NeatGenome> speciationStrategy           = new KMeansClusteringStrategy <NeatGenome>(distanceMetric);
        IComplexityRegulationStrategy    complexityRegulationStrategy = new DefaultComplexityRegulationStrategy(ComplexityCeilingType.Absolute, 10);

        NeatEvolutionAlgorithm <NeatGenome> ea = GetComponent <UnityEvolutionAlgorithm>();

        ea.Construct(neatEvolutionParams, speciationStrategy, complexityRegulationStrategy, new NullGenomeListEvaluator <NeatGenome, IBlackBox>());
        ea.Initialize(evaluator, neatFactory, genomeList);
        ea.UpdateScheme = new UpdateScheme(1); // This needs to be set AFTER Initialize is called

        ea.PausedEvent += (sender, e) =>
        {
            //ea.StartContinue();
        };
        ea.GenerationEvent += (sender, gen) =>
        {
            Debug.Log($"Generation {gen}");
            Debug.Log($"Highest fitness: {ea.CurrentChampGenome.EvaluationInfo.Fitness}");
            nnMesh.GenerateMesh(ea.CurrentChampGenome);
            ea.RequestPause();
            StartCoroutine(PauseRoutine(ea));
        };

        ea.StartContinue();
    }
    public void Initialize(string name, XmlElement xmlConfig, int input, int output, int populationSize, int specieCount)
    {
        _name                    = name;
        _populationSize          = populationSize; //XmlUtils.GetValueAsInt(xmlConfig, "PopulationSize");
        _specieCount             = 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");

        _eaParams                         = new NeatEvolutionAlgorithmParameters();
        _eaParams.SpecieCount             = _specieCount;
        _neatGenomeParams                 = new NeatGenomeParameters();
        _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;

        _inputCount  = input;
        _outputCount = output;
    }
Exemple #25
0
        public void Initialize(string name, XmlElement xmlConfig)
        {
            // Read these from Domain XML file

            _name                    = name;
            _populationSize          = XmlUtils.GetValueAsInt(xmlConfig, "PopulationSize");
            _specieCount             = XmlUtils.GetValueAsInt(xmlConfig, "SpecieCount");
            _activationSchemeCppn    = ExperimentUtils.CreateActivationScheme(xmlConfig, "ActivationCppn");
            _activationScheme        = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation");
            _complexityRegulationStr = XmlUtils.TryGetValueAsString(xmlConfig, "ComplexityRegulationStrategy");
            _complexityThreshold     = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold");
            _description             = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions         = ExperimentUtils.ReadParallelOptions(xmlConfig);
            _parallelOptions.MaxDegreeOfParallelism = Environment.ProcessorCount / 2;


            _visualFieldResolution = XmlUtils.GetValueAsInt(xmlConfig, "Resolution");
            _visualFieldPixelCount = _visualFieldResolution * _visualFieldResolution;
            _lengthCppnInput       = XmlUtils.GetValueAsBool(xmlConfig, "LengthCppnInput");

            _eaParams             = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount = _specieCount;

            // Set these manually, use a high mutator just to test the water

            _neatGenomeParams = new NeatGenomeParameters()
            {
                AddConnectionMutationProbability    = 0.10,
                DeleteConnectionMutationProbability = 0.10,
                ConnectionWeightMutationProbability = 0.90,
                AddNodeMutationProbability          = 0.05,
                InitialInterconnectionsProportion   = 0.10
            };

            // Clear OUTPUT and FITNESS directories before starting
            var directory = new DirectoryInfo(Constants.OUTPUT_DIR);

            directory.Empty();
            directory = new DirectoryInfo(Constants.FITNESS_DIR);
            directory.Empty();
            directory = new DirectoryInfo(Constants.PLOTS_DIR);
            directory.Empty();
        }
Exemple #26
0
        /// <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");
            _activationSchemeCppn    = ExperimentUtils.CreateActivationScheme(xmlConfig, "ActivationCppn");
            _activationScheme        = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation");
            _complexityRegulationStr = XmlUtils.TryGetValueAsString(xmlConfig, "ComplexityRegulationStrategy");
            _complexityThreshold     = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold");
            _description             = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions         = ExperimentUtils.ReadParallelOptions(xmlConfig);
            _lengthCppnInput         = XmlUtils.GetValueAsBool(xmlConfig, "LengthCppnInput");

            _eaParams                         = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount             = _specieCount;
            _neatGenomeParams                 = new NeatGenomeParameters();
            _neatGenomeParams.FeedforwardOnly = _activationSchemeCppn.AcyclicNetwork;
            _neatGenomeParams.InitialInterconnectionsProportion = 0.5;
        }
Exemple #27
0
        public void Initialize(string name, XmlElement xmlConfig)
        {
            Name = name;
            DefaultPopulationSize    = 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);

            NeatEvolutionAlgorithmParameters = new NeatEvolutionAlgorithmParameters {
                SpecieCount = _specieCount
            };
            NeatGenomeParameters = new NeatGenomeParameters {
                FeedforwardOnly = _activationScheme.AcyclicNetwork
            };
//            var figterType = XmlUtils.TryGetValueAsString(xmlConfig, "Figter");
//            var type = Type.GetType(figterType);
        }
Exemple #28
0
        public BattleExperiment()
        {
            _activationScheme = NetworkActivationScheme.CreateCyclicFixedTimestepsScheme(2, true);

            _eaParams = new NeatEvolutionAlgorithmParameters();

            _neatGenomeParams = new NeatGenomeParameters();

            SharpNeat.Network.SReLU func = (SharpNeat.Network.SReLU) new SharpNeat.Network.SReLU();
            func.SetParameters(-0.8, 0.8, 0.05);

            _neatGenomeParams.ActivationFn = func;
            _neatGenomeParams.AddConnectionMutationProbability    = 0.7;
            _neatGenomeParams.AddNodeMutationProbability          = 0.2;
            _neatGenomeParams.DeleteConnectionMutationProbability = 0.4;
            _neatGenomeParams.ConnectionWeightMutationProbability = 0.94;
            _neatGenomeParams.InitialInterconnectionsProportion   = 0;

            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;
        }
Exemple #29
0
        /// <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.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);

            _func = FunctionRegressionEvaluator.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");

            int paramCount = _func.InputCount;

            _paramSamplingInfoArr = new ParameterSamplingInfo[paramCount];
            for (int i = 0; i < paramCount; i++)
            {
                _paramSamplingInfoArr[i] = new ParameterSamplingInfo(sampleMin, sampleMax, sampleResolution);
            }
        }
 public void Initialize(string name, XmlElement xmlConfig, string givenUserName)
 {
     _name           = name;
     _populationSize = XmlUtils.GetValueAsInt(xmlConfig, "PopulationSize");
     ActiveUsersList <NeatGenome> .PopulationSize = _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");
     ActiveUsersList <NeatGenome> .MaxNumberOfUsers =
         XmlUtils.GetValueAsInt(xmlConfig, "MaxSimultaneousUsers");
     ActiveUsersList <NeatGenome> .PortsPerUser =
         XmlUtils.GetValueAsInt(xmlConfig, "PortsPerUser");
     _parallelOptions      = ExperimentUtils.ReadParallelOptions(xmlConfig);
     _eaParams             = new NeatEvolutionAlgorithmParameters();
     _eaParams.SpecieCount = _specieCount;
     _neatGenomeParams     = new NeatGenomeParameters();
     System.Diagnostics.Debug.Assert(CheckActivationScheme(_activationScheme));
     userName = givenUserName;
 }
        /// <summary>
        /// Initialize the experiment with some optional XML configuration data.
        /// </summary>
        public void Initialize(string name, XmlElement xmlConfig)
        {
            T GetValueAsEnum <T>(string e)
            {
                string r = XmlUtils.GetValueAsString(xmlConfig, e);

                return((T)System.Enum.Parse(typeof(T), r));
            }

            _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");

            _numberOfGames = XmlUtils.GetValueAsInt(xmlConfig, "IPDGames");
            int seed    = XmlUtils.GetValueAsInt(xmlConfig, "RandomPlayerSeed");
            int randoms = XmlUtils.GetValueAsInt(xmlConfig, "RandomPlayerCount");

            string os = XmlUtils.TryGetValueAsString(xmlConfig, "StaticOpponents");

            _opponentPool = CreatePool(seed, randoms, (os == null) ? new Opponent[0] : System.Array.ConvertAll(os.Split(','), (string o) => { return((Opponent)System.Enum.Parse(typeof(Opponent), o, true)); }));

            _evaluationLimit = (ulong)XmlUtils.GetValueAsInt(xmlConfig, "EvaluationLimit");
            _evaluationMode  = GetValueAsEnum <EvaluationMode>("EvaluationMode");
            _noveltyMetric   = GetValueAsEnum <NoveltyMetric>("NoveltyMetric");
            _noveltyK        = XmlUtils.GetValueAsInt(xmlConfig, "NoveltyK");

            _randomRobustCheck = XmlUtils.GetValueAsInt(xmlConfig, "RandomRobustCheck");
            _pastInputReach    = XmlUtils.GetValueAsInt(xmlConfig, "PastInputReach");

            _description     = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions = ExperimentUtils.ReadParallelOptions(xmlConfig);

            _eaParams                         = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount             = _specieCount;
            _neatGenomeParams                 = new NeatGenomeParameters();
            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;
        }
Exemple #32
0
        public NeatExperiment(Simulation simulation)
        {
            _simulation = simulation;

            _name                    = "Trader";
            _populationSize          = 100;
            _specieCount             = 1;
            _activationScheme        = NetworkActivationScheme.CreateAcyclicScheme();
            _complexityRegulationStr = "Relative";
            _complexityThreshold     = 10;
            _description             = "Generate trader neural network";
            _parallelOptions         = new ParallelOptions {
                MaxDegreeOfParallelism = 2
            };

            UnityThread.SetUnityValue(() => _inputCount = 6 + UnityEngine.Object.FindObjectsOfType <Coin>().Length * 5);

            _outputCount = 8;

            _eaParams             = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount = _specieCount;

            _neatGenomeParams = new NeatGenomeParameters();
            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;
            //_neatGenomeParams.ActivationFn = LeakyReLU.__DefaultInstance;
            _neatGenomeParams.ActivationFn = SharpNeat.Network.SReLU.__DefaultInstance;
            // Create a genome factory with our neat genome parameters object and the appropriate number of input and output neuron genes.
            _genomeFactory = CreateGenomeFactory();

            // Create an initial population of randomly generated genomes.
            _genomeList = _genomeFactory.CreateGenomeList(_populationSize, 0);

            // Create evolution algorithm and attach update event.
            _ea = CreateEvolutionAlgorithm(_genomeFactory, _genomeList);
            // _ea.UpdateEvent += new EventHandler(ea_UpdateEvent);

            // Start algorithm (it will run on a background thread).
            _ea.StartContinue();
        }
        /// <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;
        }