示例#1
0
        private KB.Rule GetRule12()
        {
            Antecedent antecedent;
            Judgment   consequent;

#pragma warning disable CS0168 // Переменная "other" объявлена, но ни разу не использована.
            Judgment other;
#pragma warning restore CS0168 // Переменная "other" объявлена, но ни разу не использована.

            antecedent = new Antecedent()
                         .OR(new Judgment(FactorTitle.Ua, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Ub, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Uc, FactorFuzzyValue.Maximum))
                         .OR(new Judgment(FactorTitle.Ua, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Ua, FactorFuzzyValue.Nominal))
                         .OR(new Judgment(FactorTitle.Ub, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Ua, FactorFuzzyValue.Nominal))
                         .OR(new Judgment(FactorTitle.Uc, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Ua, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.Weather, FactorFuzzyValue.Unsuccessful));
            consequent = new Judgment(FactorTitle.Uimp, FactorFuzzyValue.Maximum);

            LinguisticVariable linguistic = new LinguisticVariable(
                FactorTitle.Uimp,
                null,
                new List <FactorFuzzyValue> {
                FactorFuzzyValue.Nominal, FactorFuzzyValue.Maximum, FactorFuzzyValue.Exceeding
            },
                "Грозовые импульсные напряжения",
                "В"
                );
            return(new SimpleRule(linguistic, antecedent, consequent));
        }
示例#2
0
        private KB.Rule GetRule03()
        {
            Antecedent antecedent;
            Judgment   consequent;

            antecedent = new Antecedent()
                         .OR(new Judgment(FactorTitle.Uimp, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.dUabc, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.Uns, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.K2U, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.K2Ui, FactorFuzzyValue.Successful))
                         .AND(new Judgment(FactorTitle.dt, FactorFuzzyValue.Successful));
            consequent = new Judgment(FactorTitle.ServiceabilityEquipment, FactorFuzzyValue.Nominal);

            LinguisticVariable linguistic = new LinguisticVariable(
                FactorTitle.ServiceabilityEquipment,
                null,
                new List <FactorFuzzyValue> {
                FactorFuzzyValue.Nominal, FactorFuzzyValue.Maximum, FactorFuzzyValue.Exceeding
            },
                "Исправность технического состояния оборудования",
                null
                );

            return(new SimpleRule(linguistic, antecedent, consequent));
        }
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if ((comboBoxDiagn.SelectedIndex < 0) || (dataGridViewInRule.Rows.Count == 0))
            {
                MessageBox.Show("В правиле не введен диагноз или список антецедентов пуст. Правило не может быть без заключения или не иметь предпосылок. Заполните правило правильно!", "Правило не заполнено", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (prototype.ID >= 0)
                {
                    DatabaseManager.Instance.DeleteFromTable(prototype.ID, "knowledge_base", "id_rule");
                }
                //if (prototype.ID == -1)
                //{
                prototype.ID = DatabaseManager.Instance.InsertRule(prototype);

                List <Antecedent> rullist = new List <Antecedent>();
                for (int i = 0; i < dataGridViewInRule.Rows.Count; i++)
                {
                    var anttemp = new Antecedent();
                    anttemp.ID      = Convert.ToInt64(dataGridViewInRule.Rows[i].Cells[0].Value);
                    anttemp.Preview = dataGridViewInRule.Rows[i].Cells[1].Value.ToString();
                    rullist.Add(anttemp);
                }

                if (DatabaseManager.Instance.InsertRulesAntecedents(rullist, prototype))
                {
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }

                //}
            }
        }
        public KnowledgeBased(src.Rule rule)
        {
            InitializeComponent();

            prototype = rule;

            prAnt = new Antecedent();

            quantList     = null;
            symptomsList  = null;
            diagnosisList = null;
            fuzzyList     = null;

            UpdateComboQuant();
            UpdateComboSymptoms();
            UpdateComboDiagnosis();

            NewCombos();

            UpdateAntecedentsInRule();
            UpdateAntecedents();
            UpdateAntecedentPreview();
            UpdateRulePreview();

            if (prototype.ID != -1)
            {
                comboBoxDiagn.Text = DatabaseManager.Instance.GetDiagnosis(prototype.Conclusion.ID).Name;
            }

            richTextBoxPreview.Text = prototype.Preview;
        }
        public IHttpActionResult PutAntecedent(int id, Antecedent antecedent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != antecedent.AntecedentId)
            {
                return(BadRequest());
            }

            db.Entry(antecedent).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AntecedentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public void AntecedentTest()
        {
            var a1 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a2 = new Antecedent(1, ComparisonKind.Equal, 1.0);

            var a3 = new Antecedent(0, ComparisonKind.Equal, 0.0);
            var a4 = new Antecedent(0, ComparisonKind.Equal, 1.0);

            bool a12 = a1.Equals(a2);
            bool a34 = a3.Equals(a4);
            bool a14 = a1.Equals(a4);

            Assert.IsFalse(a12);
            Assert.IsFalse(a34);
            Assert.IsTrue(a14);

            int hash1 = a1.GetHashCode();
            int hash2 = a2.GetHashCode();
            int hash3 = a3.GetHashCode();
            int hash4 = a4.GetHashCode();

            Assert.AreNotEqual(hash1, hash2);
            Assert.AreNotEqual(hash3, hash4);
            Assert.AreEqual(hash1, hash4);
        }
示例#7
0
        private Antecedent GetAntecedentFromJsonByTermSet(string json, IList <LogicalConnection> termSet)
        {
            Antecedent antecedent = new Antecedent();

            string[] jsonLines = Regex.Split(json, "],");
            IEnumerator <LogicalConnection> termSetEnum = termSet.GetEnumerator();

            foreach (string jsonLine in jsonLines)
            {
                while (!jsonLine.Contains(termSetEnum.Current.ToString()))
                {
                    termSetEnum.MoveNext();
                }

                IList <string> result = GetListValuesFromJson(jsonLine, termSetEnum.Current.ToString());

                if (termSetEnum.Current == LogicalConnection.AND)
                {
                    foreach (string judgmentStr in result)
                    {
                        antecedent.AND(GetJudgmentFromJson(judgmentStr));
                    }
                }
                else if (termSetEnum.Current == LogicalConnection.OR)
                {
                    antecedent.OR(GetJudgmentListFromString(result).ToArray());
                }
            }

            return(antecedent);
        }
示例#8
0
        public void AntecedentTest()
        {
            var a1 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a2 = new Antecedent(1, ComparisonKind.Equal, 1.0);

            var a3 = new Antecedent(0, ComparisonKind.Equal, 0.0);
            var a4 = new Antecedent(0, ComparisonKind.Equal, 1.0);

            bool a12 = a1.Equals(a2);
            bool a34 = a3.Equals(a4);
            bool a14 = a1.Equals(a4);

            Assert.IsFalse(a12);
            Assert.IsFalse(a34);
            Assert.IsTrue(a14);

            int hash1 = a1.GetHashCode();
            int hash2 = a2.GetHashCode();
            int hash3 = a3.GetHashCode();
            int hash4 = a4.GetHashCode();

            Assert.AreNotEqual(hash1, hash2);
            Assert.AreNotEqual(hash3, hash4);
            Assert.AreEqual(hash1, hash4);
        }
示例#9
0
        public UpdateAntecedentPage(Antecedent antecedent)
        {
            InitializeComponent();
            var viewModel = new UpdateAntecedentViewModel();

            viewModel.Antecedent = antecedent;
            BindingContext       = viewModel;
        }
示例#10
0
 public bool RelationallyEquivalentTo(IEvaluatable evaluatable)
 {
     if (evaluatable.GetType() == typeof(Implication))
     {
         var implication = evaluatable as Implication;
         return(Antecedent.RelationallyEquivalentTo(implication.Antecedent) && Consequent.RelationallyEquivalentTo(implication.Consequent));
     }
     return(false);
 }
 /// <summary>
 /// Compares two decision option objects
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(DecisionOption other)
 {
     //check on reference equality first
     //custom logic for comparing two objects
     return(ReferenceEquals(this, other) ||
            (other != null &&
             Consequent == other.Consequent &&
             Antecedent.Length == other.Antecedent.Length &&
             Antecedent.All(ant => other.Antecedent.Any(ant2 => ant == ant2))));
 }
        private void AddRule(object obj)
        {
            LinguisticVariable linguistic = (LinguisticVariable)linguistics.Where(lv => lv.Title == ConsequentM.SelectedTitle).First();
            Antecedent         antecedent = AntecedentM.Make();
            Judgment           consequent = ConsequentM.Make();

            Rule newRule = new SimpleRule(linguistic, antecedent, consequent);

            SaveToDB(newRule);
        }
        //{"antecedent":{"name":"lalo","description":"descripcion","type":"heredofamiliar","clinical_history_id":"1"}}  return id
        private void CreateAntecedent(Antecedent pAntecedent)
        {
            string        param       = "/antecedent";
            Antecedent_Tr transaction = new Antecedent_Tr();

            transaction.antecedent = pAntecedent;
            string json = JsonConvert.SerializeObject(transaction);

            RESTHelper.PostJSON(param, json);
        }
示例#14
0
        private Antecedent GetAntecedentFromJson(string json)
        {
            Antecedent antecedent = new Antecedent();
            IList <LogicalConnection> connections = new List <LogicalConnection> {
                LogicalConnection.AND, LogicalConnection.OR
            };

            antecedent = GetAntecedentFromJsonByTermSet(json, connections);

            return(antecedent);
        }
        private void SetEditedRule()
        {
            if (AntecedentM != null && ConsequentM != null)
            {
                LinguisticVariable linguistic = SelectedRule.LinguisticVariable;
                Antecedent         antecedent = AntecedentM.Make();
                Judgment           consequent = ConsequentM.Make();

                editedRule = new SimpleRule(linguistic, antecedent, consequent);
            }
        }
        public IHttpActionResult GetAntecedent(int id)
        {
            Antecedent antecedent = db.Antecedents.Find(id);

            if (antecedent == null)
            {
                return(NotFound());
            }

            return(Ok(antecedent));
        }
        public IHttpActionResult PostAntecedent(Antecedent antecedent)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Antecedents.Add(antecedent);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = antecedent.AntecedentId }, antecedent));
        }
示例#18
0
        //public FailureLevel ConsequentFailureLevel { get; set; }

        public RuleCheckResult RunRuleAgainstObject(object dataStructureObject)
        {
            RuleCheckResult result = new RuleCheckResult(this);

            result.Object = dataStructureObject;


            try
            {
                result.AntecedentEvaluatesToTrue = Antecedent.EvaluateAgainstObject(dataStructureObject);
            }
            catch (Exception ex)
            {
                result.ResultText = "Error evaluating antecedent: " + ex.Message;
                result.HasError   = true;
                return(result);
            }

            try
            {
                if (result.AntecedentEvaluatesToTrue.Value)
                {
                    result.ConsequentEvaluatesToTrue = Consequent.EvaluateAgainstObject(dataStructureObject);
                }
            }
            catch (Exception ex)
            {
                result.ResultText = "Error evaluating consequent: " + ex.Message;
                result.HasError   = true;
                return(result);
            }


            if (result.AntecedentEvaluatesToTrue.Value)
            {
                if (result.ConsequentEvaluatesToTrue.Value)
                {
                    result.ResultText = $"PASS: {Consequent.GetSentence()}";
                }
                else
                {
                    result.ResultText = $"{Enum.GetName(typeof(OutcomeLevelEnum), OutcomeLevel)}: {Consequent.GetSentence()}";
                }
            }
            else
            {
                result.ResultText = $"N/A: {Antecedent.GetSentence()}";
            }
            result.Stopwatch.Stop();
            return(result);
        }
        public IHttpActionResult DeleteAntecedent(int id)
        {
            Antecedent antecedent = db.Antecedents.Find(id);

            if (antecedent == null)
            {
                return(NotFound());
            }

            db.Antecedents.Remove(antecedent);
            db.SaveChanges();

            return(Ok(antecedent));
        }
示例#20
0
文件: Rule.cs 项目: sibsau-STF/AI
        public float getSimilarDegree(Rule rule)
        {
            float degree = 0;

            //получаем количество совпадений и вычисляем коэффициент
            List <string> similars = new List <string>(rule.Antecedent);
            //similars.retainAll(Antecedent);
            var sim = from t in rule.Antecedent
                      where Antecedent.Contains(t)
                      select t;

            degree = (float)similars.Count / (float)Antecedent.Count;

            return(degree);
        }
示例#21
0
        private KB.Rule GetRuleFromDataTableRow(DataColumnCollection columns, DataRow row)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            for (int col = 0; col < columns.Count; col++)
            {
                data.Add(columns[col].ColumnName, row[col]);
            }

            LinguisticVariable linguisticVariable = GetLinguisticVariableFromDataTableRow(columns, row);
            Antecedent         antecedent         = GetAntecedentFromJson(data["Antecedent"].ToString());
            Judgment           consequent         = GetJudgmentFromJson(data["Consequent"].ToString());

            return(new SimpleRule(linguisticVariable, antecedent, consequent));
        }
        public void IsInconsistentTest()
        {
            var a1 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a2 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a3 = new Antecedent(0, ComparisonKind.Equal, 0.0);

            var rule1 = new DecisionRule(0, a1);
            var rule2 = new DecisionRule(0, a2);
            var rule3 = new DecisionRule(0, a3);

            bool a12 = rule1.IsInconsistentWith(rule2);
            bool a13 = rule1.IsInconsistentWith(rule3);

            Assert.IsFalse(a12);
            Assert.IsFalse(a13);
        }
示例#23
0
        public void IsInconsistentTest()
        {
            var a1 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a2 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a3 = new Antecedent(0, ComparisonKind.Equal, 0.0);

            var rule1 = new DecisionRule(0, a1);
            var rule2 = new DecisionRule(0, a2);
            var rule3 = new DecisionRule(0, a3);

            bool a12 = rule1.IsInconsistentWith(rule2);
            bool a13 = rule1.IsInconsistentWith(rule3);

            Assert.IsFalse(a12);
            Assert.IsFalse(a13);
        }
示例#24
0
        public async void EditAntecedent()
        {
            Value = true;
            var connection = await apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Warning,
                    Languages.CheckConnection,
                    Languages.Ok);

                return;
            }
            if (string.IsNullOrEmpty(Antecedent.description))
            {
                Value = true;
                return;
            }
            var antecedent = new Antecedent
            {
                id          = Antecedent.id,
                description = Antecedent.description
            };
            var cookie = Settings.Cookie;  //.Split(11, 33)
            var res    = cookie.Substring(11, 32);

            var response = await apiService.Put <Antecedent>(
                "https://portalesp.smart-path.it",
                "/Portalesp",
                "/antecedent/update",
                res,
                antecedent);

            if (!response.IsSuccess)
            {
                await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok");

                return;
            }
            Value = false;
            AntecedentViewModel.GetInstance().Update(antecedent);

            DependencyService.Get <INotification>().CreateNotification("PortalSP", "Antecedent Updated");
            await App.Current.MainPage.Navigation.PopPopupAsync(true);
        }
示例#25
0
        public ActionResult Create([Bind(Include = "ID_Consultation,dateCreation,motif,note,poids,taille,temperature,systol,diastol,diagnostique,maladie,ID_Patient,ID_Staff")] Consultation consultation)
        {
            Vaccin     vaccin                 = new Vaccin();
            Ordonnance ordonnance             = new Ordonnance();
            Antecedent antecedentConsultation = new Antecedent();

            if (ModelState.IsValid)
            {
                db.Consultations.Add(consultation);
                string prescription = Request["prescription"].ToString();
                string medicament   = Request["medicament"].ToString();
                string vac          = Request["vac"].ToString();
                string antecedent   = Request["ant"];

                if (!string.IsNullOrEmpty(antecedent))
                {
                    antecedentConsultation.ID_Consultation = consultation.ID_Consultation;
                    antecedentConsultation.ID_Patient      = consultation.ID_Patient;
                    antecedentConsultation.description     = antecedent;
                    db.Antecedents.Add(antecedentConsultation);
                }

                if (!string.IsNullOrEmpty(vac))
                {
                    vaccin.ID_Consultation = consultation.ID_Consultation;
                    vaccin.ID_PATIENT      = consultation.ID_Patient;
                    vaccin.description     = vac;
                    vaccin.date            = DateTime.Now;
                    db.Vaccins.Add(vaccin);
                }
                if (!string.IsNullOrEmpty(medicament))
                {
                    ordonnance.ID_Consultation = consultation.ID_Consultation;
                    ordonnance.medicament      = medicament;
                    ordonnance.prescription    = !string.IsNullOrEmpty(prescription) ? prescription : "";
                    db.Ordonnances.Add(ordonnance);
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.ID_Patient = new SelectList(db.Patients, "ID_Patient", "nom", consultation.ID_Patient);
            ViewBag.ID_Staff   = new SelectList(db.Staffs, "ID_Staff", "nom", consultation.ID_Staff);

            return(View(consultation));
        }
示例#26
0
        private void ButtonAddAntecedent_Click(object sender, RoutedEventArgs e)
        {
            AreButtonsEnabled = false;
            string name = TextBoxAntecedentName.Text;

            if (string.IsNullOrEmpty(name) || string.IsNullOrWhiteSpace(name))
            {
                MessageBox.Show("Debe ingresar un nombre para el antecedente", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                AreButtonsEnabled = true;
                return;
            }

            if (ComboBoxAntecedentTypes.SelectedItem == null)
            {
                MessageBox.Show("Debe seleccionar un tipo de antecedente", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                AreButtonsEnabled = true;
                return;
            }

            Antecedent antecedent = new Antecedent()
            {
                Name = name,
                Type = (AntecedentType)ComboBoxAntecedentTypes.SelectedIndex
            };

            App.DbContext.Antecedents.Add(antecedent);

            try
            {
                App.DbContext.SaveChanges();
            }
            catch
            {
                MessageBox.Show("No se pudieron guardar los cambios en la base de datos", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                AreButtonsEnabled = true;
                return;
            }

            MessageBox.Show("Antecedente agregado con éxito", "Éxito", MessageBoxButton.OK, MessageBoxImage.Information);
            TextBoxAntecedentName.Text           = string.Empty;
            ComboBoxAntecedentTypes.SelectedItem = null;
            Antecedents.Add(antecedent);
            AreButtonsEnabled = true;
        }
示例#27
0
        public Antecedent Make()
        {
            Antecedent antecedent = new Antecedent();

            IDictionary <int, IList <Judgment> > judgmentsDict = GetJudgmentDictionary();

            foreach (IList <Judgment> judgments in judgmentsDict.Values)
            {
                if (judgments.Count == 1)
                {
                    antecedent.AND(judgments.First());
                }
                else
                {
                    antecedent.OR(judgments.ToArray());
                }
            }

            return(antecedent);
        }
示例#28
0
        private KB.Rule GetRule42()
        {
            Antecedent antecedent;
            Judgment   consequent;

            antecedent = new Antecedent()
                         .OR(new Judgment(FactorTitle.K2U, FactorFuzzyValue.Exceeding), new Judgment(FactorTitle.K2U, FactorFuzzyValue.Maximum));
            consequent = new Judgment(FactorTitle.K2Ui, FactorFuzzyValue.Unsuccessful);

            LinguisticVariable linguistic = new LinguisticVariable(
                FactorTitle.K2Ui,
                null,
                new List <FactorFuzzyValue> {
                FactorFuzzyValue.Unsuccessful, FactorFuzzyValue.Successful
            },
                "Несимметрия напряжений",
                "%"
                );

            return(new SimpleRule(linguistic, antecedent, consequent));
        }
示例#29
0
        private KB.Rule GetRule21()
        {
            Antecedent antecedent;
            Judgment   consequent;

            antecedent = new Antecedent()
                         .OR(new Judgment(FactorTitle.Ua, FactorFuzzyValue.Exceeding), new Judgment(FactorTitle.Ub, FactorFuzzyValue.Exceeding), new Judgment(FactorTitle.Uc, FactorFuzzyValue.Exceeding));
            consequent = new Judgment(FactorTitle.dUabc, FactorFuzzyValue.Exceeding);

            LinguisticVariable linguistic = new LinguisticVariable(
                FactorTitle.dUabc,
                null,
                new List <FactorFuzzyValue> {
                FactorFuzzyValue.Nominal, FactorFuzzyValue.Maximum, FactorFuzzyValue.Exceeding
            },
                "Отклонение напряжения по фазам А, В, С",
                "%"
                );

            return(new SimpleRule(linguistic, antecedent, consequent));
        }
示例#30
0
        private KB.Rule GetRule31()
        {
            Antecedent antecedent;
            Judgment   consequent;

            antecedent = new Antecedent()
                         .OR(new Judgment(FactorTitle.Ua, FactorFuzzyValue.Exceeding), new Judgment(FactorTitle.Ub, FactorFuzzyValue.Exceeding), new Judgment(FactorTitle.Uc, FactorFuzzyValue.Exceeding));
            consequent = new Judgment(FactorTitle.KU, FactorFuzzyValue.Exceeding);

            LinguisticVariable linguistic = new LinguisticVariable(
                FactorTitle.KU,
                null,
                new List <FactorFuzzyValue> {
                FactorFuzzyValue.Nominal, FactorFuzzyValue.Maximum, FactorFuzzyValue.Exceeding
            },
                "Коэффициент искажения синусоидальности кривой напряжения",
                "%"
                );

            return(new SimpleRule(linguistic, antecedent, consequent));
        }
示例#31
0
        private KB.Rule GetRule14()
        {
            Antecedent antecedent;
            Judgment   consequent;

            antecedent = new Antecedent()
                         .AND(new Judgment(FactorTitle.Weather, FactorFuzzyValue.Successful));
            consequent = new Judgment(FactorTitle.Uimp, FactorFuzzyValue.Nominal);

            LinguisticVariable linguistic = new LinguisticVariable(
                FactorTitle.Uimp,
                null,
                new List <FactorFuzzyValue> {
                FactorFuzzyValue.Nominal, FactorFuzzyValue.Maximum, FactorFuzzyValue.Exceeding
            },
                "Грозовые импульсные напряжения",
                "В"
                );

            return(new SimpleRule(linguistic, antecedent, consequent));
        }
示例#32
0
        private KB.Rule GetRule51()
        {
            Antecedent antecedent;
            Judgment   consequent;

            antecedent = new Antecedent()
                         .OR(new Judgment(FactorTitle.KU, FactorFuzzyValue.Exceeding), new Judgment(FactorTitle.KUn, FactorFuzzyValue.Exceeding));
            consequent = new Judgment(FactorTitle.Uns, FactorFuzzyValue.Exceeding);

            LinguisticVariable linguistic = new LinguisticVariable(
                FactorTitle.Uns,
                null,
                new List <FactorFuzzyValue> {
                FactorFuzzyValue.Nominal, FactorFuzzyValue.Maximum, FactorFuzzyValue.Exceeding
            },
                "Несинусоидальность напряжения",
                "В"
                );

            return(new SimpleRule(linguistic, antecedent, consequent));
        }