public static void Init() { configure = new Config(ImpMethod.Prod, ConnMethod.Min); //Variavel de entrada //vida health = new LingVariable("Health", VarType.Input); //declare new lingustic variable health.setRange(0, 100); // set max - min range for our variables 0 mph -35 mph health.addMF(new Trimf("Low", 0, 0, 55)); // trapmf: trapazoid shape behaviour health.addMF(new Trimf("Medium", 0, 50, 100)); // trimf: triangle shape behaviour health.addMF(new Trimf("High", 45, 100, 100)); mood = new LingVariable("Mood", VarType.Output); mood.setRange(0, 2); // Brake Force mood.addMF(new Trimf("Angry", 0, 1.5f, 1.5f)); mood.addMF(new Trimf("Sad", 0.5, 0, 1.5)); mood.addMF(new Trimf("Happy", 0.5, 2, 2)); //IF Health IS High THEN Mood is Happy List <RuleItem> rule1in = new List <RuleItem>(); List <RuleItem> rule1out = new List <RuleItem>(); // the if part of the Rule, add more than one if X1 and X2, // add another RuleItem in the list rule1in.AddRange(new RuleItem[1] { new RuleItem("Health", "High") }); rule1out.AddRange(new RuleItem[1] { new RuleItem("Mood", "Happy") }); rule1in.AddRange(new RuleItem[1] { new RuleItem("Health", "Low") }); rule1out.AddRange(new RuleItem[1] { new RuleItem("Mood", "Angry") }); rule1in.AddRange(new RuleItem[1] { new RuleItem("Health", "Medium") }); rule1out.AddRange(new RuleItem[1] { new RuleItem("Mood", "Sad") }); // List of rules "RuleBase" passed to the Inference Engine rules = new List <Rule>(); rules.Add(new Rule(rule1in, rule1out, Connector.And)); }
private void OKBtn_Click(object sender, EventArgs e) { LingVariable temp; if (TypeCombo.SelectedItem.Equals("Input")) { temp = new LingVariable(NameTxT.Text, VarType.Input); List <double> rang = FuzzyApp.tokString(RangeTxT.Text); temp.setRange(rang[0], rang[1]); double value = (rang[1] - rang[0]) * 0.5; temp.addMF(new Trimf("mf", rang[0], (rang[0] + value), rang[1])); FuzzyApp.InputVariables.Add(temp); ParentTab.SelectedTab = ParentTab.TabPages[0]; } else { temp = new LingVariable(NameTxT.Text, VarType.Output); List <double> rang = FuzzyApp.tokString(RangeTxT.Text); temp.setRange(rang[0], rang[1]); double value = (rang[1] - rang[0]) * 0.5; temp.addMF(new Trimf("mf", rang[0], (rang[0] + value), rang[1])); FuzzyApp.OutputVariables.Add(temp); ParentTab.SelectedTab = ParentTab.TabPages[1]; } this.Close(); }
public static void defaultSettings1() { LingVariable FSS = new LingVariable("FSS", VarType.Input); FSS.setRange(0, 35); FSS.addMF(new Trapmf("Low", -10, 0, 10, 15)); FSS.addMF(new Trapmf("Medium", 10, 15, 25, 30)); FSS.addMF(new Trapmf("High", 25, 30, 35, 40)); LingVariable BSS = new LingVariable("BSS", VarType.Input); BSS.setRange(0, 65); BSS.addMF(new Trapmf("Low", -10, 0, 20, 40)); BSS.addMF(new Trimf("Medium", 20, 40, 60)); BSS.addMF(new Trapmf("High", 40, 60, 65, 70)); FuzzyApp.InputVariables.Add(FSS); FuzzyApp.InputVariables.Add(BSS); //output LingVariable Speed = new LingVariable("Speed", VarType.Output); Speed.setRange(10, 70); Speed.addMF(new Trimf("Low", 20, 30, 40)); Speed.addMF(new Trimf("Medium", 40, 50, 55)); Speed.addMF(new Trimf("High", 55, 60, 70)); LingVariable Steer = new LingVariable("Steer", VarType.Output); Steer.setRange(-180, 180); Steer.addMF(new Trimf("Right", -180, -93, -40)); Steer.addMF(new Trimf("Zero", -40, 0, 40)); Steer.addMF(new Trimf("Left", 40, 90, 180)); FuzzyApp.OutputVariables.Add(Speed); FuzzyApp.OutputVariables.Add(Steer); //Rules #region Rules init List <RuleItem> rule1in = new List <RuleItem>(); List <RuleItem> rule1out = new List <RuleItem>(); List <RuleItem> rule2in = new List <RuleItem>(); List <RuleItem> rule2out = new List <RuleItem>(); List <RuleItem> rule3in = new List <RuleItem>(); List <RuleItem> rule3out = new List <RuleItem>(); List <RuleItem> rule4in = new List <RuleItem>(); List <RuleItem> rule4out = new List <RuleItem>(); List <RuleItem> rule5in = new List <RuleItem>(); List <RuleItem> rule5out = new List <RuleItem>(); List <RuleItem> rule6in = new List <RuleItem>(); List <RuleItem> rule6out = new List <RuleItem>(); List <RuleItem> rule7in = new List <RuleItem>(); List <RuleItem> rule7out = new List <RuleItem>(); List <RuleItem> rule8in = new List <RuleItem>(); List <RuleItem> rule8out = new List <RuleItem>(); #endregion //Rule 8 in out rule8in.AddRange(new RuleItem[2] { new RuleItem("FSS", "Low"), new RuleItem("BSS", "High") }); rule8out.AddRange(new RuleItem[2] { new RuleItem("Speed", "High"), new RuleItem("Steer", "Zero") }); //rule 7 in out rule7in.AddRange(new RuleItem[2] { new RuleItem("FSS", "Low"), new RuleItem("BSS", "Medium") }); rule7out.AddRange(new RuleItem[2] { new RuleItem("Speed", "Medium"), new RuleItem("Steer", "Left") }); //rule 6 in out rule6in.AddRange(new RuleItem[2] { new RuleItem("FSS", "Low"), new RuleItem("BSS", "Low") }); rule6out.AddRange(new RuleItem[2] { new RuleItem("Speed", "Low"), new RuleItem("Steer", "Left") }); //rule 5 in out rule5in.AddRange(new RuleItem[2] { new RuleItem("FSS", "Medium"), new RuleItem("BSS", "Low") }); rule5out.AddRange(new RuleItem[2] { new RuleItem("Speed", "Medium"), new RuleItem("Steer", "Left") }); //Rule 4 in out rule4in.AddRange(new RuleItem[2] { new RuleItem("FSS", "Medium"), new RuleItem("BSS", "High") }); rule4out.AddRange(new RuleItem[2] { new RuleItem("Speed", "Medium"), new RuleItem("Steer", "Right") }); //rule 3 in out rule3in.AddRange(new RuleItem[2] { new RuleItem("FSS", "High"), new RuleItem("BSS", "Low") }); rule3out.AddRange(new RuleItem[2] { new RuleItem("Speed", "Low"), new RuleItem("Steer", "Right") }); //rule 2 in out rule2in.AddRange(new RuleItem[2] { new RuleItem("FSS", "High"), new RuleItem("BSS", "Medium") }); rule2out.AddRange(new RuleItem[2] { new RuleItem("Speed", "Medium"), new RuleItem("Steer", "Right") }); //rule 1 in out rule1in.AddRange(new RuleItem[2] { new RuleItem("FSS", "High"), new RuleItem("BSS", "High") }); rule1out.AddRange(new RuleItem[2] { new RuleItem("Speed", "High"), new RuleItem("Steer", "Zero") }); List <Rule> rules = new List <Rule>(); FuzzyApp.Rules.Add(new Rule(rule1in, rule1out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule2in, rule2out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule3in, rule3out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule4in, rule4out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule5in, rule5out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule6in, rule6out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule7in, rule7out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule8in, rule8out, Connector.And)); }
public static void defaultSettings2() { // Inputs LingVariable X1 = new LingVariable("X1", VarType.Input); X1.setRange(0, 35); X1.addMF(new Trapmf("Low", -10, 0, 10, 15)); X1.addMF(new Trapmf("Medium", 10, 15, 25, 30)); X1.addMF(new Trapmf("High", 25, 30, 35, 40)); LingVariable X2 = new LingVariable("X2", VarType.Input); X2.setRange(0, 65); X2.addMF(new Trapmf("Low", -10, 0, 20, 41)); X2.addMF(new Trimf("Medium", 20, 41, 60)); X2.addMF(new Trapmf("High", 41, 60, 65, 70)); FuzzyApp.InputVariables.Add(X1); FuzzyApp.InputVariables.Add(X2); //Output LingVariable Y1 = new LingVariable("Y1", VarType.Output); Y1.setRange(0, 100); Y1.addMF(new Trapmf("Low", 10, 20, 30, 40)); Y1.addMF(new Trapmf("Medium", 40, 50, 60, 70)); Y1.addMF(new Trapmf("High", 70, 80, 90, 100)); FuzzyApp.OutputVariables.Add(Y1); //Rules List <RuleItem> rule1in = new List <RuleItem>(); List <RuleItem> rule1out = new List <RuleItem>(); List <RuleItem> rule2in = new List <RuleItem>(); List <RuleItem> rule2out = new List <RuleItem>(); List <RuleItem> rule3in = new List <RuleItem>(); List <RuleItem> rule3out = new List <RuleItem>(); List <RuleItem> rule4in = new List <RuleItem>(); List <RuleItem> rule4out = new List <RuleItem>(); List <RuleItem> rule5in = new List <RuleItem>(); List <RuleItem> rule5out = new List <RuleItem>(); List <RuleItem> rule9in = new List <RuleItem>(); List <RuleItem> rule9out = new List <RuleItem>(); rule1in.AddRange(new RuleItem[2] { new RuleItem("X1", "Low"), new RuleItem("X2", "Low") }); rule1out.AddRange(new RuleItem[1] { new RuleItem("Y1", "High") }); rule2in.AddRange(new RuleItem[2] { new RuleItem("X1", "Low"), new RuleItem("X2", "Medium") }); rule2out.AddRange(new RuleItem[1] { new RuleItem("Y1", "Low") }); rule3in.AddRange(new RuleItem[2] { new RuleItem("X1", "Low"), new RuleItem("X2", "High") }); rule3out.AddRange(new RuleItem[1] { new RuleItem("Y1", "Medium") }); rule4in.AddRange(new RuleItem[2] { new RuleItem("X1", "Medium"), new RuleItem("X2", "Low") }); rule4out.AddRange(new RuleItem[1] { new RuleItem("Y1", "Medium") }); rule5in.AddRange(new RuleItem[2] { new RuleItem("X1", "Medium"), new RuleItem("X2", "Medium") }); rule5out.AddRange(new RuleItem[1] { new RuleItem("Y1", "High") }); rule9in.AddRange(new RuleItem[2] { new RuleItem("X1", "High"), new RuleItem("X2", "High") }); rule9out.AddRange(new RuleItem[1] { new RuleItem("Y1", "Medium") }); List <Rule> rules = new List <Rule>(); FuzzyApp.Rules.Add(new Rule(rule1in, rule1out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule2in, rule2out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule3in, rule3out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule4in, rule4out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule5in, rule5out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule9in, rule9out, Connector.And)); }
private static void test2(double in1, double in2) { Config conf = new Config(ImpMethod.Prod, ConnMethod.Min ); LingVariable X1 = new LingVariable("X1", VarType.Input); X1.setRange(0, 35); X1.addMF(new Trapmf("Low", -10, 0, 10, 15)); X1.addMF(new Trapmf("Medium", 10, 15, 25, 30)); X1.addMF(new Trapmf("High", 25, 30, 35, 40)); LingVariable X2 = new LingVariable("X2", VarType.Input); X2.setRange(0, 65); X2.addMF(new Trapmf("Low", -10, 0, 20, 41)); X2.addMF(new Trimf("Medium", 20, 41, 60)); X2.addMF(new Trapmf("High", 41, 60, 65, 70)); LingVariable Y1 = new LingVariable("Y1", VarType.Output); Y1.setRange(0, 100); Y1.addMF(new Trapmf("Low", 10, 20, 30, 40)); Y1.addMF(new Trapmf("Medium", 40, 50, 60, 70)); Y1.addMF(new Trapmf("High", 70, 80, 90, 100)); FLC c = new FLC(conf); double front = in1; double back = in2; FuzzySet set1 = new FuzzySet(c.Fuzzification(front, X1), X1.Name); FuzzySet set2 = new FuzzySet(c.Fuzzification(back, X2), X2.Name); Console.WriteLine("1. Crisp Input\n"); Console.WriteLine("Front Side Sensor: " + front.ToString()); Console.WriteLine("Back Side Sensor: " + back.ToString()); List <FuzzySet> fuzset = new List <FuzzySet>(); fuzset.Add(set1); fuzset.Add(set2); Console.WriteLine("\n2. Fuzzfication of inputs\n"); for (int i = 0; i < fuzset.Count; i++) { Console.WriteLine(fuzset[i].Variable); for (int j = 0; j < fuzset[i].Set.Count; j++) { Console.WriteLine(fuzset[i].Set[j].ToString()); } Console.WriteLine(); } List <RuleItem> rule1in = new List <RuleItem>(); List <RuleItem> rule1out = new List <RuleItem>(); List <RuleItem> rule2in = new List <RuleItem>(); List <RuleItem> rule2out = new List <RuleItem>(); List <RuleItem> rule3in = new List <RuleItem>(); List <RuleItem> rule3out = new List <RuleItem>(); List <RuleItem> rule4in = new List <RuleItem>(); List <RuleItem> rule4out = new List <RuleItem>(); List <RuleItem> rule5in = new List <RuleItem>(); List <RuleItem> rule5out = new List <RuleItem>(); List <RuleItem> rule9in = new List <RuleItem>(); List <RuleItem> rule9out = new List <RuleItem>(); rule1in.AddRange(new RuleItem[2] { new RuleItem("X1", "Low"), new RuleItem("X2", "Low") }); rule1out.AddRange(new RuleItem[1] { new RuleItem("Y1", "High") }); rule2in.AddRange(new RuleItem[2] { new RuleItem("X1", "Low"), new RuleItem("X2", "Medium") }); rule2out.AddRange(new RuleItem[1] { new RuleItem("Y1", "Low") }); rule3in.AddRange(new RuleItem[2] { new RuleItem("X1", "Low"), new RuleItem("X2", "High") }); rule3out.AddRange(new RuleItem[1] { new RuleItem("Y1", "Medium") }); rule4in.AddRange(new RuleItem[2] { new RuleItem("X1", "Medium"), new RuleItem("X2", "Low") }); rule4out.AddRange(new RuleItem[1] { new RuleItem("Y1", "Medium") }); rule5in.AddRange(new RuleItem[2] { new RuleItem("X1", "Medium"), new RuleItem("X2", "Medium") }); rule5out.AddRange(new RuleItem[1] { new RuleItem("Y1", "High") }); rule9in.AddRange(new RuleItem[2] { new RuleItem("X1", "High"), new RuleItem("X2", "High") }); rule9out.AddRange(new RuleItem[1] { new RuleItem("Y1", "Medium") }); List <Rule> rules = new List <Rule>(); rules.Add(new Rule(rule1in, rule1out, Connector.And)); rules.Add(new Rule(rule2in, rule2out, Connector.And)); rules.Add(new Rule(rule3in, rule3out, Connector.And)); rules.Add(new Rule(rule4in, rule4out, Connector.And)); rules.Add(new Rule(rule5in, rule5out, Connector.And)); rules.Add(new Rule(rule9in, rule9out, Connector.And)); InferEngine engine = new InferEngine(conf, rules, fuzset); List <FuzzySet> impli = engine.evaluateRules(); Console.WriteLine("3. Fuzzy Output After Rules Evaluation \n"); for (int i = 0; i < engine.FiredRules.Count; i++) { Console.WriteLine("Rule " + engine.FiredRules[i].ToString()); } for (int i = 0; i < impli.Count; i++) { Console.WriteLine(impli[i].Variable); for (int j = 0; j < impli[i].Set.Count; j++) { Console.WriteLine(impli[i].Set[j].ToString()); } Console.WriteLine(); } double crisp1 = c.DeFuzzification(impli, Y1); Console.WriteLine("4. Crisp Output\n"); Console.WriteLine("Output Y1: " + crisp1.ToString()); Console.ReadLine(); }
private static void test1(double in1, double in2) { //Controller Configuration Config conf = new Config(ImpMethod.Min, ConnMethod.Min ); //Creating Lingustic Variables and Membership functions for inputs //inputs LingVariable FSS = new LingVariable("FSS", VarType.Input); FSS.setRange(0, 30); FSS.addMF(new Trapmf("Low", -9, -1, 2, 9)); FSS.addMF(new Trapmf("Medium", 2, 8.333, 14.17, 21.5)); FSS.addMF(new Trapmf("High", 14.17, 18.33, 26, 34)); LingVariable BSS = new LingVariable("BSS", VarType.Input); BSS.setRange(0, 60); BSS.addMF(new Trapmf("Low", -15.5, -1.75, 1.54, 21.87)); BSS.addMF(new Trimf("Medium", 1.54, 21.87, 41)); BSS.addMF(new Trapmf("High", 21.78, 36.1, 44.7, 58.8)); //output LingVariable Speed = new LingVariable("Speed", VarType.Output); Speed.setRange(10, 70); Speed.addMF(new Trimf("Low", 20, 30, 40)); Speed.addMF(new Trimf("Medium", 40, 50, 55)); Speed.addMF(new Trimf("High", 55, 60, 70)); LingVariable Steer = new LingVariable("Steer", VarType.Output); Steer.setRange(-180, 180); Steer.addMF(new Trimf("Right", -180, -93, -40)); Steer.addMF(new Trimf("Zero", -40, 0, 40)); Steer.addMF(new Trimf("Left", 40, 90, 180)); // Fuzzify Values and get FuzzySet contain MembershipValues and Fireing Strength for each Lingustic Variable FLC c = new FLC(conf); double front = in1; double back = in2; FuzzySet set1 = new FuzzySet(c.Fuzzification(front, FSS), FSS.Name); FuzzySet set2 = new FuzzySet(c.Fuzzification(back, BSS), BSS.Name); Console.WriteLine("1. Crisp Input\n"); Console.WriteLine("Front Side Sensor: " + front.ToString()); Console.WriteLine("Back Side Sensor: " + back.ToString()); List <FuzzySet> fuzset = new List <FuzzySet>(); fuzset.Add(set1); fuzset.Add(set2); Console.WriteLine("\n2. Fuzzfication of inputs\n"); for (int i = 0; i < fuzset.Count; i++) { Console.WriteLine(fuzset[i].Variable); for (int j = 0; j < fuzset[i].Set.Count; j++) { Console.WriteLine(fuzset[i].Set[j].ToString()); } Console.WriteLine(); } //Create Rules List <RuleItem> rule1in = new List <RuleItem>(); List <RuleItem> rule1out = new List <RuleItem>(); List <RuleItem> rule2in = new List <RuleItem>(); List <RuleItem> rule2out = new List <RuleItem>(); List <RuleItem> rule3in = new List <RuleItem>(); List <RuleItem> rule3out = new List <RuleItem>(); //rule 3 in out rule3in.AddRange(new RuleItem[2] { new RuleItem("FSS", "Low"), new RuleItem("BSS", "Low") }); rule3out.AddRange(new RuleItem[2] { new RuleItem("Speed", "High"), new RuleItem("Steer", "Right") }); //rule 2 in out rule2in.AddRange(new RuleItem[2] { new RuleItem("FSS", "Low"), new RuleItem("BSS", "High") }); rule2out.AddRange(new RuleItem[2] { new RuleItem("Speed", "Medium"), new RuleItem("Steer", "Left") }); //rule 1 in out rule1in.AddRange(new RuleItem[2] { new RuleItem("FSS", "Medium"), new RuleItem("BSS", "Medium") }); rule1out.AddRange(new RuleItem[2] { new RuleItem("Speed", "Medium"), new RuleItem("Steer", "Zero") }); List <Rule> rules = new List <Rule>(); rules.Add(new Rule(rule1in, rule1out, Connector.And)); rules.Add(new Rule(rule2in, rule2out, Connector.And)); rules.Add(new Rule(rule3in, rule3out, Connector.And)); //Using the inference Engine ... Completed InferEngine engine = new InferEngine(conf, rules, fuzset); List <FuzzySet> impli = engine.evaluateRules(); Console.WriteLine("3. Fuzzy Output After Rules Evaluation \n"); for (int i = 0; i < engine.FiredRules.Count; i++) { Console.WriteLine("Rule " + engine.FiredRules[i].ToString()); } for (int i = 0; i < impli.Count; i++) { Console.WriteLine(impli[i].Variable); for (int j = 0; j < impli[i].Set.Count; j++) { Console.WriteLine(impli[i].Set[j].ToString()); } Console.WriteLine(); } double crisp1 = c.DeFuzzification(impli, Speed); double crisp2 = c.DeFuzzification(impli, Steer); Console.WriteLine("4. Crisp Output\n"); Console.WriteLine("Output Speed: " + crisp1.ToString()); Console.WriteLine("Output Steer: " + crisp2.ToString()); Console.ReadLine(); }
public static void defaultSettings2() { LingVariable conf = new LingVariable("Conf", VarType.Input); conf.setRange(1, 10); conf.addMF(new Trapmf("low", -1, 1, 2, 4)); conf.addMF(new Trapmf("med", 3, 4, 6, 8)); conf.addMF(new Trapmf("high", 7, 9, 10, 11)); LingVariable integ = new LingVariable("Integ", VarType.Input); integ.setRange(1, 10); integ.addMF(new Trapmf("low", -1, 1, 2, 4)); integ.addMF(new Trapmf("med", 3, 5, 6, 8)); integ.addMF(new Trapmf("high", 7, 9, 10, 11)); LingVariable avail = new LingVariable("Avail", VarType.Input); avail.setRange(1, 10); avail.addMF(new Trapmf("low", -1, 1, 2, 4)); avail.addMF(new Trapmf("med", 3, 5, 6, 8)); avail.addMF(new Trapmf("high", 7, 9, 10, 11)); FuzzyApp.InputVariables.Add(conf); FuzzyApp.InputVariables.Add(integ); FuzzyApp.InputVariables.Add(avail); //output LingVariable risk = new LingVariable("Risk", VarType.Output); risk.setRange(1, 10); risk.addMF(new Trimf("low", -1, 1, 5)); risk.addMF(new Trimf("med", 3, 5, 8)); risk.addMF(new Trimf("high", 6, 10, 11)); FuzzyApp.OutputVariables.Add(risk); //Rules #region Rules init List <RuleItem> rule1in = new List <RuleItem>(); List <RuleItem> rule1out = new List <RuleItem>(); List <RuleItem> rule2in = new List <RuleItem>(); List <RuleItem> rule2out = new List <RuleItem>(); List <RuleItem> rule3in = new List <RuleItem>(); List <RuleItem> rule3out = new List <RuleItem>(); List <RuleItem> rule4in = new List <RuleItem>(); List <RuleItem> rule4out = new List <RuleItem>(); List <RuleItem> rule5in = new List <RuleItem>(); List <RuleItem> rule5out = new List <RuleItem>(); List <RuleItem> rule6in = new List <RuleItem>(); List <RuleItem> rule6out = new List <RuleItem>(); List <RuleItem> rule7in = new List <RuleItem>(); List <RuleItem> rule7out = new List <RuleItem>(); List <RuleItem> rule8in = new List <RuleItem>(); List <RuleItem> rule8out = new List <RuleItem>(); List <RuleItem> rule9in = new List <RuleItem>(); List <RuleItem> rule9out = new List <RuleItem>(); List <RuleItem> rule10in = new List <RuleItem>(); List <RuleItem> rule10out = new List <RuleItem>(); List <RuleItem> rule11in = new List <RuleItem>(); List <RuleItem> rule11out = new List <RuleItem>(); List <RuleItem> rule12in = new List <RuleItem>(); List <RuleItem> rule12out = new List <RuleItem>(); List <RuleItem> rule13in = new List <RuleItem>(); List <RuleItem> rule13out = new List <RuleItem>(); List <RuleItem> rule14in = new List <RuleItem>(); List <RuleItem> rule14out = new List <RuleItem>(); List <RuleItem> rule15in = new List <RuleItem>(); List <RuleItem> rule15out = new List <RuleItem>(); List <RuleItem> rule16in = new List <RuleItem>(); List <RuleItem> rule16out = new List <RuleItem>(); List <RuleItem> rule17in = new List <RuleItem>(); List <RuleItem> rule17out = new List <RuleItem>(); List <RuleItem> rule18in = new List <RuleItem>(); List <RuleItem> rule18out = new List <RuleItem>(); List <RuleItem> rule19in = new List <RuleItem>(); List <RuleItem> rule19out = new List <RuleItem>(); List <RuleItem> rule20in = new List <RuleItem>(); List <RuleItem> rule20out = new List <RuleItem>(); List <RuleItem> rule21in = new List <RuleItem>(); List <RuleItem> rule21out = new List <RuleItem>(); List <RuleItem> rule22in = new List <RuleItem>(); List <RuleItem> rule22out = new List <RuleItem>(); List <RuleItem> rule23in = new List <RuleItem>(); List <RuleItem> rule23out = new List <RuleItem>(); List <RuleItem> rule24in = new List <RuleItem>(); List <RuleItem> rule24out = new List <RuleItem>(); List <RuleItem> rule25in = new List <RuleItem>(); List <RuleItem> rule25out = new List <RuleItem>(); List <RuleItem> rule26in = new List <RuleItem>(); List <RuleItem> rule26out = new List <RuleItem>(); List <RuleItem> rule27in = new List <RuleItem>(); List <RuleItem> rule27out = new List <RuleItem>(); #endregion //rule 1 in out rule1in.AddRange(new RuleItem[3] { new RuleItem("Conf", "low"), new RuleItem("Integ", "low"), new RuleItem("Avail", "low") }); rule1out.AddRange(new RuleItem[1] { new RuleItem("Risk", "low") }); rule2in.AddRange(new RuleItem[3] { new RuleItem("Conf", "low"), new RuleItem("Integ", "low"), new RuleItem("Avail", "med") }); rule2out.AddRange(new RuleItem[1] { new RuleItem("Risk", "low") }); rule3in.AddRange(new RuleItem[3] { new RuleItem("Conf", "low"), new RuleItem("Integ", "low"), new RuleItem("Avail", "high") }); rule3out.AddRange(new RuleItem[1] { new RuleItem("Risk", "med") }); rule4in.AddRange(new RuleItem[3] { new RuleItem("Conf", "low"), new RuleItem("Integ", "med"), new RuleItem("Avail", "low") }); rule4out.AddRange(new RuleItem[1] { new RuleItem("Risk", "low") }); rule5in.AddRange(new RuleItem[3] { new RuleItem("Conf", "low"), new RuleItem("Integ", "med"), new RuleItem("Avail", "med") }); rule5out.AddRange(new RuleItem[1] { new RuleItem("Risk", "med") }); rule6in.AddRange(new RuleItem[3] { new RuleItem("Conf", "low"), new RuleItem("Integ", "med"), new RuleItem("Avail", "high") }); rule6out.AddRange(new RuleItem[1] { new RuleItem("Risk", "med") }); rule7in.AddRange(new RuleItem[3] { new RuleItem("Conf", "low"), new RuleItem("Integ", "high"), new RuleItem("Avail", "low") }); rule7out.AddRange(new RuleItem[1] { new RuleItem("Risk", "med") }); rule8in.AddRange(new RuleItem[3] { new RuleItem("Conf", "low"), new RuleItem("Integ", "high"), new RuleItem("Avail", "med") }); rule8out.AddRange(new RuleItem[1] { new RuleItem("Risk", "med") }); rule9in.AddRange(new RuleItem[3] { new RuleItem("Conf", "low"), new RuleItem("Integ", "high"), new RuleItem("Avail", "high") }); rule9out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule10in.AddRange(new RuleItem[3] { new RuleItem("Conf", "med"), new RuleItem("Integ", "low"), new RuleItem("Avail", "low") }); rule10out.AddRange(new RuleItem[1] { new RuleItem("Risk", "med") }); rule11in.AddRange(new RuleItem[3] { new RuleItem("Conf", "med"), new RuleItem("Integ", "low"), new RuleItem("Avail", "med") }); rule11out.AddRange(new RuleItem[1] { new RuleItem("Risk", "med") }); rule12in.AddRange(new RuleItem[3] { new RuleItem("Conf", "med"), new RuleItem("Integ", "low"), new RuleItem("Avail", "high") }); rule12out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule13in.AddRange(new RuleItem[3] { new RuleItem("Conf", "med"), new RuleItem("Integ", "med"), new RuleItem("Avail", "low") }); rule13out.AddRange(new RuleItem[1] { new RuleItem("Risk", "med") }); rule14in.AddRange(new RuleItem[3] { new RuleItem("Conf", "med"), new RuleItem("Integ", "med"), new RuleItem("Avail", "med") }); rule14out.AddRange(new RuleItem[1] { new RuleItem("Risk", "med") }); rule15in.AddRange(new RuleItem[3] { new RuleItem("Conf", "med"), new RuleItem("Integ", "med"), new RuleItem("Avail", "high") }); rule15out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule16in.AddRange(new RuleItem[3] { new RuleItem("Conf", "med"), new RuleItem("Integ", "high"), new RuleItem("Avail", "low") }); rule16out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule17in.AddRange(new RuleItem[3] { new RuleItem("Conf", "med"), new RuleItem("Integ", "high"), new RuleItem("Avail", "med") }); rule17out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule18in.AddRange(new RuleItem[3] { new RuleItem("Conf", "med"), new RuleItem("Integ", "high"), new RuleItem("Avail", "high") }); rule18out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule19in.AddRange(new RuleItem[3] { new RuleItem("Conf", "high"), new RuleItem("Integ", "low"), new RuleItem("Avail", "low") }); rule19out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule20in.AddRange(new RuleItem[3] { new RuleItem("Conf", "high"), new RuleItem("Integ", "low"), new RuleItem("Avail", "med") }); rule20out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule21in.AddRange(new RuleItem[3] { new RuleItem("Conf", "high"), new RuleItem("Integ", "low"), new RuleItem("Avail", "high") }); rule21out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule22in.AddRange(new RuleItem[3] { new RuleItem("Conf", "high"), new RuleItem("Integ", "med"), new RuleItem("Avail", "low") }); rule22out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule23in.AddRange(new RuleItem[3] { new RuleItem("Conf", "high"), new RuleItem("Integ", "med"), new RuleItem("Avail", "med") }); rule23out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule24in.AddRange(new RuleItem[3] { new RuleItem("Conf", "high"), new RuleItem("Integ", "med"), new RuleItem("Avail", "high") }); rule24out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule25in.AddRange(new RuleItem[3] { new RuleItem("Conf", "high"), new RuleItem("Integ", "high"), new RuleItem("Avail", "low") }); rule25out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule26in.AddRange(new RuleItem[3] { new RuleItem("Conf", "high"), new RuleItem("Integ", "high"), new RuleItem("Avail", "med") }); rule26out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); rule27in.AddRange(new RuleItem[3] { new RuleItem("Conf", "high"), new RuleItem("Integ", "high"), new RuleItem("Avail", "high") }); rule27out.AddRange(new RuleItem[1] { new RuleItem("Risk", "high") }); List <Rule> rules = new List <Rule>(); FuzzyApp.Rules.Add(new Rule(rule1in, rule1out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule2in, rule2out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule3in, rule3out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule4in, rule4out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule5in, rule5out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule6in, rule6out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule7in, rule7out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule8in, rule8out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule9in, rule9out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule10in, rule10out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule11in, rule11out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule12in, rule12out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule13in, rule13out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule14in, rule14out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule15in, rule15out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule16in, rule16out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule17in, rule17out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule18in, rule18out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule19in, rule19out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule20in, rule20out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule21in, rule21out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule22in, rule22out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule23in, rule23out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule24in, rule24out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule25in, rule25out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule26in, rule26out, Connector.And)); FuzzyApp.Rules.Add(new Rule(rule27in, rule27out, Connector.And)); }