Esempio n. 1
0
        public void TwoDim_CorrectlyIdentifiesIllegalSolutions()
        {
            var evaluator = new StyblinskiTang(2);
            var ds        = DecisionSpace.CreateForUniformDoubleArray(2, double.MinValue, double.MaxValue);
            var legal     = evaluator.GetLegality(DecisionVector.CreateFromArray(ds, new[] { -6.0, 2.0 }));

            Assert.False(legal);
            var legal2 = evaluator.GetLegality(DecisionVector.CreateFromArray(ds, new[] { -1.0, 7.0 }));

            Assert.False(legal2);
        }
Esempio n. 2
0
        public void TwoDim_CorrectlyIdentifiesLegalSolution()
        {
            var evaluator = new StyblinskiTang(2);
            var ds        = evaluator.GetGlobalOptimum().GetDecisionSpace();
            var legal     = evaluator.GetLegality(DecisionVector.CreateFromArray(ds, new[] { 1.0, 1.0 }));

            Assert.True(legal);
        }