Пример #1
0
        public static FuzzySet operator!(FuzzySet operand) //static->不屬於物件
        {
            FuzzySet fs = null;

            fs = new UnaryOperatedFuzzySet(new Not(), operand);
            return(fs);
        }
Пример #2
0
        //    delegate void
        //public double MaximumDegree()
        //{

        //}
        public FuzzySet MamdaniInference(List <FuzzySet> condition)
        {
            FuzzySet result       = null;
            double   fireStrength = 1.0;

            for (int i = 0; i < inputFuzzySets.Count; i++)
            {
                double temp = ((inputFuzzySets[i]) & (condition[i])).getMaxDegree(); //交集取最大值
                if (temp < fireStrength)                                             //取最小值
                {
                    fireStrength = temp;
                }
                result = new UnaryOperatedFuzzySet(new ValueCut(fireStrength), outputFuzzySet); //cut value
            }
            return(result);
        }
Пример #3
0
        //加入unary fuzzy set
        private void btnAddUnary_Click(object sender, EventArgs e)
        {
            UnaryOperator op    = null; //local variable default
            TreeNode      tn    = treeViewInputUniverse.SelectedNode;
            int           level = tn.Level;
            int           idx   = tn.Index;
            FuzzySet      SelectedFS;

            if (level == 1 && tn != null) //選到FS
            {
                SelectedFS = allInputFuzzySets[tn.Parent.Index][tn.Index];
            }
            else //exception
            {
                MessageBox.Show("You must select a fuzzy set", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            switch (listBoxUnary.SelectedIndex)
            {
            case 0:     //Not
                op = new Not();
                break;

            case 1:     //Value Scale
                op = new ValueScale(Convert.ToDouble(txtUnaryParameter.Text));
                break;

            case 2:    //Value Cut
                op = new ValueCut(Convert.ToDouble(txtUnaryParameter.Text));
                break;

            case 3:    //Very
                op = new Very();
                break;

            case 4:    //Very Very
                op = new VeryVery();
                break;

            case 5:    //Extremely
                op = new Extremely();
                break;

            case 6:    //more or less
                op = new MoreOrLess();
                break;

            case 7:    //Intensify
                op = new Intensify();
                break;

            case 8:     //Diminisher
                op = new Diminisher();
                break;

            case 9:     //Sugeno Not
                op = new SugenoNot(Convert.ToDouble(txtUnaryParameter.Text));
                break;

            case 10:     //Yager Not
                op = new YagerNot(Convert.ToDouble(txtUnaryParameter.Text));
                break;
            }
            //加入各清單之中
            UnaryOperatedFuzzySet UFS = new UnaryOperatedFuzzySet(op, SelectedFS);

            InputfuzzySetObjects.Add(UFS);
            allInputFuzzySets[tn.Parent.Index].Add(UFS);
            comboBoxBinary1stFS.Items.Add(UFS);
            comboBoxBinary2ndFS.Items.Add(UFS);
            //add a node to represent the fuzzyset
            TreeNode tnn = new TreeNode(UFS.title);

            tnn.ImageIndex         = 1;
            tnn.SelectedImageIndex = 1;
            treeViewInputUniverse.Nodes[tn.Parent.Index].Nodes.Add(tnn);
            chartInput.Series.Add(UFS.line);
        }