Esempio n. 1
0
        public void MembershipFunctionCollection_Types_Success()
        {
            //Arrange
            var collection = new MembershipFunctionCollection();

            //Act
            var trap = collection.AddTrapezoid("trap", 0, 0, 20, 40);
            var tri  = collection.AddTriangle("tri", 20, 40, 60);

            collection.AddRectangle("rect", 10, 50);
            collection.AddGaussian("gaus", 50, 20);
            collection.AddBell("bell", 10, 3, 50);
            collection.AddSShaped("sshaped", 50, 10);
            collection.AddZShaped("zshaped", 50, 10);
            collection.AddComposite("comp", trap, tri, 20);

            //Assert
            Assert.That(collection.Any(mf => mf is TrapezoidMembershipFunction), Is.True, "Trapezoid");
            Assert.That(collection.Any(mf => mf is TriangleMembershipFunction), Is.True, "Triangle");
            Assert.That(collection.Any(mf => mf is RectangleMembershipFunction), Is.True, "Rectangle");
            Assert.That(collection.Any(mf => mf is GaussianMembershipFunction), Is.True, "Gaussian");
            Assert.That(collection.Any(mf => mf is BellMembershipFunction), Is.True, "Bell");
            Assert.That(collection.Any(mf => mf is SShapedMembershipFunction), Is.True, "SShaped");
            Assert.That(collection.Any(mf => mf is ZShapedMembershipFunction), Is.True, "ZShaped");
            Assert.That(collection.Any(mf => mf is CompositeMembershipFunction), Is.True, "Composite");
        }
Esempio n. 2
0
        public void setMembers()
        {
            tex = new MembershipFunctionCollection();
            tex.Add(new MembershipFunction("LOW", 15.0, 20.0, 20.0, 32.0));
            tex.Add(new MembershipFunction("MEDIUM", 22.0, 35.0, 47.0, 47.0));
            tex.Add(new MembershipFunction("HIGH", 37.0, 37.0, 50.0, 60.0));
            _tex = new LinguisticVariable("TEX", tex);

            spi = new MembershipFunctionCollection();
            spi.Add(new MembershipFunction("LOW", 6.0, 8.0, 8.0, 11.2));
            spi.Add(new MembershipFunction("MEDIUM", 8.5, 12.0, 12.0, 15.3));
            spi.Add(new MembershipFunction("HIGH", 12.7, 16.0, 16.0, 18.0));
            _spi = new LinguisticVariable("SPI", spi);

            ss = new MembershipFunctionCollection();
            ss.Add(new MembershipFunction("VLOW", 335.13, 410.13, 410.13, 500.0));
            ss.Add(new MembershipFunction("LOW", 410.13, 500.0, 650.0, 650.0));
            ss.Add(new MembershipFunction("MEDIUM", 500.0, 500.0, 650.0, 800.0));
            ss.Add(new MembershipFunction("HIGH", 650.0, 650.0, 800.0, 900.0));
            ss.Add(new MembershipFunction("VHIGH", 800.0, 940.0, 940.0, 1000.0));
            _ss = new LinguisticVariable("SS", ss);
        }
Esempio n. 3
0
        public void setMembers()
        {
            hottank = new MembershipFunctionCollection();
            hottank.Add(new MembershipFunction("S", -1.0, 134.0, 134.0, 200.0));
            hottank.Add(new MembershipFunction("M", 134.0, 234.0, 234.0, 300.0));
            hottank.Add(new MembershipFunction("L", 268.0, 384.0, 384.0, 501.0));
            myhottank = new LinguisticVariable("HOTTANK", hottank);

            coldtank = new MembershipFunctionCollection();
            coldtank.Add(new MembershipFunction("S", -1.0, 100.0, 100.0, 200));
            coldtank.Add(new MembershipFunction("M", 134, 234.0, 234.0, 334));
            coldtank.Add(new MembershipFunction("L", 268.0, 384.0, 384.0, 501));
            mycoldtank = new LinguisticVariable("COLDTANK", coldtank);

            thottank = new MembershipFunctionCollection();
            thottank.Add(new MembershipFunction("AMBIENT", 21.0, 43.0, 43.0, 60.0));
            thottank.Add(new MembershipFunction("WARM", 53.0, 66.5, 66.5, 80.0));
            thottank.Add(new MembershipFunction("HOT", 60.0, 77.0, 77.0, 101.0));
            mythottank = new LinguisticVariable("THOTTANK", thottank);

            tcoldtank = new MembershipFunctionCollection();
            tcoldtank.Add(new MembershipFunction("COLD", 10.0, 14.0, 14.0, 18.0));
            tcoldtank.Add(new MembershipFunction("WARM", 16.0, 18.0, 18.0, 20.0));
            tcoldtank.Add(new MembershipFunction("AMBIENT", 18.0, 22.0, 22.0, 31.0));
            mytcoldtank = new LinguisticVariable("TCOLDTANK", tcoldtank);

            heat = new MembershipFunctionCollection();
            heat.Add(new MembershipFunction("LOW", -1.0, 47.5, 47.5, 95.0));
            heat.Add(new MembershipFunction("MED", 76.0, 95.0, 95.0, 114.0));
            heat.Add(new MembershipFunction("HIGH", 95.0, 142.5, 142.5, 199.0));
            myheat = new LinguisticVariable("HEAT", heat);

            cold = new MembershipFunctionCollection();
            cold.Add(new MembershipFunction("LOW", -1.0, 16.5, 16.5, 33.0));
            cold.Add(new MembershipFunction("MED", 27.0, 33.0, 33.0, 59.0));
            cold.Add(new MembershipFunction("HIGH", 33.0, 49.5, 49.5, 69.0));
            mycold = new LinguisticVariable("COLD", cold);
        }
Esempio n. 4
0
        private void setEngines()
        {
            roadpopulation = new MembershipFunctionCollection();

            roadpopulation.Add(new MembershipFunction("Low", -25, -25, 0, 20));
            roadpopulation.Add(new MembershipFunction("Mid", 10, 30, 30, 50));
            roadpopulation.Add(new MembershipFunction("High", 40, 60, 85, 85));

            road1 = new LinguisticVariable("Road1", roadpopulation);
            road2 = new LinguisticVariable("Road2", roadpopulation);
            road3 = new LinguisticVariable("Road3", roadpopulation);
            road4 = new LinguisticVariable("Road4", roadpopulation);

            nextGreenSelection = new MembershipFunctionCollection();
            nextGreenSelection.Add(new MembershipFunction("TrafficLight1", 0, 0, 1, 3));
            nextGreenSelection.Add(new MembershipFunction("TrafficLight2", 3, 4, 4, 6));
            nextGreenSelection.Add(new MembershipFunction("TrafficLight3", 6, 7, 7, 9));
            nextGreenSelection.Add(new MembershipFunction("TrafficLight4", 9, 10, 10, 12));
            nextGreenSelection.Add(new MembershipFunction("Uncertain", 12, 13, 14, 14));
            nextGreen = new LinguisticVariable("NextGreen", nextGreenSelection);

            roadSelection = new FuzzyEngine();

            roadSelection.LinguisticVariableCollection.Add(road1);
            roadSelection.LinguisticVariableCollection.Add(road2);
            roadSelection.LinguisticVariableCollection.Add(road3);
            roadSelection.LinguisticVariableCollection.Add(road4);
            roadSelection.LinguisticVariableCollection.Add(nextGreen);



            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Low) AND (Road3 IS Low) AND (Road4 IS Low) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Low) AND (Road3 IS Low) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Low) AND (Road3 IS Low) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Low) AND (Road3 IS Mid) AND (Road4 IS Low) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Low) AND (Road3 IS Mid) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Low) AND (Road3 IS Mid) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Low) AND (Road3 IS High) AND (Road4 IS Low) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Low) AND (Road3 IS High) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Low) AND (Road3 IS High) AND (Road4 IS High) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Mid) AND (Road3 IS Low) AND (Road4 IS Low) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Mid) AND (Road3 IS Low) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Mid) AND (Road3 IS Low) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Mid) AND (Road3 IS Mid) AND (Road4 IS Low) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Mid) AND (Road3 IS Mid) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Mid) AND (Road3 IS Mid) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Mid) AND (Road3 IS High) AND (Road4 IS Low) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Mid) AND (Road3 IS High) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS Mid) AND (Road3 IS High) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS High) AND (Road3 IS Low) AND (Road4 IS Low) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS High) AND (Road3 IS Low) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS High) AND (Road3 IS Low) AND (Road4 IS High) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS High) AND (Road3 IS Mid) AND (Road4 IS Low) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS High) AND (Road3 IS Mid) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS High) AND (Road3 IS Mid) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS High) AND (Road3 IS High) AND (Road4 IS Low) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS High) AND (Road3 IS High) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Low) AND (Road2 IS High) AND (Road3 IS High) AND (Road4 IS High) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Low) AND (Road3 IS Low) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Low) AND (Road3 IS Low) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Low) AND (Road3 IS Low) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Low) AND (Road3 IS Mid) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Low) AND (Road3 IS Mid) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Low) AND (Road3 IS Mid) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Low) AND (Road3 IS High) AND (Road4 IS Low) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Low) AND (Road3 IS High) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Low) AND (Road3 IS High) AND (Road4 IS High) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Mid) AND (Road3 IS Low) AND (Road4 IS Low) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Mid) AND (Road3 IS Low) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Mid) AND (Road3 IS Low) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Mid) AND (Road3 IS Mid) AND (Road4 IS Low) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Mid) AND (Road3 IS Mid) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Mid) AND (Road3 IS Mid) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Mid) AND (Road3 IS High) AND (Road4 IS Low) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Mid) AND (Road3 IS High) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS Mid) AND (Road3 IS High) AND (Road4 IS High) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS High) AND (Road3 IS Low) AND (Road4 IS Low) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS High) AND (Road3 IS Low) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS High) AND (Road3 IS Low) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS High) AND (Road3 IS Mid) AND (Road4 IS Low) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS High) AND (Road3 IS Mid) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS High) AND (Road3 IS Mid) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS High) AND (Road3 IS High) AND (Road4 IS Low) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS High) AND (Road3 IS High) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS Mid) AND (Road2 IS High) AND (Road3 IS High) AND (Road4 IS High) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Low) AND (Road3 IS Low) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Low) AND (Road3 IS Low) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Low) AND (Road3 IS Low) AND (Road4 IS High) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Low) AND (Road3 IS Mid) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Low) AND (Road3 IS Mid) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Low) AND (Road3 IS Mid) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Low) AND (Road3 IS High) AND (Road4 IS Low) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Low) AND (Road3 IS High) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Low) AND (Road3 IS High) AND (Road4 IS High) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Mid) AND (Road3 IS Low) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Mid) AND (Road3 IS Low) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Mid) AND (Road3 IS Low) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Mid) AND (Road3 IS Mid) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Mid) AND (Road3 IS Mid) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Mid) AND (Road3 IS Mid) AND (Road4 IS High) THEN NextGreen IS TrafficLight4"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Mid) AND (Road3 IS High) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Mid) AND (Road3 IS High) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS Mid) AND (Road3 IS High) AND (Road4 IS High) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS High) AND (Road3 IS Low) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS High) AND (Road3 IS Low) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS High) AND (Road3 IS Low) AND (Road4 IS High) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS High) AND (Road3 IS Mid) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS High) AND (Road3 IS Mid) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight3"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS High) AND (Road3 IS Mid) AND (Road4 IS High) THEN NextGreen IS TrafficLight2"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS High) AND (Road3 IS High) AND (Road4 IS Low) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS High) AND (Road3 IS High) AND (Road4 IS Mid) THEN NextGreen IS TrafficLight1"));
            roadSelection.FuzzyRuleCollection.Add(new FuzzyRule("IF (Road1 IS High) AND (Road2 IS High) AND (Road3 IS High) AND (Road4 IS High) THEN NextGreen IS TrafficLight2"));

            roadSelection.Consequent = "NextGreen";
        }
 public LinguisticVariable(string name)
     : base(name, FuzzyRuleTokenType.Variable)
 {
     _membershipFunctions = new MembershipFunctionCollection();
 }
Esempio n. 6
0
 /// <param name="name">The name that identificates the linguistic variable.</param>
 /// <param name="membershipFunctionCollection">A membership functions collection for the lingusitic variable.</param>
 public LinguisticVariable(string name, MembershipFunctionCollection membershipFunctionCollection)
 {
     this.Name = name;
     this.MembershipFunctionCollection = membershipFunctionCollection;
 }