Program: 131754
Project: 131754
Buggy source:
public RelaxedDmvSolution solveRelaxation(){
  try {
    Status status=runDWAlgo(cplex,mp);
    if (tempDir != null) {
      cplex.exportModel(new File(tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + status);
    if (status != Status.Optimal) {
      return new RelaxedDmvSolution(null,null,null,LazyBranchAndBoundSolver.WORST_SCORE,status);
    }
    if (tempDir != null) {
      cplex.writeSolution(new File(tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + cplex.getObjValue());
    log.info(String.format("String_Node_Str",mp.lambdaVars.size(),mp.gammaVars.size()));
    double objective=-cplex.getObjValue();
    assert(!Double.isNaN(objective));
    assert(Utilities.lte(objective,0.0,1e-7));
    logProbs=new double[idm.getNumConds()][];
    for (int i=0; i < mp.gammaVars.size(); i++) {
      GammaVar gv=mp.gammaVars.get(i);
      double gammaValue=cplex.getValue(gv.gammaVar);
      for (int c=0; c < idm.getNumConds(); c++) {
        int numParams=idm.getNumParams(c);
        if (logProbs[c] == null) {
          logProbs[c]=new double[numParams];
        }
        for (int m=0; m < numParams; m++) {
          logProbs[c][m]+=gammaValue * gv.logProbs[c][m];
        }
      }
    }
    for (int c=0; c < idm.getNumConds(); c++) {
      double[] probs=Vectors.getExp(logProbs[c]);
      if (!Utilities.lte(Vectors.sum(probs),1.0,1e-8)) {
        log.warn(String.format("String_Node_Str",c,Vectors.sum(probs)));
      }
    }
    double[][] fracRoots=new double[sentences.size()][];
    double[][][] fracParses=new double[sentences.size()][][];
    for (int s=0; s < sentences.size(); s++) {
      Sentence sentence=sentences.get(s);
      fracRoots[s]=new double[sentence.size()];
      fracParses[s]=new double[sentence.size()][sentence.size()];
    }
    for (    LambdaVar triple : mp.lambdaVars) {
      double frac=cplex.getValue(triple.lambdaVar);
      int s=triple.s;
      int[] parents=triple.parents;
      double[] fracRoot=fracRoots[s];
      double[][] fracParse=fracParses[s];
      for (int child=0; child < parents.length; child++) {
        int parent=parents[child];
        if (parent == WallDepTreeNode.WALL_POSITION) {
          fracRoot[child]+=frac;
        }
 else {
          fracParse[parent][child]+=frac;
        }
      }
    }
    return new RelaxedDmvSolution(logProbs,fracRoots,fracParses,objective,status);
  }
 catch (  IloException e) {
    if (e instanceof ilog.cplex.CpxException) {
      ilog.cplex.CpxException cpxe=(ilog.cplex.CpxException)e;
      System.err.println("String_Node_Str" + cpxe.getStatus());
      System.err.println("String_Node_Str" + cpxe.getMessage());
    }
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public RelaxedDmvSolution solveRelaxation(){
  try {
    Status status=runDWAlgo(cplex,mp);
    if (tempDir != null) {
      cplex.exportModel(new File(tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + status);
    if (status != Status.Optimal) {
      return new RelaxedDmvSolution(null,null,null,LazyBranchAndBoundSolver.WORST_SCORE,status);
    }
    if (tempDir != null) {
      cplex.writeSolution(new File(tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + cplex.getObjValue());
    log.info(String.format("String_Node_Str",mp.lambdaVars.size(),mp.gammaVars.size()));
    double objective=-cplex.getObjValue();
    assert(!Double.isNaN(objective));
    assert(Utilities.lte(objective,0.0,1e-7));
    optimalLogProbs=new double[idm.getNumConds()][];
    for (int i=0; i < mp.gammaVars.size(); i++) {
      GammaVar gv=mp.gammaVars.get(i);
      double gammaValue=cplex.getValue(gv.gammaVar);
      for (int c=0; c < idm.getNumConds(); c++) {
        int numParams=idm.getNumParams(c);
        if (optimalLogProbs[c] == null) {
          optimalLogProbs[c]=new double[numParams];
        }
        for (int m=0; m < numParams; m++) {
          optimalLogProbs[c][m]+=gammaValue * gv.logProbs[c][m];
        }
      }
    }
    for (int c=0; c < idm.getNumConds(); c++) {
      double[] probs=Vectors.getExp(optimalLogProbs[c]);
      if (!Utilities.lte(Vectors.sum(probs),1.0,1e-8)) {
        log.warn(String.format("String_Node_Str",c,Vectors.sum(probs)));
      }
    }
    double[][] fracRoots=new double[sentences.size()][];
    double[][][] fracParses=new double[sentences.size()][][];
    for (int s=0; s < sentences.size(); s++) {
      Sentence sentence=sentences.get(s);
      fracRoots[s]=new double[sentence.size()];
      fracParses[s]=new double[sentence.size()][sentence.size()];
    }
    for (    LambdaVar triple : mp.lambdaVars) {
      double frac=cplex.getValue(triple.lambdaVar);
      int s=triple.s;
      int[] parents=triple.parents;
      double[] fracRoot=fracRoots[s];
      double[][] fracParse=fracParses[s];
      for (int child=0; child < parents.length; child++) {
        int parent=parents[child];
        if (parent == WallDepTreeNode.WALL_POSITION) {
          fracRoot[child]+=frac;
        }
 else {
          fracParse[parent][child]+=frac;
        }
      }
    }
    return new RelaxedDmvSolution(Utilities.copyOf(optimalLogProbs),fracRoots,fracParses,objective,status);
  }
 catch (  IloException e) {
    if (e instanceof ilog.cplex.CpxException) {
      ilog.cplex.CpxException cpxe=(ilog.cplex.CpxException)e;
      System.err.println("String_Node_Str" + cpxe.getStatus());
      System.err.println("String_Node_Str" + cpxe.getMessage());
    }
    throw new RuntimeException(e);
  }
}