Beispiel #1
0
        public void Reinsertion_EvaluatedIndividual_AddedToPopulation()
        {
            var newInd = ObjectCreators.GetIndividual(builder.StartingDecVec);

            ObjectCreators.EvaluateIndividual(newInd);

            Assert.Empty(optimiserMock.Population);

            optimiserMock.ReInsert(new[] { newInd });

            Assert.Collection(optimiserMock.Population,
                              i => Assert.Equal(
                                  builder.StartingDecVec, i.DecisionVector.Select(d => (double)d)));

            var reinsertionTime = newInd.GetProperty <DateTime>(OptimiserPropertyNames.ReinsertionTime);

            Assert.True(reinsertionTime < DateTime.Now);
        }