static void Main(string[] args) { double[,] table = { { 25, -3, 5 }, { 30, -2, 5 }, { 10, 1, 0 }, { 6, 3, -8 }, { 0, -6, -5 } }; double[] result = new double[2]; double[,] table_result; Simplex S = new Simplex(table); table_result = S.Calculate(result); Console.WriteLine("Решенная симплекс-таблица:"); for (int i = 0; i < table_result.GetLength(0); i++) { for (int j = 0; j < table_result.GetLength(1); j++) { Console.Write(table_result[i, j] + " "); } Console.WriteLine(); } Console.WriteLine(); Console.WriteLine("Решение:"); Console.WriteLine("X[1] = " + result[0]); Console.WriteLine("X[2] = " + result[1]); Console.ReadLine(); }
static void Main(string[] args) { double[,] table = { { 48, -6, 8 }, { 192, 12, 8 }, { 0, -8, -7 } }; double[] result = new double[2]; double[,] table_result; Simplex S = new Simplex(table); //канонічна форма Console.WriteLine("Початковий вигляд"); S.showTable(); S.Calculate(result); Console.WriteLine(); Console.WriteLine("Розв'язок:"); Console.WriteLine("X[1] = " + result[0]); Console.WriteLine("X[2] = " + result[1]); Console.WriteLine("Z = " + (result[0] * -table[2, 1] + result[1] * -table[2, 2])); Console.ReadLine(); }