/**
  * Returns the optimal column strategy of this two-person zero-sum game.
  *
  * @return the optimal column strategy <em>y</em> of this two-person zero-sum game
  */
 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;
        try {
            lp = new LinearProgramming(A, b, c);
        }
        catch (ArithmeticException e) {
            System.out.println(e);
            return;
        }

        StdOut.println("value = " + lp.value());
        double[] x = lp.primal();
        for (int i = 0; i < x.length; i++)
            StdOut.println("x[" + i + "] = " + x[i]);
        double[] y = lp.dual();
        for (int j = 0; j < y.length; j++)
            StdOut.println("y[" + j + "] = " + y[j]);
    }