Пример #1
0
        public void ItReturnsAValueWhenDynamicIsChosen()
        {
            _config.ImmigrationStrategy = ImmigrationStrategy.Dynamic;
            var gaRun = _solution.Run(_config);

            Assert.AreEqual(true, gaRun.BestChromosome.FitnessScore > 0);
        }
Пример #2
0
        public void ItRetiresPeopleByAge()
        {
            _config.RetirementStrategy = RetirementStrategy.MaxAge;
            _config.MaxRetirement      = 2;

            var gaRun = _solution.Run(_config);

            Assert.AreEqual(true, gaRun.BestChromosome.FitnessScore > 0);

            Assert.AreNotEqual(0, gaRun.Population.Retired.Count);

            foreach (var retiredPerson in gaRun.Population.Retired)
            {
                Assert.AreEqual(_config.MaxRetirement, retiredPerson.Age);
            }
        }