### Question:
Coefficient { public abstract Coefficient simplify();  abstract float getValue(Map<SummationVariable, Integer> subs); abstract Coefficient simplify();  }### Answer:
@Test public void testSimplifyWithoutCardinality() { Coefficient[] raw = new Coefficient[]{ new Add(new ConstantNumber(1), new ConstantNumber(2)), new Add(new ConstantNumber(0), new ConstantNumber(3)), new Add(new ConstantNumber(4), new ConstantNumber(0)), new Subtract(new ConstantNumber(5), new ConstantNumber(6)), new Subtract(new ConstantNumber(6), new ConstantNumber(5)), new Subtract(new ConstantNumber(0), new ConstantNumber(7)), new Subtract(new ConstantNumber(8), new ConstantNumber(0)), new Multiply(new ConstantNumber(9), new ConstantNumber(10)), new Multiply(new ConstantNumber(1), new ConstantNumber(11)), new Multiply(new ConstantNumber(12), new ConstantNumber(1)), new Multiply(new ConstantNumber(0), new ConstantNumber(13)), new Multiply(new ConstantNumber(14), new ConstantNumber(0)), new Divide(new ConstantNumber(15), new ConstantNumber(3)), new Divide(new ConstantNumber(16), new ConstantNumber(1)), new Divide(new ConstantNumber(0), new ConstantNumber(17)), new Min(new ConstantNumber(18), new ConstantNumber(19)), new Min(new ConstantNumber(19), new ConstantNumber(18)), new Max(new ConstantNumber(20), new ConstantNumber(21)), new Max(new ConstantNumber(21), new ConstantNumber(20)), new Min( new Add( new Multiply(new ConstantNumber(4), new ConstantNumber(3)), new Divide(new ConstantNumber(15), new ConstantNumber(3)) ), new Subtract( new ConstantNumber(100), new Max(new ConstantNumber(1), new ConstantNumber(2)) ) ) }; double[] expected = new double[]{ 3, 3, 4, -1, 1, -7, 8, 90, 11, 12, 0, 0, 5, 16, 0, 18, 18, 21, 21, 17 }; for (int i = 0; i < raw.length; i++) { Coefficient simple = raw[i].simplify(); if (!(simple instanceof ConstantNumber)) { fail(String.format("Expecting a ConstantNumber, found a %s.", simple.getClass().getName())); } double actual = ((ConstantNumber)simple).value; assertEquals( String.format("Value mismatch on coefficient %d (%s). Expected [%f], found [%f]", i, raw[i], expected[i], actual), expected[i], actual, MathUtils.EPSILON ); } }