Skip to content

Commit

Permalink
Changed the default GenerationStrategy from TrackingGenerationStrateg…
Browse files Browse the repository at this point in the history
…y to PerformanceGenerationStrategy.
  • Loading branch information
giacomelli committed Jan 15, 2016
1 parent 0355181 commit e6ec946
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/GeneticSharp.Domain/Populations/Population.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using GeneticSharp.Domain.Chromosomes;
using HelperSharp;

Expand Down Expand Up @@ -37,7 +37,7 @@ public Population(int minSize, int maxSize, IChromosome adamChromosome)
MaxSize = maxSize;
AdamChromosome = adamChromosome;
Generations = new List<Generation>();
GenerationStrategy = new TrackingGenerationStrategy();
GenerationStrategy = new PerformanceGenerationStrategy(10);
}
#endregion

Expand All @@ -52,16 +52,16 @@ public Population(int minSize, int maxSize, IChromosome adamChromosome)
/// <summary>
/// Gets or sets the creation date.
/// </summary>
public DateTime CreationDate { get; protected set; }

public DateTime CreationDate { get; protected set; }

/// <summary>
/// Gets or sets the generations.
/// <remarks>
/// The information of Generations can vary depending of the IGenerationStrategy used.
/// </remarks>
/// </summary>
/// <value>The generations.</value>
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Parent classes need to set it.")]
/// <value>The generations.</value>
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Parent classes need to set it.")]
public IList<Generation> Generations { get; protected set; }

/// <summary>
Expand Down Expand Up @@ -99,8 +99,8 @@ public Population(int minSize, int maxSize, IChromosome adamChromosome)
/// <summary>
/// Gets or sets the generation strategy.
/// </summary>
public IGenerationStrategy GenerationStrategy { get; set; }

public IGenerationStrategy GenerationStrategy { get; set; }

/// <summary>
/// Gets or sets the original chromosome of all population.
/// </summary>
Expand Down Expand Up @@ -159,24 +159,24 @@ public virtual void EndCurrentGeneration()

if (BestChromosome != CurrentGeneration.BestChromosome)
{
BestChromosome = CurrentGeneration.BestChromosome;

BestChromosome = CurrentGeneration.BestChromosome;

OnBestChromosomeChanged(EventArgs.Empty);
}
}
}
#endregion


#region Protected methods
/// <summary>
/// Raises the best chromosome changed event.
/// </summary>
/// <param name="args">The event arguments.</param>
protected virtual void OnBestChromosomeChanged(EventArgs args)
{
if (BestChromosomeChanged != null)
{
BestChromosomeChanged(this, args);
}
protected virtual void OnBestChromosomeChanged(EventArgs args)
{
if (BestChromosomeChanged != null)
{
BestChromosomeChanged(this, args);
}
}
#endregion
}
Expand Down

0 comments on commit e6ec946

Please sign in to comment.