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

            Assert.Throws <ArgumentOutOfRangeException>(() => terminationCriterion.IsMet(data));
        }
        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 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 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.");
        }
        public void IsMetThrowsForMissingConfiguration()
        {
            var covariances = Matrix <double> .Build.DenseOfDiagonalArray(new[] { 1d, 1d, 1d });

            var data = new CmaEsElements(
                configuration: null,
                generation: 5,
                distributionMean: Vector <double> .Build.Dense(3),
                stepSize: 0.2,
                covariances: covariances,
                covariancesDecomposition: covariances.Evd(),
                evolutionPath: Vector <double> .Build.Dense(3),
                conjugateEvolutionPath: Vector <double> .Build.Dense(3));

            var terminationCriterion = new NoEffectCoord();

            Assert.Throws <ArgumentOutOfRangeException>(() => terminationCriterion.IsMet(data));
        }
        public void IsMetThrowsForMissingCmaEsData()
        {
            var terminationCriterion = new NoEffectCoord();

            Assert.Throws <ArgumentNullException>(() => terminationCriterion.IsMet(data: null));
        }