Пример #1
0
 private string NorrisToString(List<Concept> L, Context a)
 {
     string str = "";
     for (int j = 0; j < L.Count; j++)
         str += concept_toString(L[j], a);
     return str;
 }
Пример #2
0
 private void norrisbtn_Click(object sender, EventArgs e)
 {
     List<Concept> L = new List<Concept>();
     Context a = new Context(In_Sets, objects, attributes);
     L = Norris(a.body);
     string str = NorrisToString(L, a);
     hyp_out.Text = str;
     Console.Write(str);
 }
Пример #3
0
        private void dsm_btn_Click(object sender, EventArgs e)
        {
            int counter = 0;
            Context plus = new Context(In_Sets, objects, attributes);
            Context minus = new Context(Out_Sets, attributes1, objects1);
            List<SmallSet> L = new List<SmallSet>();

            for (int i = 0; i < tau.RowCount; i++)
            {
                SmallSet a = new SmallSet(tau, i);
                L.Add(a);
            }
            List<String> Obj=new List<String>();
            for (int i=0; i<objects2.RowCount; i++)
            {
                String a=Convert.ToString(objects2[0, i].Value);
                Obj.Add(a);
            }
            List<Concept> plus_hyp = new List<Concept>();
            List<Concept> minus_hyp = new List<Concept>();
            bool diff = true;
            while (diff)
            {
                counter++;
                int d = 0;
                plus_hyp = Norris(plus.body);
                minus_hyp = Norris(minus.body);
                string str = NorrisToString(plus_hyp, plus);
                string str1 = NorrisToString(minus_hyp, minus);
                str1 += "||||||";
                str1 += str;
                hyp_out.Text = str1;

                for (int j = 0; j < L.Count; j++)
                {
                    bool ind_plus = check(L[j], plus_hyp);
                    bool ind_minus = check(L[j], minus_hyp);
                    if (ind_plus && !ind_minus)
                    {
                        plus.body.Add(L[j]);
                        plus.unObj.Add(Obj[j]);
                        d++;
                    }
                    if (!ind_plus && ind_minus)
                    {
                        minus.body.Add(L[j]);
                        minus.unObj.Add(Obj[j]);
                        d++;
                    }
                    if (ind_plus || ind_minus)
                    {
                        L.Remove(L[j]);
                        Obj.Remove(Obj[j]);
                        j--;
                        d++;
                    }
                }
                if (d == 0)
                    diff = false;
            }
            plus.toDataGridView(In_Sets, objects);
            minus.toDataGridView(Out_Sets, attributes1);

            norrisout.Text = counter.ToString();
        }
Пример #4
0
        private void getColsBtn_Click(object sender, EventArgs e)
        {
            int k = Convert.ToInt32(sizeRows_DSM.Text);
            int j = Convert.ToInt32(sizeCols_DSM.Text);
            Out_Sets.RowCount = j;
            Out_Sets.ColumnCount = k;
            objects1.RowCount = 1;
            objects1.ColumnCount = Out_Sets.ColumnCount;
            attributes1.RowCount = Out_Sets.RowCount;
            attributes1.ColumnCount = 1;
            Context a = new Context(In_Sets, objects, attributes);
            List<SmallSet> b = new List<SmallSet>();
            b = a.ColumnsToSets();
            for (int i = 0; i < b.Count; i++)
                b[i].ToDataGridView(Out_Sets, i);

            for (int i = 0; i < Out_Sets.ColumnCount; i++)
                objects1[i, 0].Value = a.unObj[i];
            for (int i = 0; i < Out_Sets.RowCount; i++)
                attributes1[0, i].Value = a.unAtr[i];
        }
Пример #5
0
 private string concept_toString(Concept a, Context c)
 {
     string b = "<{";
     for (int i = 0; i < c.unAtr.Count; i++)
         if (a.Ext[i] == true)
             b += c.unAtr[i] + " ";
     b+= "}, {";
     for (int i = 0; i < c.unObj.Count; i++)
         if (a.Int[i] == true)
             b += c.unObj[i] + " ";
     b+="}>";
     return b;
 }