/// <summary>
 ///     Sets configuration variables specific to the maze navigation simulation.
 /// </summary>
 /// <param name="maxDistanceToTarget">The maximum distance possible from the target location.</param>
 /// <param name="maxTimesteps">The maximum number of time steps for which to run the simulation.</param>
 /// <param name="mazeVariant">The maze variant to run (i.e. medium/hard maze).</param>
 /// <param name="minSuccessDistance">The minimum distance to the target location for the maze to be considered "solved".</param>
 public void SetEnvironmentParameters(int maxDistanceToTarget, int maxTimesteps, MazeVariant mazeVariant,
     int minSuccessDistance)
 {
     // Set boiler plate environment parameters
     base.SetEnvironmentParameters(maxDistanceToTarget, maxTimesteps, minSuccessDistance);
     _mazeVariant = mazeVariant;
 }
        /// <summary>
        ///     Initialize the experiment with configuration file parameters.
        /// </summary>
        /// <param name="name">The name of the experiment</param>
        /// <param name="xmlConfig">The parent XML configuration element</param>
        /// <param name="evolutionDataLogger">The optional evolution data logger.</param>
        /// <param name="evaluationDataLogger">The optional evaluation data logger.</param>
        public virtual void Initialize(string name, XmlElement xmlConfig, IDataLogger evolutionDataLogger,
            IDataLogger evaluationDataLogger)
        {
            // Set all properties
            Name = name;
            DefaultPopulationSize = XmlUtils.TryGetValueAsInt(xmlConfig, "PopulationSize") ?? default(int);
            Description = XmlUtils.GetValueAsString(xmlConfig, "Description");

            // Set all internal class variables
            _activationScheme = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation");
            ComplexityRegulationStrategy = XmlUtils.TryGetValueAsString(xmlConfig, "ComplexityRegulationStrategy");
            Complexitythreshold = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold");
            ParallelOptions = ExperimentUtils.ReadParallelOptions(xmlConfig);
            SerializeGenomeToXml = XmlUtils.TryGetValueAsBool(xmlConfig, "DecodeGenomesToXml") ?? false;
            MaxGenerations = XmlUtils.TryGetValueAsInt(xmlConfig, "MaxGenerations");
            MaxEvaluations = XmlUtils.TryGetValueAsULong(xmlConfig, "MaxEvaluations");
            MaxRestarts = XmlUtils.TryGetValueAsInt(xmlConfig, "MaxRestarts");

            // Set evolution/genome parameters
            NeatEvolutionAlgorithmParameters = ExperimentUtils.ReadNeatEvolutionAlgorithmParameters(xmlConfig);
            NeatGenomeParameters = ExperimentUtils.ReadNeatGenomeParameters(xmlConfig);
            NeatGenomeParameters.FeedforwardOnly = _activationScheme.AcyclicNetwork;

            // Set experiment-specific parameters
            MaxTimesteps = XmlUtils.GetValueAsInt(xmlConfig, "MaxTimesteps");
            MinSuccessDistance = XmlUtils.GetValueAsInt(xmlConfig, "MinSuccessDistance");
            MaxDistanceToTarget = XmlUtils.GetValueAsInt(xmlConfig, "MaxDistanceToTarget");
            MazeVariant =
                MazeVariantUtil.convertStringToMazeVariant(XmlUtils.TryGetValueAsString(xmlConfig, "MazeVariant"));
        }
        /// <summary>
        ///     Initialize the experiment with database configuration parameters.
        /// </summary>
        /// <param name="experimentDictionary">The handle to the experiment dictionary row pulled from the database.</param>
        public virtual void Initialize(ExperimentDictionary experimentDictionary)
        {
            // Set all properties
            Name = experimentDictionary.ExperimentName;
            DefaultPopulationSize = experimentDictionary.Primary_PopulationSize;
            Description = experimentDictionary.ExperimentName;

            // Set all internal class variables
            _activationScheme = NetworkActivationScheme.CreateAcyclicScheme();
            ComplexityRegulationStrategy = experimentDictionary.Primary_ComplexityRegulationStrategy;
            Complexitythreshold = experimentDictionary.Primary_ComplexityThreshold;
            ParallelOptions = new ParallelOptions();
            SerializeGenomeToXml = experimentDictionary.SerializeGenomeToXml;
            MaxEvaluations = (ulong) experimentDictionary.MaxEvaluations;
            MaxRestarts = experimentDictionary.MaxRestarts;

            // Set evolution/genome parameters
            NeatEvolutionAlgorithmParameters = ExperimentUtils.ReadNeatEvolutionAlgorithmParameters(
                experimentDictionary, true);
            NeatGenomeParameters = ExperimentUtils.ReadNeatGenomeParameters(experimentDictionary, true);
            NeatGenomeParameters.FeedforwardOnly = _activationScheme.AcyclicNetwork;

            // Set experiment-specific parameters
            MaxTimesteps = experimentDictionary.MaxTimesteps;
            MinSuccessDistance = experimentDictionary.MinSuccessDistance;
            MaxDistanceToTarget = experimentDictionary.MaxDistanceToTarget ?? default(int);
            MazeVariant = MazeVariantUtil.convertStringToMazeVariant(experimentDictionary.ExperimentDomainName);
        }
        /// <summary>
        ///     Initialize the experiment with configuration file parameters.
        /// </summary>
        /// <param name="name">The name of the experiment</param>
        /// <param name="xmlConfig">The parent XML configuration element</param>
        public virtual void Initialize(string name, XmlElement xmlConfig)
        {
            // Set all properties
            Name = name;
            DefaultPopulationSize = XmlUtils.GetValueAsInt(xmlConfig, "PopulationSize");
            Description = XmlUtils.GetValueAsString(xmlConfig, "Description");

            // Set all internal class variables
            _activationScheme = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation");
            ComplexityRegulationStrategy = XmlUtils.TryGetValueAsString(xmlConfig, "ComplexityRegulationStrategy");
            Complexitythreshold = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold");
            ParallelOptions = ExperimentUtils.ReadParallelOptions(xmlConfig);

            // Set evolution/genome parameters
            NeatEvolutionAlgorithmParameters = new NeatEvolutionAlgorithmParameters
            {
                SpecieCount = XmlUtils.GetValueAsInt(xmlConfig, "SpecieCount"),
                InterspeciesMatingProportion = XmlUtils.GetValueAsDouble(xmlConfig,
                    "InterspeciesMatingProbability"),
                MinTimeAlive = XmlUtils.GetValueAsInt(xmlConfig, "MinTimeAlive")
            };
            NeatGenomeParameters = ExperimentUtils.ReadNeatGenomeParameters(xmlConfig);

            // Set experiment-specific parameters
            MaxTimesteps = XmlUtils.TryGetValueAsInt(xmlConfig, "MaxTimesteps");
            MinSuccessDistance = XmlUtils.TryGetValueAsInt(xmlConfig, "MinSuccessDistance");
            MaxDistanceToTarget = XmlUtils.TryGetValueAsInt(xmlConfig, "MaxDistanceToTarget");
            MazeVariant =
                MazeVariantUtl.convertStringToMazeVariant(XmlUtils.TryGetValueAsString(xmlConfig, "MazeVariant"));         
        }