public void IsMetThrowsForMissingCovarianceMatrix()
        {
            var terminationCriterion = new NoEffectCoord();
            var data = NoEffectCoordTest.CreateCmaEsData(covariances: null, currentStepSize: 0.2);

            Assert.Throws <ArgumentOutOfRangeException>(() => terminationCriterion.IsMet(data));
        }
        public void IsMetReturnsTrueForTinyStepSize()
        {
            var covariances = Matrix <double> .Build.DenseIdentity(3);

            var stepSize             = double.Epsilon;
            var terminationCriterion = new NoEffectCoord();

            Assert.True(
                terminationCriterion.IsMet(NoEffectCoordTest.CreateCmaEsData(covariances, stepSize)),
                "Termination criterion should have been met.");
        }
        public void IsMetReturnsFalseForSignificantShift()
        {
            var covariances = Matrix <double> .Build.DenseIdentity(3);

            var stepSize             = double.Epsilon * 5;
            var terminationCriterion = new NoEffectCoord();

            Assert.False(
                terminationCriterion.IsMet(NoEffectCoordTest.CreateCmaEsData(covariances, stepSize)),
                "Termination criterion should not have been met.");
        }
        public void IsMetReturnsTrueForTinyCovariancesDiagonalElement()
        {
            var covariances = Matrix <double> .Build.DenseOfDiagonalArray(new[] { 1d, 1d, double.Epsilon });

            var stepSize             = 0.1;
            var terminationCriterion = new NoEffectCoord();

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