public void Centroid_DifferentLengthDecisionVectors_Throws()
        {
            var newInd = ObjectCreators.GetIndividual(Enumerable.Repeat <double>(1.2, bestDv.Length + 1));

            ObjectCreators.EvaluateIndividualAndSetFitness(newInd, BestFitness + FitnessDifference);

            var pop2 = ObjectCreators.GetEmptyPopulation(5, false);

            pop2.AddIndividual(singleObjectivePopulation.Best());
            pop2.AddIndividual(newInd);
            Assert.Throws <InvalidOperationException>(() => pop2.Centroid());
        }
        public PopulationExtensionsTests()
        {
            // Set up single-objective population for Convergence and Centroid tests
            bestDv  = new[] { 0.1, 0.5, 1.2 };
            worstDv = new[] { 0.1, bestDv[1] + DvDifference, 1.2 };

            var ind1 = ObjectCreators.GetIndividual(worstDv);
            var ind2 = ObjectCreators.GetIndividual(bestDv);

            ObjectCreators.EvaluateIndividualAndSetFitness(ind1, BestFitness + FitnessDifference);
            ObjectCreators.EvaluateIndividualAndSetFitness(ind2, BestFitness);

            singleObjectivePopulation = ObjectCreators.GetEmptyPopulation(140, true);
            singleObjectivePopulation.AddIndividual(ind1);
            singleObjectivePopulation.AddIndividual(ind2);
        }