public NSGAII(MultiObjectiveParameters multiObjectiveParameters) { _params = multiObjectiveParameters; }
/// <summary> /// Initialize the experiment with some optional XML configutation data. /// </summary> public virtual void Initialize(string name, XmlElement xmlConfig) { _name = name; _description = XmlUtils.TryGetValueAsString(xmlConfig, "Description") ?? ""; _comment = XmlUtils.TryGetValueAsString(xmlConfig, "Comment") ?? ""; _populationSize = XmlUtils.TryGetValueAsInt(xmlConfig, "PopulationSize") ?? 100; _maxGenerations = XmlUtils.TryGetValueAsInt(xmlConfig, "MaxGenerations") ?? 1000; _activationScheme = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation"); SeedGenome = XmlUtils.TryGetValueAsString(xmlConfig, "SeedGenome"); try { _complexityRegulationStrategy = ExperimentUtils.CreateComplexityRegulationStrategy(xmlConfig, "ComplexityRegulation"); } catch (ArgumentException e) { _logger.Warn(e.Message); } _parallelOptions = ExperimentUtils.ReadParallelOptions(xmlConfig); _multiThreading = XmlUtils.TryGetValueAsBool(xmlConfig, "MultiThreading") ?? true; _logInterval = XmlUtils.TryGetValueAsInt(xmlConfig, "LogInterval") ?? 10; // Evolutionary algorithm parameters _eaParams = new NeatEvolutionAlgorithmParameters(); XmlElement xmlEAParams = xmlConfig.SelectSingleNode("EAParams") as XmlElement; if (xmlEAParams != null) { _eaParams.SpecieCount = XmlUtils.GetValueAsInt(xmlEAParams, "SpecieCount"); _eaParams.ElitismProportion = XmlUtils.GetValueAsDouble(xmlEAParams, "ElitismProportion"); _eaParams.SelectionProportion = XmlUtils.GetValueAsDouble(xmlEAParams, "SelectionProportion"); _eaParams.OffspringAsexualProportion = XmlUtils.GetValueAsDouble(xmlEAParams, "OffspringAsexualProportion"); _eaParams.OffspringSexualProportion = XmlUtils.GetValueAsDouble(xmlEAParams, "OffspringSexualProportion"); _eaParams.InterspeciesMatingProportion = XmlUtils.GetValueAsDouble(xmlEAParams, "InterspeciesMatingProportion"); } else { _logger.Info("EA parameters not found. Using default."); } // NEAT Genome parameters _neatGenomeParams = new NeatGenomeParameters(); // Prevent recurrent connections if the activation scheme is acyclic _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork; XmlElement xmlGenomeParams = xmlConfig.SelectSingleNode("GenomeParams") as XmlElement; if (xmlGenomeParams != null) { _neatGenomeParams.ConnectionWeightRange = XmlUtils.GetValueAsDouble(xmlGenomeParams, "ConnectionWeightRange"); _neatGenomeParams.InitialInterconnectionsProportion = XmlUtils.GetValueAsDouble(xmlGenomeParams, "InitialInterconnectionsProportion"); _neatGenomeParams.DisjointExcessGenesRecombinedProbability = XmlUtils.GetValueAsDouble(xmlGenomeParams, "DisjointExcessGenesRecombinedProbability"); _neatGenomeParams.ConnectionWeightMutationProbability = XmlUtils.GetValueAsDouble(xmlGenomeParams, "ConnectionWeightMutationProbability"); _neatGenomeParams.AddNodeMutationProbability = XmlUtils.GetValueAsDouble(xmlGenomeParams, "AddNodeMutationProbability"); _neatGenomeParams.AddConnectionMutationProbability = XmlUtils.GetValueAsDouble(xmlGenomeParams, "AddConnectionMutationProbability"); _neatGenomeParams.DeleteConnectionMutationProbability = XmlUtils.GetValueAsDouble(xmlGenomeParams, "DeleteConnectionMutationProbability"); } else { _logger.Info("Genome parameters not found. Using default."); } XmlElement xmlNoveltySearchParams = xmlConfig.SelectSingleNode("NoveltySearch") as XmlElement; if (xmlNoveltySearchParams != null) { _noveltySearchParams = NoveltySearchParameters.ReadXmlProperties(xmlNoveltySearchParams); } else { _logger.Info("Novelty search parameters not found"); } XmlElement xmlMultiObjectiveParams = xmlConfig.SelectSingleNode("MultiObjective") as XmlElement; if (xmlMultiObjectiveParams != null) { _multiObjectiveParams = MultiObjectiveParameters.ReadXmlProperties(xmlMultiObjectiveParams); } else { _logger.Info("Multi objective parameters not found"); } // Create IBlackBox evaluator. _evaluator = new TEvaluator(); _evaluator.Initialize(xmlConfig); _evaluator.NoveltySearchParameters = _noveltySearchParams; }