src/GenFx.Tests/GeneticAlgorithmTest.cs
/// <summary>
/// Tests that the ApplyElitism method works correctly.
/// </summary>
Tests that the ApplyElitism method works correctly.
Tests that the ApplyElitism method works correctly .
[Fact]
        public void GeneticAlgorithm_ApplyElitism()
        {
            TestGeneticAlgorithm algorithm = new TestGeneticAlgorithm
            {
                FitnessEvaluator = new MockFitnessEvaluator
                {
                    EvaluationMode = FitnessEvaluationMode.Maximize
                },
                SelectionOperator = new MockSelectionOperator
                {
                    SelectionBasedOnFitnessType = FitnessType.Scaled
                },
                GeneticEntitySeed = new MockEntity(),
                PopulationSeed = new MockPopulation()
            };
            TestApplyElitism(algorithm, 0);
            algorithm.ElitismStrategy = new MockElitismStrategy
            {
                ElitistRatio = .1
            };
            algorithm.ElitismStrategy.Initialize(algorithm);
            TestApplyElitism(algorithm, 1);
        }
[ Fact ] public void GeneticAlgorithm_ApplyElitism ( ) { TestGeneticAlgorithm algorithm = new TestGeneticAlgorithm { FitnessEvaluator = new MockFitnessEvaluator { EvaluationMode = FitnessEvaluationMode . Maximize } , SelectionOperator = new MockSelectionOperator { SelectionBasedOnFitnessType = FitnessType . Scaled } , GeneticEntitySeed = new MockEntity ( ) , PopulationSeed = new MockPopulation ( ) } ; TestApplyElitism ( algorithm , 0 ) ; algorithm . ElitismStrategy = new MockElitismStrategy { ElitistRatio = .1 } ; algorithm . ElitismStrategy . Initialize ( algorithm ) ; TestApplyElitism ( algorithm , 1 ) ; }
Tests that the ApplyElitism method works correctly.
Tests that the ApplyElitism method works correctly .