/// <inheritdoc /> public void Init(IEvolutionaryAlgorithm theOwner) { _owner = theOwner; foreach (var obj in _components.Contents) { obj.obj.Init(theOwner); } }
/// <inheritdoc /> public void Init(IEvolutionaryAlgorithm theOwner) { _owner = theOwner; foreach (var obj in _components.Contents) { obj.obj.Init(theOwner); } }
UsingEvaluation <TIndividual, TGeneStructure, TGene>( this IEvolutionaryAlgorithm <TIndividual, TGeneStructure, TGene> algo, IFitness <TIndividual, TGeneStructure, TGene> fitness) where TIndividual : IIndividual <TGeneStructure, TGene> where TGeneStructure : ICloneable { algo.Fitness = fitness; return(algo); }
UsingStatistics <TIndividual, TGeneStructure, TGene>( this IEvolutionaryAlgorithm <TIndividual, TGeneStructure, TGene> algo, IEvolutionaryStatistics <TIndividual, TGeneStructure, TGene> statistics) where TIndividual : IIndividual <TGeneStructure, TGene> where TGeneStructure : ICloneable { algo.Statistics = statistics; return(algo); }
UsingPopulation <TIndividual, TGeneStructure, TGene>( this IEvolutionaryAlgorithm <TIndividual, TGeneStructure, TGene> algo, IPopulation <TIndividual, TGeneStructure, TGene> initialPopulation) where TIndividual : IIndividual <TGeneStructure, TGene> where TGeneStructure : ICloneable { algo.Population = initialPopulation; return(algo); }
UsingParameters <TIndividual, TGeneStructure, TGene>( this IEvolutionaryAlgorithm <TIndividual, TGeneStructure, TGene> algo, IParameters parameters) where TIndividual : IIndividual <TGeneStructure, TGene> where TGeneStructure : ICloneable { algo.Parameters = parameters; return(algo); }
/// <inheritdoc/> public void Init(IEvolutionaryAlgorithm theOwner) { _owner = theOwner; foreach (ObjectHolder <IEvolutionaryOperator> obj in _components .ObjList) { obj.Obj.Init(theOwner); } }
UsingHeuristic <TIndividual, TGeneStructure, TGene>( this IEvolutionaryAlgorithm <TIndividual, TGeneStructure, TGene> algo, IHyperHeuristic <TIndividual, TGeneStructure, TGene> heuristic) where TIndividual : IIndividual <TGeneStructure, TGene> where TGeneStructure : ICloneable { algo.HyperHeuristic = heuristic; return(algo); }
/// <inheritdoc/> public void Init(IEvolutionaryAlgorithm theOwner) { _owner = theOwner; foreach (ObjectHolder<IEvolutionaryOperator> obj in _components .ObjList) { obj.Obj.Init(theOwner); } }
public void ResetTraining() { Substrate substrate = SubstrateFactory.factorSandwichSubstrate(11, 11); BoxesScore score = new BoxesScore(11); pop = new NEATPopulation(substrate, 500); pop.ActivationCycles = 4; pop.Reset(); train = NEATUtil.ConstructNEATTrainer(pop, score); OriginalNEATSpeciation speciation = new OriginalNEATSpeciation(); train.Speciation = new OriginalNEATSpeciation(); }
private void Validate(NEATPopulation pop) { Assert.AreEqual(10, pop.PopulationSize); Assert.AreEqual(0.2, pop.SurvivalRate); // see if the population can actually be used to train IMLDataSet trainingSet = new BasicMLDataSet(XOR.XORInput, XOR.XORIdeal); ICalculateScore score = new TrainingSetScore(trainingSet); IEvolutionaryAlgorithm train = NEATUtil.ConstructNEATTrainer(pop, score); train.Iteration(); }
UsingHeuristic <TIndividual, TGeneStructure, TGene>( this IEvolutionaryAlgorithm <TIndividual, TGeneStructure, TGene> algo, Func <IMutator <TIndividual, TGeneStructure, TGene>, IMutator <TIndividual, TGeneStructure, TGene> > applyMutations, IGenerationFilter <TIndividual, TGeneStructure, TGene> filter) where TIndividual : IIndividual <TGeneStructure, TGene> where TGeneStructure : ICloneable => algo.UsingHeuristic(new GenerationGenerator <TIndividual, TGeneStructure, TGene> { Mutator = applyMutations(new Mutator <TIndividual, TGeneStructure, TGene>()), Filter = filter });
public void ResetTraining() { Substrate substrate = SubstrateFactory.factorSandwichSubstrate(11, 11); BoxesScore score = new BoxesScore(11); pop = new NEATPopulation(substrate, 500); pop.ActivationCycles = 4; pop.Reset(); train = NEATUtil.ConstructNEATTrainer(pop, score); OriginalNEATSpeciation speciation = new OriginalNEATSpeciation(); train.Speciation = new OriginalNEATSpeciation(); }
private NEATPopulation Generate() { IMLDataSet trainingSet = new BasicMLDataSet(XOR.XORInput, XOR.XORIdeal); ICalculateScore score = new TrainingSetScore(trainingSet); // train the neural network ActivationStep step = new ActivationStep(); step.Center = 0.5; IEvolutionaryAlgorithm train = NEATUtil.ConstructNEATTrainer( score, 2, 1, 10); return((NEATPopulation)train.Population); }
public StatisticsView(IEvolutionaryAlgorithm <IBitIndividual, BitArray, bool> algorithm, SimpleGraph graph) { var statistics = algorithm.Statistics; Parameters = (IParameters)algorithm.Parameters.Clone(); StartTime = statistics.StartTime; EndTime = statistics.EndTime ?? DateTime.Now; Best = statistics.Best == null ? null : new IndividualViewView(statistics.Best); Current = statistics.Best == null ? null : new IndividualViewView(statistics.Current); Previous = statistics.Best == null ? null : new IndividualViewView(statistics.Previous); StagnantGeneration = statistics.StagnantGeneration; Generations = statistics.Generations; foreach (var m in algorithm.HyperHeuristic.States.SelectMany(g => g.Mutator.Mutations)) { if (m is AsymmetricMutation mutation) { R0 = mutation.ZeroFocus; R1 = mutation.OneFocus; } } if (algorithm.HyperHeuristic is StagnationDetectionHyperHeuristic heuristic) { InStagnation = heuristic.InStagnationDetection; StagnationProgress = heuristic.At / heuristic.Limit; } if (graph != null && Current != null) { Edges = graph.Edges .Where(t => Current.Genes[t.Id]) .Select(t => new ViewEdge(t)) .ToList(); } }
/// <summary> /// Create a species comparator. /// </summary> /// <param name="theTraining">The trainer.</param> public SpeciesComparer(IEvolutionaryAlgorithm theTraining) { _training = theTraining; }
/// <inheritdoc /> public void Init(IEvolutionaryAlgorithm theOwner) { // TODO Auto-generated method stub }
/// <inheritdoc /> public void Init(IEvolutionaryAlgorithm theOwner) { }
public static IEvolutionaryAlgorithm <IBitIndividual, BitArray, bool> UsingStagnationStatistics( this IEvolutionaryAlgorithm <IBitIndividual, BitArray, bool> algorithm) => algorithm.UsingStatistics(new StagnationStatistics());
/// <inheritdoc /> public void Init(IEvolutionaryAlgorithm theOwner) { _owner = theOwner; _population = theOwner.Population; _sortGenomes = new SortGenomesForSpecies(_owner); }
/// <inheritdoc/> public void Init(IEvolutionaryAlgorithm theTrainer) { _trainer = theTrainer; }
/// <summary> /// Construct a tournament selection. /// </summary> /// <param name="theTrainer">The trainer.</param> /// <param name="theRounds">The number of rounds to use.</param> public TournamentSelection(IEvolutionaryAlgorithm theTrainer, int theRounds) { Trainer = theTrainer; Rounds = theRounds; }
/// <summary> /// Construct a tournament selection. /// </summary> /// <param name="theTrainer">The trainer.</param> /// <param name="theRounds">The number of rounds to use.</param> public TournamentSelection(IEvolutionaryAlgorithm theTrainer, int theRounds) { Trainer = theTrainer; Rounds = theRounds; }
public bool Evaluate(IEvolutionaryAlgorithm algorithm) { throw new NotImplementedException(); }
public bool Evaluate(IEvolutionaryAlgorithm algorithm) { return(algorithm.ElapsedMilliseconds >= this._timeoutMilliseconds); }
public IndividualStorage(IEvolutionaryAlgorithm <TIndividual, TGeneStructure, TGene> example) : this(example.Population) { }
/// <inheritdoc /> public void Init(IEvolutionaryAlgorithm theOwner) { // TODO Auto-generated method stub }
/// <inheritdoc/> public void Init(IEvolutionaryAlgorithm theOwner) { this.owner = theOwner; }
/// <inheritdoc /> public void Init(IEvolutionaryAlgorithm theOwner) { }
public static IEvolutionaryAlgorithm <IBitIndividual, BitArray, bool> UsingRandomPopulation( this IEvolutionaryAlgorithm <IBitIndividual, BitArray, bool> algorithm, double mutationRate = 1) => algorithm.UsingPopulation(BitIndividual.FromRandom(mutationRate));
public static IEvolutionaryAlgorithm <IBitIndividual, BitArray, bool> UsingBasicStatistics( this IEvolutionaryAlgorithm <IBitIndividual, BitArray, bool> algorithm) => algorithm.UsingStatistics(new BasicEvolutionaryStatistics <IBitIndividual, BitArray, bool>());
/// <inheritdoc/> public void Init(IEvolutionaryAlgorithm theOwner) { // not needed }
/// <inheritdoc/> public void Init(IEvolutionaryAlgorithm theOwner) { // not needed }
/// <inheritdoc/> public void Init(IEvolutionaryAlgorithm theOwner) { this.owner = theOwner; }
/// <inheritdoc/> public void Init(IEvolutionaryAlgorithm theTrainer) { _trainer = theTrainer; }
/// <inheritdoc /> public void Init(IEvolutionaryAlgorithm theOwner) { _owner = theOwner; _sortGenomes = new SortGenomesForSpecies(_owner); }
UsingHeuristic <TIndividual, TGeneStructure, TGene>( this IEvolutionaryAlgorithm <TIndividual, TGeneStructure, TGene> algo, IGenerationGenerator <TIndividual, TGeneStructure, TGene> generator) where TIndividual : IIndividual <TGeneStructure, TGene> where TGeneStructure : ICloneable => algo.UsingHeuristic(new SimpleHeuristic <TIndividual, TGeneStructure, TGene>(generator));
/// <summary> /// Construct the truncation selector. /// </summary> /// <param name="theTrainer">The trainer.</param> /// <param name="thePercent">The top percent to select from.</param> public TruncationSelection(IEvolutionaryAlgorithm theTrainer, double thePercent) { _trainer = theTrainer; _percent = thePercent; }
/// <summary> /// Construct the truncation selector. /// </summary> /// <param name="theTrainer">The trainer.</param> /// <param name="thePercent">The top percent to select from.</param> public TruncationSelection(IEvolutionaryAlgorithm theTrainer, double thePercent) { _trainer = theTrainer; _percent = thePercent; }
/// <summary> /// Construct the comparator. /// </summary> /// <param name="theTrain">The trainer.</param> public SortGenomesForSpecies(IEvolutionaryAlgorithm theTrain) { _train = theTrain; }
public static StatisticsView MapToStatisticsView( this IEvolutionaryAlgorithm <IBitIndividual, BitArray, bool> algorithm, SimpleGraph graph) => algorithm == null ? null : new StatisticsView(algorithm, graph);