Пример #1
0
 public Parameter(FactorTitle title, string description, int value, string unit)
 {
     this.Title       = title;
     this.Description = description;
     this.Value       = value;
     this.Unit        = unit;
 }
Пример #2
0
 public ConsequentM(
     IList <ILinguisticVariable> linguistics,
     IList <FactorFuzzyValue> termSets,
     FactorTitle title,
     FactorFuzzyValue fuzzyValue) : this(linguistics, termSets)
 {
     SelectedTitle      = title;
     SelectedFuzzyValue = fuzzyValue;
 }
 public LinguisticVariable(
     FactorTitle title,
     FactorFuzzyValue fuzzyValue,
     Dictionary <FactorFuzzyValue, decimal[]> valueRanges,
     IList <FactorFuzzyValue> termSet,
     string description,
     string unit
     ) : this(title, valueRanges, termSet, description, unit)
 {
     this.FuzzyValue = fuzzyValue;
 }
Пример #4
0
 public JudgmentM(
     IList <ILinguisticVariable> linguistics,
     IList <FactorFuzzyValue> termSets,
     FactorTitle title,
     FactorFuzzyValue fuzzyValue,
     LogicalConnection connection
     ) : this(linguistics, termSets, null)
 {
     SelectedTitle      = title;
     SelectedFuzzyValue = fuzzyValue;
     SelectedConnection = connection;
 }
 public LinguisticVariable(
     FactorTitle title,
     Dictionary <FactorFuzzyValue, decimal[]> valueRanges,
     IList <FactorFuzzyValue> termSet,
     string description,
     string unit
     )
 {
     this.Title       = title;
     this.ValueRanges = valueRanges;
     this.TermSet     = termSet;
     this.Description = description;
     this.Unit        = unit;
 }
Пример #6
0
        private bool IsCorrectFuzzyVariable()
        {
            FactorTitle      title      = (FactorTitle)SelectedTitle;
            FactorFuzzyValue fuzzyValue = (FactorFuzzyValue)SelectedFuzzyValue;

            ILinguisticVariable linguistic = linguistics.Where(lv => lv.Title == title).First();

            if (!linguistic.TermSet.Contains(fuzzyValue))
            {
                return(false);
            }

            return(true);
        }
Пример #7
0
        private IList <Judgment> GetJudgmentListFromString(IList <string> judgmentStrList)
        {
            IList <Judgment> judgments = new List <Judgment>();

            foreach (string judgment in judgmentStrList)
            {
                string[] words = Regex.Split(judgment, "—");

                FactorTitle      title      = (FactorTitle)Enum.Parse(typeof(FactorTitle), words.First());
                FactorFuzzyValue fuzzyValue = (FactorFuzzyValue)Enum.Parse(typeof(FactorFuzzyValue), words.Last());

                judgments.Add(new Judgment(title, fuzzyValue));
            }

            return(judgments);
        }
Пример #8
0
        private LinguisticVariable GetLinguisticVariableFromDataTableRow(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]);
            }

            FactorTitle title = (FactorTitle)Enum.Parse(typeof(FactorTitle), data["Title"].ToString());
            IList <FactorFuzzyValue> termSet = GetTermSet(data["TermSet"].ToString());
            Dictionary <FactorFuzzyValue, decimal[]> valueRanges = GetValueRanges(data["ValueRange"].ToString(), termSet);
            string description = data["Description"].ToString();
            string unit        = data["Unit"].ToString();

            return(new LinguisticVariable(title: title, termSet: termSet, valueRanges: valueRanges, description: description, unit: unit));
        }
Пример #9
0
        public LinguisticVariableForView(
            FactorTitle title,
            FactorFuzzyValue fuzzyValue,
            decimal?value,
            Dictionary <FactorFuzzyValue, decimal[]> valueRanges,
            IList <FactorFuzzyValue> termSet,
            string description,
            string unit
            )
        {
            this.Title       = title;
            this.FuzzyValue  = fuzzyValue;
            this.Value       = value;
            this.ValueRanges = valueRanges;
            this.TermSet     = termSet;
            this.Description = description;
            this.Unit        = unit;

            if (valueRanges != null &&
                valueRanges.Count == 3)
            {
                if (valueRanges[FactorFuzzyValue.Nominal][0] == valueRanges[FactorFuzzyValue.Maximum][0])
                {
                    Colors[1] = "Lime";
                    Colors[2] = "Lime";
                    Colors[3] = "Yellow";
                    Colors[4] = "Orange";
                    Colors[5] = "Red";

                    Values[1] = valueRanges[FactorFuzzyValue.Nominal][0].ToString();
                    Values[2] = "";
                    Values[3] = valueRanges[FactorFuzzyValue.Nominal][1].ToString();
                    Values[4] = "";
                    Values[5] = valueRanges[FactorFuzzyValue.Maximum][1].ToString();

                    decimal min         = ValueRanges[FactorFuzzyValue.Maximum][0];
                    decimal max         = ValueRanges[FactorFuzzyValue.Maximum][1];
                    decimal endNominal  = ValueRanges[FactorFuzzyValue.Nominal][1];
                    decimal middleRange = (endNominal - min) / (max - min);
                    Offsets[1] = 0;
                    Offsets[2] = 0;
                    Offsets[3] = middleRange;
                    Offsets[4] = 0.85m;
                    Offsets[5] = 1;
                }
                else
                {
                    Colors[1] = "Red";
                    Colors[2] = "Yellow";
                    Colors[3] = "Lime";
                    Colors[4] = "Yellow";
                    Colors[5] = "Red";

                    Values[1] = valueRanges[FactorFuzzyValue.Maximum][0].ToString();
                    Values[2] = valueRanges[FactorFuzzyValue.Nominal][0].ToString();
                    Values[3] = "";
                    Values[4] = valueRanges[FactorFuzzyValue.Nominal][1].ToString();
                    Values[5] = valueRanges[FactorFuzzyValue.Maximum][1].ToString();

                    decimal min          = ValueRanges[FactorFuzzyValue.Maximum][0];
                    decimal max          = ValueRanges[FactorFuzzyValue.Maximum][1];
                    decimal startNominal = ValueRanges[FactorFuzzyValue.Nominal][0];
                    decimal endNominal   = ValueRanges[FactorFuzzyValue.Nominal][1];
                    decimal startMiddle  = (startNominal - min) / (max - min);
                    decimal endMiddle    = (endNominal - min) / (max - min);
                    Offsets[1] = 0;
                    Offsets[2] = startMiddle;
                    Offsets[3] = 0.5m;
                    Offsets[4] = endMiddle;
                    Offsets[5] = 1;
                }
            }
            else if (valueRanges != null &&
                     valueRanges.Count == 2)
            {
                Colors[1] = "Lime";
                Colors[2] = "Lime";
                Colors[3] = "Yellow";
                Colors[4] = "Orange";
                Colors[5] = "Red";

                Values[1] = valueRanges[FactorFuzzyValue.Successful][0].ToString();
                Values[2] = "";
                Values[3] = "";
                Values[4] = "";
                Values[5] = valueRanges[FactorFuzzyValue.Successful][1].ToString();

                Offsets[1] = 0;
                Offsets[2] = 0.25m;
                Offsets[3] = 0.75m;
                Offsets[4] = 0.9m;
                Offsets[5] = 1;
            }
            else
            {
                Colors[1] = "Lime";
                Colors[2] = "Lime";
                Colors[3] = "Red";
                Colors[4] = "Red";
                Colors[5] = "Red";

                Values[1] = "Есть";
                Values[2] = "";
                Values[3] = "";
                Values[4] = "";
                Values[5] = "Нет";

                Offsets[1] = 0;
                Offsets[2] = 0.25m;
                Offsets[3] = 0.7m;
                Offsets[4] = 0.85m;
                Offsets[5] = 1;
            }
        }
Пример #10
0
 public Judgment(FactorTitle title, FactorFuzzyValue fuzzyValue)
 {
     Title      = title;
     FuzzyValue = fuzzyValue;
 }