public void IsMetThrowsForMissingCovarianceMatrix() { var terminationCriterion = new TolUpSigma(); var data = TolUpSigmaTest.CreateCmaEsData(covariances: null, initialStepSize: 0.2, currentStepSize: 0.2); Assert.Throws <ArgumentOutOfRangeException>(() => terminationCriterion.IsMet(data)); }
public void IsMetReturnsFalseForFactorEqualToMaxConstant() { double greatestEigenvalue = 42.3; double initialStepSize = 0.2; double currentStepSize = TolUpSigma.MaxFactor * Math.Sqrt(greatestEigenvalue) * initialStepSize; var covariances = Matrix <double> .Build.DenseOfDiagonalArray( new[] { greatestEigenvalue, 0, 0 }); var terminationCriterion = new TolUpSigma(); Assert.False( terminationCriterion.IsMet(TolUpSigmaTest.CreateCmaEsData(covariances, initialStepSize, currentStepSize)), "Termination criterion should not have been met."); }
public void IsMetThrowsForMissingConfiguration() { var covariances = Matrix <double> .Build.DenseOfDiagonalArray( new[] { 42.3, 0, 0 }); 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 TolUpSigma(); Assert.Throws <ArgumentOutOfRangeException>(() => terminationCriterion.IsMet(data)); }
public void IsMetThrowsForMissingCmaEsData() { var terminationCriterion = new TolUpSigma(); Assert.Throws <ArgumentNullException>(() => terminationCriterion.IsMet(data: null)); }