Exemple #1
0
        private void TaskTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (TaskTypeComboBox.SelectedIndex != SourceTaskType)
            {
                SourceTaskType = TaskTypeComboBox.SelectedIndex;
                SimplexTables.Clear();

                if (!IsNewTask)
                {
                    CanonicalTaskType = TaskTypeComboBox.SelectedIndex;
                    for (int i = 0; i < CanonicalN; i++)
                    {
                        CanonicalVectorc[i] = -CanonicalVectorc[i];
                    }
                }

                PrintSolveLog(TaskInfotextBox);

                SimplexTable smptbl = new SimplexTable(CanonicalN, CanonicalM);
                smptbl.GetTable(CanonicalMatrixA, CanonicalVectorb, CanonicalVectorc);
                smptbl.TaskType = CanonicalTaskType;
                SimplexTables.Add(smptbl);
                currentSimplexTable = SimplexTables.Count - 1;
                UpdateSimplexGrid();
                OpenTableMode();
            }
        }
Exemple #2
0
        private void NewTaskToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewTaskForm ntf = new NewTaskForm();

            if (ntf.ShowDialog() == DialogResult.OK)
            {
                TaskEditForm tef = new TaskEditForm();

                tef.InitForm(ntf.N, ntf.M);

                if (tef.ShowDialog() == DialogResult.OK)
                {
                    IsNewTask = true;

                    TaskTypeComboBox.SelectedIndex = tef.TaskType;
                    SimplexTables.Clear();

                    SourceN        = tef.N;
                    SourceM        = tef.M;
                    SourceSign     = tef.Signs;
                    SourceVectorb  = tef.Vectorb;
                    SourceVectorc  = tef.Vectorc;
                    SourceMatrixA  = tef.MatrixA;
                    SourceTaskType = tef.TaskType;

                    PrintSolveLog(TaskInfotextBox);

                    SimplexTable smptbl = new SimplexTable(CanonicalN, CanonicalM);
                    smptbl.GetTable(CanonicalMatrixA, CanonicalVectorb, CanonicalVectorc);
                    smptbl.TaskType = CanonicalTaskType;
                    SimplexTables.Add(smptbl);
                    currentSimplexTable = SimplexTables.Count - 1;
                    UpdateSimplexGrid();
                    OpenTableMode();
                }
            }
        }