Esempio n. 1
0
        public void Evaluate()
        {
            ExpandedDecorator   decorator = new ExpandedDecorator();
            IContinuousFunction function  = new Spherical();

            decorator.Function  = function;
            decorator.SplitSize = 1;

            Vector v1 = new Vector(new double[] { 0, 0 });
            Vector v2 = new Vector(new double[] { 1, 1 });
            Vector v3 = new Vector(new double[] { 1, 2, 3 });

            Assert.AreEqual(0, decorator.Evaluate(v1));
            Assert.AreEqual(4, decorator.Evaluate(v2));
            Assert.AreEqual(28, decorator.Evaluate(v3));
        }
Esempio n. 2
0
        public void Error()
        {
            ExpandedDecorator   decorator = new ExpandedDecorator();
            IContinuousFunction function  = new Spherical();

            decorator.Function  = function;
            decorator.SplitSize = 3;

            Vector v1 = new Vector(new double[] { 0, 0 });

            Assert.Throws <ArgumentException>(() => decorator.Evaluate(v1));
        }