예제 #1
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;
 }
예제 #3
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;
 }
예제 #4
0
        private IList <FactorFuzzyValue> GetTermSet(string json)
        {
            json = json.Trim(' ');
            IList <FactorFuzzyValue> fuzzyValues  = new List <FactorFuzzyValue>();
            IList <string>           valueStrList = GetListValuesFromJson(json, "FuzzyValues");

            foreach (string valueStr in valueStrList)
            {
                FactorFuzzyValue fuzzyValue = (FactorFuzzyValue)Enum.Parse(typeof(FactorFuzzyValue), valueStr);
                fuzzyValues.Add(fuzzyValue);
            }

            return(fuzzyValues);
        }
예제 #5
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);
        }
예제 #6
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);
        }
예제 #7
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;
            }
        }
예제 #8
0
 public Judgment(FactorTitle title, FactorFuzzyValue fuzzyValue)
 {
     Title      = title;
     FuzzyValue = fuzzyValue;
 }