/// <summary> /// Constructs and initializes the maze navigator initialization algorithm (fitness using generational selection). In /// particular, this sets additional novelty search configuration parameters. /// </summary> /// <param name="xmlConfig">The XML configuration for the initialization algorithm.</param> /// <param name="isAcyclic">Flag indicating whether the network is acyclic (i.e. does not have recurrent connections).</param> /// <param name="numSuccessfulAgents">The minimum number of successful maze navigators that must be produced.</param> /// <param name="numUnsuccessfulAgents">The minimum number of unsuccessful maze navigators that must be produced.</param> /// <returns>The constructed initialization algorithm.</returns> public override void SetAlgorithmParameters(XmlElement xmlConfig, bool isAcyclic, int numSuccessfulAgents, int numUnsuccessfulAgents) { // Set the boiler plate MCC parameters and minimal criterions base.SetAlgorithmParameters(xmlConfig, isAcyclic, numSuccessfulAgents, numUnsuccessfulAgents); // Read in the behavior characterization _behaviorCharacterizationFactory = ExperimentUtils.ReadBehaviorCharacterizationFactory(xmlConfig, "InitBehaviorConfig"); // Read in the novelty archive parameters ExperimentUtils.ReadNoveltyParameters(xmlConfig, out _archiveAdditionThreshold, out _archiveThresholdDecreaseMultiplier, out _archiveThresholdIncreaseMultiplier, out _maxGenerationArchiveAddition, out _maxGenerationsWithoutArchiveAddition); // Read in nearest neighbors for behavior distance calculations _nearestNeighbors = XmlUtils.GetValueAsInt(xmlConfig, "NearestNeighbors"); // Read in steady-state specific parameters _batchSize = XmlUtils.GetValueAsInt(xmlConfig, "OffspringBatchSize"); _populationEvaluationFrequency = XmlUtils.GetValueAsInt(xmlConfig, "PopulationEvaluationFrequency"); }
/// <inheritdoc /> /// <summary> /// Initializes the MCC maze navigation experiment by reading in all of the configuration parameters and /// setting up the bootstrapping/initialization algorithm. /// </summary> /// <param name="name">The name of the experiment.</param> /// <param name="xmlConfig">The reference to the XML configuration file.</param> /// <param name="population1EvolutionLogger">The navigator evolution data logger.</param> /// <param name="population1PopulationLogger">The navigator population logger.</param> /// <param name="population1GenomeLogger">The navigator genome logger.</param> /// <param name="population2EvolutionLogger">The maze evolution data logger.</param> /// <param name="population2PopulationLogger">The maze population logger.</param> /// <param name="population2GenomeLogger">The maze genome logger.</param> public virtual void Initialize(string name, XmlElement xmlConfig, IDataLogger population1EvolutionLogger = null, IDataLogger population1PopulationLogger = null, IDataLogger population1GenomeLogger = null, IDataLogger population2EvolutionLogger = null, IDataLogger population2PopulationLogger = null, IDataLogger population2GenomeLogger = null) { // Set boiler plate properties Name = name; Description = XmlUtils.GetValueAsString(xmlConfig, "Description"); ActivationScheme = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation"); ParallelOptions = ExperimentUtils.ReadParallelOptions(xmlConfig); // Set the genome parameters NeatGenomeParameters = ExperimentUtils.ReadNeatGenomeParameters(xmlConfig); NeatGenomeParameters.FeedforwardOnly = ActivationScheme.AcyclicNetwork; MazeGenomeParameters = ExperimentUtils.ReadMazeGenomeParameters(xmlConfig); // Configure evolutionary algorithm parameters AgentDefaultPopulationSize = XmlUtils.GetValueAsInt(xmlConfig, "AgentPopulationSize"); MazeDefaultPopulationSize = XmlUtils.GetValueAsInt(xmlConfig, "MazePopulationSize"); AgentSeedGenomeCount = XmlUtils.GetValueAsInt(xmlConfig, "AgentSeedGenomeCount"); MazeSeedGenomeCount = XmlUtils.GetValueAsInt(xmlConfig, "MazeSeedGenomeCount"); AgentNumSpecies = XmlUtils.GetValueAsInt(xmlConfig, "AgentNumSpecies"); MazeNumSpecies = XmlUtils.GetValueAsInt(xmlConfig, "MazeNumSpecies"); BehaviorCharacterizationFactory = ExperimentUtils.ReadBehaviorCharacterizationFactory(xmlConfig, "BehaviorConfig"); NavigatorBatchSize = XmlUtils.GetValueAsInt(xmlConfig, "NavigatorOffspringBatchSize"); MazeBatchSize = XmlUtils.GetValueAsInt(xmlConfig, "MazeOffspringBatchSize"); // Set run-time bounding parameters MaxGenerations = XmlUtils.TryGetValueAsInt(xmlConfig, "MaxGenerations"); MaxEvaluations = XmlUtils.TryGetValueAsULong(xmlConfig, "MaxEvaluations"); // Set experiment-specific parameters MinSuccessDistance = XmlUtils.GetValueAsInt(xmlConfig, "MinSuccessDistance"); MazeHeight = XmlUtils.GetValueAsInt(xmlConfig, "MazeHeight"); MazeWidth = XmlUtils.GetValueAsInt(xmlConfig, "MazeWidth"); MazeQuadrantHeight = XmlUtils.GetValueAsInt(xmlConfig, "MazeQuadrantHeight"); MazeQuadrantWidth = XmlUtils.GetValueAsInt(xmlConfig, "MazeQuadrantWidth"); MazeScaleMultiplier = XmlUtils.GetValueAsInt(xmlConfig, "MazeScaleMultiplier"); // Get success/failure criteria constraints NumMazeSuccessCriteria = XmlUtils.GetValueAsInt(xmlConfig, "NumMazesSolvedCriteria"); NumAgentSuccessCriteria = XmlUtils.GetValueAsInt(xmlConfig, "NumAgentsSolvedCriteria"); NumAgentFailedCriteria = XmlUtils.GetValueAsInt(xmlConfig, "NumAgentsFailedCriteria"); // Read in the maximum number of initialization evaluations _maxInitializationEvaluations = XmlUtils.GetValueAsUInt(xmlConfig, "MaxInitializationEvaluations"); // Initialize the initialization algorithm _mazeNavigationInitializer = ExperimentUtils.DetermineMCCInitializer( xmlConfig.GetElementsByTagName("InitializationAlgorithmConfig", "")[0] as XmlElement); // Setup initialization algorithm _mazeNavigationInitializer.SetAlgorithmParameters( xmlConfig.GetElementsByTagName("InitializationAlgorithmConfig", "")[0] as XmlElement, ActivationScheme.AcyclicNetwork, NumAgentSuccessCriteria, 0); // Pass in maze experiment specific parameters // (note that a new maze structure is created here for the sole purpose of extracting the maze dimensions and calculating max distance to target) _mazeNavigationInitializer.SetEnvironmentParameters(MinSuccessDistance, new MazeDecoder(MazeScaleMultiplier).Decode( new MazeGenomeFactory(MazeGenomeParameters, MazeHeight, MazeWidth, MazeQuadrantHeight, MazeQuadrantWidth).CreateGenome(0))); // The size of the randomly generated agent genome pool from which to evolve agent bootstraps AgentInitializationGenomeCount = _mazeNavigationInitializer.PopulationSize; }