Program: 131207
Project: 131207
Buggy source:
public static void testInfOnSimpleGraph(FactorGraph fg,FgInferencer bp){
  bp.run();
  VarTensor marg;
  double[] goldMarg;
  assertEquals("String_Node_Str",fg.getVar(0).getName());
  marg=bp.getMarginals(fg.getVar(0));
  goldMarg=new double[]{0.5,0.5};
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-2);
  marg=bp.getLogMarginals(fg.getVar(0));
  goldMarg=DoubleArrays.getLog(goldMarg);
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-2);
  assertEquals("String_Node_Str",fg.getVar(1).getName());
  marg=bp.getMarginals(fg.getVar(1));
  goldMarg=new double[]{0.375,0.625};
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  marg=bp.getLogMarginals(fg.getVar(1));
  goldMarg=DoubleArrays.getLog(goldMarg);
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  assertEquals("String_Node_Str",fg.getVar(2).getName());
  marg=bp.getMarginals(fg.getVar(2));
  goldMarg=new double[]{0.4275,0.5725};
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  marg=bp.getLogMarginals(fg.getVar(2));
  goldMarg=DoubleArrays.getLog(goldMarg);
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  assertEquals(new VarSet(fg.getVar(0),fg.getVar(1)),fg.getFactor(1).getVars());
  marg=bp.getMarginals(fg.getFactor(1));
  goldMarg=new double[]{0.3,0.075,0.2,0.425};
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  marg=bp.getLogMarginals(fg.getFactor(1));
  goldMarg=DoubleArrays.getLog(goldMarg);
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  double goldPartition=2.00;
  assertEquals(goldPartition,bp.getPartition(),1e-2);
  assertEquals(FastMath.log(goldPartition),bp.getLogPartition(),1e-2);
}

Fixed version (ground truth):
public static void testInfOnSimpleGraph(FactorGraph fg,FgInferencer bp){
  bp.run();
  VarTensor marg;
  double[] goldMarg;
  assertEquals("String_Node_Str",fg.getVar(0).getName());
  marg=bp.getMarginals(fg.getVar(0));
  goldMarg=new double[]{0.5,0.5};
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-2);
  marg=bp.getLogMarginals(fg.getVar(0));
  goldMarg=DoubleArrays.getLog(goldMarg);
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-2);
  assertEquals("String_Node_Str",fg.getVar(1).getName());
  marg=bp.getMarginals(fg.getVar(1));
  goldMarg=new double[]{0.375,0.625};
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  marg=bp.getLogMarginals(fg.getVar(1));
  goldMarg=DoubleArrays.getLog(goldMarg);
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  assertEquals("String_Node_Str",fg.getVar(2).getName());
  marg=bp.getMarginals(fg.getVar(2));
  goldMarg=new double[]{0.4275,0.5725};
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  marg=bp.getLogMarginals(fg.getVar(2));
  goldMarg=DoubleArrays.getLog(goldMarg);
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  assertEquals(new VarSet(fg.getVar(0),fg.getVar(1)),fg.getFactor(1).getVars());
  marg=bp.getMarginals(fg.getFactor(1));
  goldMarg=new double[]{0.3,0.2,0.075,0.425};
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  marg=bp.getLogMarginals(fg.getFactor(1));
  goldMarg=DoubleArrays.getLog(goldMarg);
  JUnitUtils.assertArrayEquals(goldMarg,marg.getValues(),1e-3);
  double goldPartition=2.00;
  assertEquals(goldPartition,bp.getPartition(),1e-2);
  assertEquals(FastMath.log(goldPartition),bp.getLogPartition(),1e-2);
}