SimplexTableau implements Serializable { protected final double[][] getData() { return tableau.getData(); } SimplexTableau(final LinearObjectiveFunction f,
                   final Collection<LinearConstraint> constraints,
                   final GoalType goalType,
                   final boolean restrictToNonNegative,
                   final double epsilon);   SimplexTableau(final LinearObjectiveFunction f,
                   final Collection<LinearConstraint> constraints,
                   final GoalType goalType,
                   final boolean restrictToNonNegative,
                   final double epsilon,
                   final int maxUlps); List<LinearConstraint> normalizeConstraints(Collection<LinearConstraint> originalConstraints); @Override boolean equals(Object other); @Override int hashCode();  }
@Test public void testInitialization() { LinearObjectiveFunction f = createFunction(); Collection<LinearConstraint> constraints = createConstraints(); SimplexTableau tableau = new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6); double[][] expectedInitialTableau = { {-1, 0, -1, -1, 2, 0, 0, 0, -4}, { 0, 1, -15, -10, 25, 0, 0, 0, 0}, { 0, 0, 1, 0, -1, 1, 0, 0, 2}, { 0, 0, 0, 1, -1, 0, 1, 0, 3}, { 0, 0, 1, 1, -2, 0, 0, 1, 4} }; assertMatrixEquals(expectedInitialTableau, tableau.getData()); }
@Test public void testTableauWithNoArtificialVars() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {15, 10}, 0); Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>(); constraints.add(new LinearConstraint(new double[] {1, 0}, Relationship.LEQ, 2)); constraints.add(new LinearConstraint(new double[] {0, 1}, Relationship.LEQ, 3)); constraints.add(new LinearConstraint(new double[] {1, 1}, Relationship.LEQ, 4)); SimplexTableau tableau = new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6); double[][] initialTableau = { {1, -15, -10, 25, 0, 0, 0, 0}, {0, 1, 0, -1, 1, 0, 0, 2}, {0, 0, 1, -1, 0, 1, 0, 3}, {0, 1, 1, -2, 0, 0, 1, 4} }; assertMatrixEquals(initialTableau, tableau.getData()); }