Exemplo n.º 1
0
        private void buttonEditTerm_Click(object sender, EventArgs e)
        {
            if (dataGridTerms.SelectedRows.Count > 0)
            {
                if (MessageBox.Show(this, "Изменить выбранный терм?", "Подтверждение операции", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
                {
                    fuzzyFuncs func = (fuzzyFuncs)dataGridTerms.SelectedRows[0].Cells[0].Value;
                    string fuzzyName = func.fuzzyName;

                    switch (comboType.SelectedItem.ToString())
                    {
                        case "Линейная Z":
                            {
                                double a = Convert.ToDouble(trackA.Value / ktrack);
                                double b = Convert.ToDouble(trackB.Value / ktrack);
                                func = new zLinear(lingvoName, fuzzyName, a, b);
                            } break;
                        case "Линейная Сплайн":
                            {
                                double a = Convert.ToDouble(trackA.Value / ktrack);
                                double b = Convert.ToDouble(trackB.Value / ktrack);
                                func = new sLinear(lingvoName, fuzzyName, a, b);
                            } break;
                        case "Треугольная":
                            {
                                double a = Convert.ToDouble(trackA.Value / ktrack);
                                double b = Convert.ToDouble(trackB.Value / ktrack);
                                double c = Convert.ToDouble(trackC.Value / ktrack);
                                func = new triangleFunc(lingvoName, fuzzyName, a, b, c);
                            } break;
                        case "Трапецевидная":
                            {
                                double a = Convert.ToDouble(trackA.Value / ktrack);
                                double b = Convert.ToDouble(trackB.Value / ktrack);
                                double c = Convert.ToDouble(trackC.Value / ktrack);
                                double d = Convert.ToDouble(trackD.Value / ktrack);
                                func = new trapFunc(lingvoName, fuzzyName, a, b, c, d);
                            } break;
                    }
                    fuzzyFlist[dataGridTerms.SelectedRows[0].Index] = func;

                    dataGridTerms.SelectedRows[0].Cells[0].Value = func;
                    dataGridTerms.SelectedRows[0].Cells[2].Value = comboType.SelectedItem.ToString();
                    showTerm();
                }
            }
        }
Exemplo n.º 2
0
 public fuzzyProfit3()
 {
     app = new triangleFunc(200,300,800);
     cost = new trapFunc(250, 500, 800, 2000);
     discount = new trapFunc(3, 5, 7, 10);
     count = new triangleFunc(15, 20, 30);
     app.fuzzyName = "Обращения граждан (шт)";
     cost.fuzzyName = "Стоимость обслуживания (руб)";
     discount.fuzzyName = "Скидка льготным категориям (%)";
     count.fuzzyName = "Количество льготников (%)";
 }