예제 #1
0
        /// <summary>
        /// Returns the optimal column strategy of this two-person zero-sum game.</summary>
        /// <returns>the optimal column strategy <c>Y</c> of this two-person zero-sum game</returns>
        ///
        public double[] Column()
        {
            double scale = Scale();

            double[] y = lp.Dual();
            for (int i = 0; i < M; i++)
            {
                y[i] /= scale;
            }
            return(y);
        }
예제 #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]);
            }
        }