public void CorrectMeans()
        {
            const int numScores     = 4;
            const int numObjectives = 3;

            MpiObjectiveScores[] scores        = new MpiObjectiveScores[numScores];
            double[]             expectedMeans = new double[numObjectives];

            for (int i = 0; i < numScores; i++)
            {
                IObjectiveScore[] objectives = new IObjectiveScore[numObjectives];
                for (int j = 0; j < numObjectives; j++)
                {
                    double fs = FakeScore(i + j);
                    expectedMeans[j] += fs;
                    objectives[j]     = new DoubleObjectiveScore(String.Format("{0}-{1}", i, j), fs, true);
                }

                scores[i] = new MpiObjectiveScores(objectives, config);
            }

            for (int i = 0; i < numObjectives; i++)
            {
                expectedMeans[i] /= numScores;
            }

            var result = ObjectiveScoresHelper.Mean(scores, config);

            for (int i = 0; i < numObjectives; i++)
            {
                Assert.That((double)result.GetObjective(i).ValueComparable, Is.EqualTo(expectedMeans[i]).Within(1e-8));
            }
        }
        public void ArgumentNullExceptions()
        {
            ArgumentNullException e = Assert.Throws <ArgumentNullException>(() => ObjectiveScoresHelper.Mean(null, config));

            Assert.AreEqual(e.ParamName, "scoresArray");

            e = Assert.Throws <ArgumentNullException>(() => ObjectiveScoresHelper.Mean(new MpiObjectiveScores[3], null));
            Assert.AreEqual(e.ParamName, "sysConfig");
        }
        public void CorrectObjectiveCount()
        {
            const int        objectivesPerScore = 12;
            const int        numScores          = 305;
            var              randomScores       = CreateRandomScores(numScores, objectivesPerScore);
            IObjectiveScores result             = ObjectiveScoresHelper.Mean(randomScores, config);

            Assert.That(result.ObjectiveCount, Is.EqualTo(objectivesPerScore));
        }
        public void CorrectObjectiveNames()
        {
            const int        objectivesPerScore = 3;
            const int        numScores          = 3;
            var              randomScores       = CreateRandomScores(numScores, objectivesPerScore);
            IObjectiveScores result             = ObjectiveScoresHelper.Mean(randomScores, config);

            for (int i = 0; i < objectivesPerScore; i++)
            {
                Assert.That(result.GetObjective(i).Name, Is.EqualTo(randomScores[0].GetObjective(i).Name));
            }
        }