// sum of x[j]
        private double Scale()
        {
            double[] x   = lp.Primal();
            double   sum = 0.0;

            for (int j = 0; j < N; j++)
            {
                sum += x[j];
            }
            return(sum);
        }
Exemple #2
0
        private static void test(double[,] A, double[] b, double[] c)
        {
            LinearProgramming lp = new LinearProgramming(A, b, c);

            Console.WriteLine("value = " + lp.Value);
            double[] x = lp.Primal();
            for (int i = 0; i < x.Length; i++)
            {
                Console.WriteLine("x[{0}] = {1:F5}", i, x[i]);
            }
            double[] y = lp.Dual();
            for (int j = 0; j < y.Length; j++)
            {
                Console.WriteLine("y[{0}] = {1:F5}", j, y[j]);
            }
        }