Program: 131583
Project: 131583
Buggy source:
private void createMessages(FgNode parent,Messages[] msgs,boolean logDomain){
  assert(this == parent.getFactor());
  double[] root=new double[n];
  double[][] child=new double[n][n];
  Utilities.fill(root,Double.NEGATIVE_INFINITY);
  Utilities.fill(child,Double.NEGATIVE_INFINITY);
  for (  FgEdge inEdge : parent.getInEdges()) {
    LinkVar link=(LinkVar)inEdge.getVar();
    DenseFactor inMsg=msgs[inEdge.getId()].message;
    double oddsRatio;
    if (logDomain) {
      oddsRatio=inMsg.getValue(LinkVar.TRUE) - inMsg.getValue(LinkVar.FALSE);
    }
 else {
      oddsRatio=inMsg.getValue(LinkVar.TRUE) / inMsg.getValue(LinkVar.FALSE);
      oddsRatio=Utilities.log(oddsRatio);
    }
    if (link.getParent() == -1) {
      root[link.getChild()]=oddsRatio;
    }
 else {
      child[link.getParent()][link.getChild()]=oddsRatio;
    }
  }
  DepIoChart chart=ProjectiveDependencyParser.insideOutsideAlgorithm(root,child);
  double pi=logDomain ? 0.0 : 1.0;
  for (  FgEdge inEdge : parent.getInEdges()) {
    DenseFactor inMsg=msgs[inEdge.getId()].message;
    if (logDomain) {
      pi+=inMsg.getValue(LinkVar.FALSE);
    }
 else {
      pi*=inMsg.getValue(LinkVar.FALSE);
    }
  }
  double partition=logDomain ? pi + chart.getLogPartitionFunction() : pi * Utilities.exp(chart.getLogPartitionFunction());
  if (log.isTraceEnabled()) {
    log.trace(String.format("String_Node_Str",partition));
  }
  for (  FgEdge outEdge : parent.getOutEdges()) {
    LinkVar link=(LinkVar)outEdge.getVar();
    double beliefTrue;
    double beliefFalse;
    if (logDomain) {
      beliefTrue=pi + chart.getLogSumOfPotentials(link.getParent(),link.getChild());
      beliefFalse=Utilities.logSubtract(partition,beliefTrue);
    }
 else {
      beliefTrue=pi * Utilities.exp(chart.getLogSumOfPotentials(link.getParent(),link.getChild()));
      beliefFalse=partition - beliefTrue;
    }
    if (log.isTraceEnabled()) {
      log.trace(String.format("String_Node_Str",link.getParent(),link.getChild(),beliefTrue));
      log.trace(String.format("String_Node_Str",link.getParent(),link.getChild(),beliefFalse));
    }
    FgEdge inEdge=outEdge.getOpposing();
    DenseFactor inMsg=msgs[inEdge.getId()].message;
    if (logDomain) {
      beliefTrue-=inMsg.getValue(LinkVar.TRUE);
      beliefFalse-=inMsg.getValue(LinkVar.FALSE);
    }
 else {
      beliefTrue/=inMsg.getValue(LinkVar.TRUE);
      beliefFalse/=inMsg.getValue(LinkVar.FALSE);
    }
    msgs[outEdge.getId()].newMessage.setValue(LinkVar.FALSE,beliefFalse);
    msgs[outEdge.getId()].newMessage.setValue(LinkVar.TRUE,beliefTrue);
  }
}

Fixed version (ground truth):
@Override protected void createMessages(FgNode parent,Messages[] msgs,boolean logDomain){
  assert(this == parent.getFactor());
  double[] root=new double[n];
  double[][] child=new double[n][n];
  Utilities.fill(root,Double.NEGATIVE_INFINITY);
  Utilities.fill(child,Double.NEGATIVE_INFINITY);
  for (  FgEdge inEdge : parent.getInEdges()) {
    LinkVar link=(LinkVar)inEdge.getVar();
    DenseFactor inMsg=msgs[inEdge.getId()].message;
    double oddsRatio;
    if (logDomain) {
      oddsRatio=inMsg.getValue(LinkVar.TRUE) - inMsg.getValue(LinkVar.FALSE);
    }
 else {
      oddsRatio=inMsg.getValue(LinkVar.TRUE) / inMsg.getValue(LinkVar.FALSE);
      oddsRatio=Utilities.log(oddsRatio);
    }
    if (link.getParent() == -1) {
      root[link.getChild()]=oddsRatio;
    }
 else {
      child[link.getParent()][link.getChild()]=oddsRatio;
    }
  }
  DepIoChart chart=ProjectiveDependencyParser.insideOutsideAlgorithm(root,child);
  double pi=logDomain ? 0.0 : 1.0;
  for (  FgEdge inEdge : parent.getInEdges()) {
    DenseFactor inMsg=msgs[inEdge.getId()].message;
    if (logDomain) {
      pi+=inMsg.getValue(LinkVar.FALSE);
    }
 else {
      pi*=inMsg.getValue(LinkVar.FALSE);
    }
  }
  double partition=logDomain ? pi + chart.getLogPartitionFunction() : pi * Utilities.exp(chart.getLogPartitionFunction());
  if (log.isTraceEnabled()) {
    log.trace(String.format("String_Node_Str",partition));
  }
  for (  FgEdge outEdge : parent.getOutEdges()) {
    LinkVar link=(LinkVar)outEdge.getVar();
    double beliefTrue;
    double beliefFalse;
    if (logDomain) {
      beliefTrue=pi + chart.getLogSumOfPotentials(link.getParent(),link.getChild());
      beliefFalse=Utilities.logSubtract(partition,beliefTrue);
    }
 else {
      beliefTrue=pi * Utilities.exp(chart.getLogSumOfPotentials(link.getParent(),link.getChild()));
      beliefFalse=partition - beliefTrue;
    }
    if (log.isTraceEnabled()) {
      log.trace(String.format("String_Node_Str",link.getParent(),link.getChild(),beliefTrue));
      log.trace(String.format("String_Node_Str",link.getParent(),link.getChild(),beliefFalse));
    }
    FgEdge inEdge=outEdge.getOpposing();
    DenseFactor inMsg=msgs[inEdge.getId()].message;
    if (logDomain) {
      beliefTrue-=inMsg.getValue(LinkVar.TRUE);
      beliefFalse-=inMsg.getValue(LinkVar.FALSE);
    }
 else {
      beliefTrue/=inMsg.getValue(LinkVar.TRUE);
      beliefFalse/=inMsg.getValue(LinkVar.FALSE);
    }
    msgs[outEdge.getId()].newMessage.setValue(LinkVar.FALSE,beliefFalse);
    msgs[outEdge.getId()].newMessage.setValue(LinkVar.TRUE,beliefTrue);
  }
}