// 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; }
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]); }