Пример #1
0
        public void IsMetThrowsForMissingCovarianceMatrix()
        {
            var terminationCriterion = new NoEffectAxis();
            var data = NoEffectAxisTest.CreateCmaEsData(covariances: null, currentGeneration: 1, currentStepSize: 0.2);

            Assert.Throws <ArgumentOutOfRangeException>(() => terminationCriterion.IsMet(data));
        }
Пример #2
0
        public void IsMetReturnsTrueForTinyStepSize()
        {
            var covariances = Matrix <double> .Build.DenseIdentity(3);

            var generation = 6;
            var stepSize   = double.Epsilon;

            var terminationCriterion = new NoEffectAxis();

            Assert.True(
                terminationCriterion.IsMet(NoEffectAxisTest.CreateCmaEsData(covariances, generation, stepSize)),
                "Termination criterion should have been met.");
        }
Пример #3
0
        public void IsMetReturnsFalseForSignificantShift()
        {
            var covariances = Matrix <double> .Build.DenseIdentity(3);

            var generation = 6;
            var stepSize   = double.Epsilon * 10;

            var terminationCriterion = new NoEffectAxis();

            Assert.False(
                terminationCriterion.IsMet(NoEffectAxisTest.CreateCmaEsData(covariances, generation, stepSize)),
                "Termination criterion should not have been met.");
        }
Пример #4
0
        public void IsMetReturnsTrueForTinyDiagonalElement()
        {
            var covariances = Matrix <double> .Build.DenseOfDiagonalArray(
                new[] { 1d, 1d, double.Epsilon *double.Epsilon });

            var generation = 6;
            var stepSize   = 0.1;

            var terminationCriterion = new NoEffectAxis();

            Assert.True(
                terminationCriterion.IsMet(NoEffectAxisTest.CreateCmaEsData(covariances, generation, stepSize)),
                "Termination criterion should have been met.");
        }