Esempio n. 1
0
        public AnswerForm(StepTable zeroTable)
        {
            InitializeComponent();
            var solution = new Solution(zeroTable);

            boxValue.Text = solution.Value.ToString();

            listUnknowns.Items.Clear();
            for (int i = 0; i < solution.Unknowns.Length; i++)
            {
                listUnknowns.Items.Add(new ListViewItem(new string[] { $"x{i + 1}", $"{solution.Unknowns[i]}" }));
            }
        }
Esempio n. 2
0
        public BasisForm(int unknowns, double[] mainCoefficients, double[][] restrictionCoefficients, double[] freeMembers)
        {
            InitializeComponent();
            lblBasis.Text = $"Выберите {restrictionCoefficients.Length} базисные переменные";

            for (int i = 0; i < unknowns; i++)
            {
                boxBasis.Items.Add("x" + (i + 1));
            }



            btnNext.Click += (s, a) =>
            {
                var basisIndex = boxBasis.CheckedIndices.Cast <int>().ToArray();
                if (basisIndex.Length != restrictionCoefficients.Length)
                {
                    MessageBox.Show("Выбрано неверное количество базисных переменных");
                    return;
                }
                var firstTable = new StepTable(mainCoefficients, basisIndex, freeMembers, restrictionCoefficients);
                new AnswerForm(firstTable).Show();
            };
        }