Exemplo n.º 1
0
        public void CreationStep_InitialInfinities(double input)
        {
            var layers = new TermLayer <LinearMembershipFunction>();

            layers.CreationStep(input, 0, 0);

            Assert.AreEqual(3, layers.Cores.Length);
            Assert.IsTrue(layers.Cores.Any(z => Math.Abs(z.X - input) < 1e-5));
        }
Exemplo n.º 2
0
        public void CreationStep_CorrectlyOutsideTerm(double input)
        {
            var zero = TermCore.Create(0);
            var one  = TermCore.Create(1);

            zero.AccumulatedError = 1;
            one.AccumulatedError  = 1;
            var layers = new TermLayer <LinearMembershipFunction>(new[]
            {
                zero, one
            });

            layers.CreationStep(input, 0, 0);

            Assert.AreEqual(5, layers.Cores.Length);
            Assert.IsTrue(layers.Cores.Any(z => Math.Abs(z.X - input) < 1e-5));
        }
Exemplo n.º 3
0
        public void CreationStep_CorrectlyCreatedMidleTerm(double input)
        {
            var zero = TermCore.Create(0);
            var one  = TermCore.Create(1);

            zero.AccumulatedError = 1;
            one.AccumulatedError  = 1;
            var layers = new TermLayer <LinearMembershipFunction>(new[]
            {
                zero, one
            });

            layers.CreationStep(input, 0, 0);

            Assert.AreEqual(5, layers.Cores.Length);
            Assert.AreEqual(input, layers.Cores[2].X);
        }