nus-yam/ex-repair huggingface dataset:
Program: 131643
Project: 131643
Buggy source:
public static void addRows(IloLPMatrix mat,IloRange[] ranges) throws IloException {
  if (ranges == null) {
    return;
  }
  for (int i=0; i < ranges.length; i++) {
    if (ranges[i] != null) {
      mat.addRow(ranges[i]);
    }
  }
}

Fixed version (ground truth):
public static void addRows(IloLPMatrix mat,IloRange[] ranges) throws IloException {
  if (ranges == null) {
    return;
  }
  for (int i=0; i < ranges.length; i++) {
    addRow(mat,ranges[i]);
  }
}
Program: 131645
Project: 131645
Buggy source:
@Override public void init(Rlt rlt,long numUnfilteredRows) throws IloException {
  for (  RltRowAdder adder : adders) {
    if (adder != null) {
      adder.init(rlt,numUnfilteredRows);
    }
  }
}

Fixed version (ground truth):
@Override public void init(Rlt rlt,long numUnfilteredRows) throws IloException {
  for (  RltRowAdder adder : adders) {
    adder.init(rlt,numUnfilteredRows);
  }
}
Program: 131646
Project: 131646
Buggy source:
public UnionRltRowAdder(RltRowAdder... adders){
  this.adders=new ArrayList<RltRowAdder>(Arrays.asList(adders));
}

Fixed version (ground truth):
public UnionRltRowAdder(RltRowAdder... adders){
  this.adders=new ArrayList<RltRowAdder>();
  for (  RltRowAdder adder : adders) {
    if (adder != null) {
      this.adders.add(adder);
    }
  }
}
Program: 131647
Project: 131647
Buggy source:
@Override public RelaxedSolution getRelaxedSolution(ProblemNode curNode,double incumbentScore){
  switchTimer.start();
  setAsActiveNode(curNode);
  if (curNode.getWarmStart() != null) {
    setWarmStart(curNode.getWarmStart());
  }
  switchTimer.stop();
  RelaxedSolution relaxSol=solveRelaxation(curNode,incumbentScore);
  if (curNode.getLocalUb() < relaxSol.getScore()) {
    relaxSol.setScore(curNode.getLocalUb());
  }
 else {
    curNode.setOptimisticBound(relaxSol.getScore());
  }
  curNode.setWarmStart(getWarmStart());
  return relaxSol;
}

Fixed version (ground truth):
@Override public RelaxedSolution getRelaxedSolution(ProblemNode curNode,double incumbentScore){
  switchTimer.start();
  setAsActiveNode(curNode);
  if (curNode.getWarmStart() != null) {
    setWarmStart(curNode.getWarmStart());
  }
  switchTimer.stop();
  Pair<RelaxedSolution,WarmStart> pair=solveRelaxation(curNode,incumbentScore);
  RelaxedSolution relaxSol=pair.get1();
  WarmStart warmStart=pair.get2();
  if (curNode.getLocalUb() < relaxSol.getScore()) {
    relaxSol.setScore(curNode.getLocalUb());
  }
 else {
    curNode.setOptimisticBound(relaxSol.getScore());
  }
  curNode.setWarmStart(warmStart);
  return relaxSol;
}
Program: 131649
Project: 131649
Buggy source:
private RelaxedSolution solveRelaxation(ProblemNode curNode,double incumbentScore){
  try {
    numSolves++;
    double upperBound=-incumbentScore;
    Pair<RelaxStatus,Double> pair=runDWAlgo(cplex,upperBound,curNode.getDepth());
    RelaxStatus status=pair.get1();
    double lowerBound=pair.get2();
    double objective=-lowerBound;
    assert(!Double.isNaN(objective));
    if (prm.tempDir != null) {
      cplex.exportModel(new File(prm.tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + status);
    if (!status.hasSolution()) {
      return new DmvRelaxedSolution(null,null,objective,status,null,null,Double.NaN);
    }
    if (prm.tempDir != null) {
      cplex.writeSolution(new File(prm.tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + lowerBound);
    RelaxedSolution relaxSol=extractSolution(status,objective);
    log.info("String_Node_Str" + relaxSol.getTrueObjectiveForRelaxedSolution());
    return relaxSol;
  }
 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):
private Pair<RelaxedSolution,WarmStart> solveRelaxation(ProblemNode curNode,double incumbentScore){
  try {
    numSolves++;
    double upperBound=-incumbentScore;
    Triple<RelaxStatus,Double,WarmStart> triple=runDWAlgo(cplex,upperBound,curNode.getDepth());
    RelaxStatus status=triple.get1();
    double lowerBound=triple.get2();
    WarmStart warmStart=triple.get3();
    double objective=-lowerBound;
    assert(!Double.isNaN(objective));
    if (prm.tempDir != null) {
      cplex.exportModel(new File(prm.tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + status);
    if (!status.hasSolution()) {
      DmvRelaxedSolution relaxSol=new DmvRelaxedSolution(null,null,objective,status,null,null,Double.NaN);
      return new Pair<RelaxedSolution,WarmStart>(relaxSol,warmStart);
    }
    if (prm.tempDir != null) {
      cplex.writeSolution(new File(prm.tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + lowerBound);
    RelaxedSolution relaxSol=extractSolution(status,objective);
    log.info("String_Node_Str" + relaxSol.getTrueObjectiveForRelaxedSolution());
    return new Pair<RelaxedSolution,WarmStart>(relaxSol,warmStart);
  }
 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);
  }
}
Program: 131650
Project: 131650
Buggy source:
@Override public RelaxedSolution getRelaxedSolution(ProblemNode curNode,double incumbentScore){
  setAsActiveNode(curNode);
  if (curNode.getWarmStart() != null) {
    setWarmStart(curNode.getWarmStart());
  }
  RelaxedSolution relaxSol=solveRelaxation(curNode,incumbentScore);
  if (curNode.getLocalUb() < relaxSol.getScore()) {
    relaxSol.setScore(curNode.getLocalUb());
  }
 else {
    curNode.setOptimisticBound(relaxSol.getScore());
  }
  curNode.setWarmStart(getWarmStart());
  return relaxSol;
}

Fixed version (ground truth):
@Override public RelaxedSolution getRelaxedSolution(ProblemNode curNode,double incumbentScore){
  switchTimer.start();
  setAsActiveNode(curNode);
  if (curNode.getWarmStart() != null) {
    setWarmStart(curNode.getWarmStart());
  }
  switchTimer.stop();
  Pair<RelaxedSolution,WarmStart> pair=solveRelaxation(curNode,incumbentScore);
  RelaxedSolution relaxSol=pair.get1();
  WarmStart warmStart=pair.get2();
  if (curNode.getLocalUb() < relaxSol.getScore()) {
    relaxSol.setScore(curNode.getLocalUb());
  }
 else {
    curNode.setOptimisticBound(relaxSol.getScore());
  }
  curNode.setWarmStart(warmStart);
  return relaxSol;
}
Program: 131651
Project: 131651
Buggy source:
public DmvRltRelaxation(DmvRltRelaxPrm prm){
  this.prm=prm;
  this.numSolves=0;
  this.simplexTimer=new Timer();
  this.sto=new LpSumToOneBuilder(prm.stoPrm);
}

Fixed version (ground truth):
public DmvRltRelaxation(DmvRltRelaxPrm prm){
  this.prm=prm;
  this.numSolves=0;
  this.simplexTimer=new Timer();
  this.switchTimer=new Timer();
  this.sto=new LpSumToOneBuilder(prm.stoPrm);
}
Program: 131653
Project: 131653
Buggy source:
private RelaxedSolution solveRelaxation(ProblemNode curNode,double incumbentScore){
  try {
    numSolves++;
    double upperBound=-incumbentScore;
    Pair<RelaxStatus,Double> pair=runSimplexAlgo(cplex,upperBound,curNode.getDepth());
    RelaxStatus status=pair.get1();
    double lowerBound=pair.get2();
    double objective=-lowerBound;
    assert(!Double.isNaN(objective));
    if (prm.tempDir != null) {
      cplex.exportModel(new File(prm.tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + status);
    if (!status.hasSolution()) {
      return new DmvRelaxedSolution(null,null,objective,status,null,null,Double.NaN);
    }
    if (prm.tempDir != null) {
      cplex.writeSolution(new File(prm.tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + lowerBound);
    RelaxedSolution relaxSol=extractSolution(status,objective);
    log.info("String_Node_Str" + relaxSol.getTrueObjectiveForRelaxedSolution());
    return relaxSol;
  }
 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):
private Pair<RelaxedSolution,WarmStart> solveRelaxation(ProblemNode curNode,double incumbentScore){
  try {
    numSolves++;
    double upperBound=-incumbentScore;
    Triple<RelaxStatus,Double,WarmStart> triple=runSimplexAlgo(cplex,upperBound,curNode.getDepth());
    RelaxStatus status=triple.get1();
    double lowerBound=triple.get2();
    WarmStart warmStart=triple.get3();
    double objective=-lowerBound;
    assert(!Double.isNaN(objective));
    if (prm.tempDir != null) {
      cplex.exportModel(new File(prm.tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + status);
    if (!status.hasSolution()) {
      DmvRelaxedSolution relaxSol=new DmvRelaxedSolution(null,null,objective,status,null,null,Double.NaN);
      return new Pair<RelaxedSolution,WarmStart>(relaxSol,warmStart);
    }
    if (prm.tempDir != null) {
      cplex.writeSolution(new File(prm.tempDir,"String_Node_Str").getAbsolutePath());
    }
    log.info("String_Node_Str" + lowerBound);
    RelaxedSolution relaxSol=extractSolution(status,objective);
    log.info("String_Node_Str" + relaxSol.getTrueObjectiveForRelaxedSolution());
    return new Pair<RelaxedSolution,WarmStart>(relaxSol,warmStart);
  }
 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);
  }
}
Program: 131655
Project: 131655
Buggy source:
public DmvViterbiEMTrainerPrm(int iterations,double convergenceRatio,int numRestarts,double timeoutSeconds,double lambda,DependencyParserEvaluator evaluator){
}

Fixed version (ground truth):
public DmvViterbiEMTrainerPrm(int iterations,double convergenceRatio,int numRestarts,double timeoutSeconds,double lambda,DependencyParserEvaluator evaluator){
  this.lambda=lambda;
  this.evaluator=evaluator;
  this.emPrm.iterations=iterations;
  this.emPrm.convergenceRatio=convergenceRatio;
  this.emPrm.numRestarts=numRestarts;
  this.emPrm.timeoutSeconds=timeoutSeconds;
}
Program: 131657
Project: 131657
Buggy source:
@Test public void testArgParser() throws ParseException {
{
    String[] args="String_Node_Str".split("String_Node_Str");
    ArgParser parser=new ArgParser();
    parser.addClass(ArgParserTest.class);
    parser.parseArgs(args);
    Assert.assertEquals(2,intVal);
    Assert.assertEquals(1e10,doubleVal,1e-13);
  }
{
    String[] args="String_Node_Str".split("String_Node_Str");
    ArgParser parser=new ArgParser();
    parser.addClass(ArgParserTest.class);
    parser.parseArgs(args);
    Assert.assertEquals(3,intVal);
    Assert.assertEquals(3e10,doubleVal,1e-13);
  }
{
    String[] args="String_Node_Str".split("String_Node_Str");
    ArgParser parser=new ArgParser();
    parser.addClass(ArgParserTest.class);
    parser.parseArgs(args);
    Assert.assertEquals("String_Node_Str",strVal);
    Assert.assertEquals(new File("String_Node_Str"),fileVal);
  }
}

Fixed version (ground truth):
@Test public void testArgParser() throws ParseException {
{
    String[] args="String_Node_Str".split("String_Node_Str");
    ArgParser parser=new ArgParser();
    parser.addClass(ArgParserTest.class);
    parser.parseArgs(args);
    Assert.assertEquals(2,intVal);
    Assert.assertEquals(1e10,doubleVal,1e-13);
  }
{
    String[] args="String_Node_Str".split("String_Node_Str");
    ArgParser parser=new ArgParser();
    parser.addClass(ArgParserTest.class);
    parser.parseArgs(args);
    Assert.assertEquals(3,intVal);
    Assert.assertEquals(3e10,doubleVal,1e-13);
  }
{
    String[] args="String_Node_Str".split("String_Node_Str");
    ArgParser parser=new ArgParser();
    parser.addClass(ArgParserTest.class);
    parser.parseArgs(args);
    Assert.assertEquals("String_Node_Str",strVal);
    Assert.assertEquals(new File("String_Node_Str"),fileVal);
  }
{
    String[] args="String_Node_Str".split("String_Node_Str");
    ArgParser parser=new ArgParser();
    parser.addClass(ArgParserTest.class);
    parser.parseArgs(args);
    Assert.assertEquals(MockEnum.OPT2,enumVal);
  }
}
Program: 131658
Project: 131658
Buggy source:
public void fathom(ProblemNode node,FathomStatus status){
switch (status) {
case Infeasible:
    numInfeasible++;
  break;
case Pruned:
numPruned++;
break;
case CompletelySolved:
numCompletelySolved++;
break;
case BottomedOut:
numBottomedOut++;
break;
}
depthSum+=node.getDepth();
}

Fixed version (ground truth):
public void fathom(ProblemNode node,FathomStatus status){
switch (status) {
case NotFathomed:
    return;
case Infeasible:
  numInfeasible++;
break;
case Pruned:
numPruned++;
break;
case CompletelySolved:
numCompletelySolved++;
break;
case BottomedOut:
numBottomedOut++;
break;
}
depthSum+=node.getDepth();
}
Program: 131660
Project: 131660
Buggy source:
@Override public Collection<UnorderedPair> getRltRowsForLeq(int startFac1,int endFac1,int startFac2,int endFac2,RowType type){
  List<Factor> leqFactors=rlt.getLeqFactors();
  Map<Integer,List<Integer>> varConsMap=getVarConsMap(leqFactors);
  Set<UnorderedPair> rltRows=new HashSet<UnorderedPair>();
  for (  UnorderedPair varIdPair : varIdPairs) {
    for (    Integer i : Utilities.safeGet(varConsMap,varIdPair.get1())) {
      for (      Integer j : Utilities.safeGet(varConsMap,varIdPair.get2())) {
        if ((startFac1 <= i && i < endFac1 && startFac2 <= j && j < endFac2) || (startFac2 <= i && i < endFac2 && startFac1 <= j && j < endFac1)) {
          rltRows.add(new UnorderedPair(i,j));
        }
      }
    }
  }
  return rltRows;
}

Fixed version (ground truth):
@Override public Collection<UnorderedPair> getRltRowsForLeq(int startFac1,int endFac1,int startFac2,int endFac2,RowType type){
  List<Factor> leqFactors=rlt.getLeqFactors();
  Map<Integer,List<Integer>> varConsMap=getVarConsMap(leqFactors);
  Set<UnorderedPair> rltRows=new HashSet<UnorderedPair>();
  for (  UnorderedPair varIdPair : varIdPairs) {
    for (    Integer i : Utilities.safeGetList(varConsMap,varIdPair.get1())) {
      for (      Integer j : Utilities.safeGetList(varConsMap,varIdPair.get2())) {
        if ((startFac1 <= i && i < endFac1 && startFac2 <= j && j < endFac2) || (startFac2 <= i && i < endFac2 && startFac1 <= j && j < endFac1)) {
          rltRows.add(new UnorderedPair(i,j));
        }
      }
    }
  }
  return rltRows;
}
Program: 131661
Project: 131661
Buggy source:
@Override public Collection<OrderedPair> getRltRowsForEq(int startFac,int endFac,int numVars,RowType type){
  List<Factor> eqFactors=Utilities.sublist(rlt.getEqFactors(),startFac,endFac);
  Map<Integer,List<Integer>> varConsMap=getVarConsMap(eqFactors);
  Set<OrderedPair> rltRows=new HashSet<OrderedPair>();
  for (  UnorderedPair varIdPair : varIdPairs) {
    for (    Integer consId1 : Utilities.safeGet(varConsMap,varIdPair.get1())) {
      rltRows.add(new OrderedPair(consId1,varIdPair.get2()));
    }
    for (    Integer consId2 : Utilities.safeGet(varConsMap,varIdPair.get2())) {
      rltRows.add(new OrderedPair(consId2,varIdPair.get1()));
    }
  }
  return rltRows;
}

Fixed version (ground truth):
@Override public Collection<OrderedPair> getRltRowsForEq(int startFac,int endFac,int numVars,RowType type){
  List<Factor> eqFactors=Utilities.sublist(rlt.getEqFactors(),startFac,endFac);
  Map<Integer,List<Integer>> varConsMap=getVarConsMap(eqFactors);
  Set<OrderedPair> rltRows=new HashSet<OrderedPair>();
  for (  UnorderedPair varIdPair : varIdPairs) {
    for (    Integer consId1 : Utilities.safeGetList(varConsMap,varIdPair.get1())) {
      rltRows.add(new OrderedPair(consId1,varIdPair.get2()));
    }
    for (    Integer consId2 : Utilities.safeGetList(varConsMap,varIdPair.get2())) {
      rltRows.add(new OrderedPair(consId2,varIdPair.get1()));
    }
  }
  return rltRows;
}
Program: 131662
Project: 131662
Buggy source:
@Override public Collection<UnorderedPair> getRltRowsForLeq(int startFac1,int endFac1,int startFac2,int endFac2,RowType type){
  List<Factor> leqFactors=rlt.getLeqFactors();
  Map<Integer,List<Integer>> varConsMap=getVarConsMap(leqFactors);
  Set<UnorderedPair> rltRows=new HashSet<UnorderedPair>();
  for (  UnorderedPair varIdPair : varIdPairs) {
    for (    Integer i : varConsMap.get(varIdPair.get1())) {
      for (      Integer j : varConsMap.get(varIdPair.get2())) {
        if ((startFac1 <= i && i < endFac1 && startFac2 <= j && j < endFac2) || (startFac2 <= i && i < endFac2 && startFac1 <= j && j < endFac1)) {
          rltRows.add(new UnorderedPair(i,j));
        }
      }
    }
  }
  return rltRows;
}

Fixed version (ground truth):
@Override public Collection<UnorderedPair> getRltRowsForLeq(int startFac1,int endFac1,int startFac2,int endFac2,RowType type){
  List<Factor> leqFactors=rlt.getLeqFactors();
  Map<Integer,List<Integer>> varConsMap=getVarConsMap(leqFactors);
  Set<UnorderedPair> rltRows=new HashSet<UnorderedPair>();
  for (  UnorderedPair varIdPair : varIdPairs) {
    for (    Integer i : Utilities.safeGet(varConsMap,varIdPair.get1())) {
      for (      Integer j : Utilities.safeGet(varConsMap,varIdPair.get2())) {
        if ((startFac1 <= i && i < endFac1 && startFac2 <= j && j < endFac2) || (startFac2 <= i && i < endFac2 && startFac1 <= j && j < endFac1)) {
          rltRows.add(new UnorderedPair(i,j));
        }
      }
    }
  }
  return rltRows;
}
Program: 131663
Project: 131663
Buggy source:
@Override public Collection<OrderedPair> getRltRowsForEq(int startFac,int endFac,int numVars,RowType type){
  List<Factor> eqFactors=Utilities.sublist(rlt.getEqFactors(),startFac,endFac);
  Map<Integer,List<Integer>> varConsMap=getVarConsMap(eqFactors);
  Set<OrderedPair> rltRows=new HashSet<OrderedPair>();
  for (  UnorderedPair varIdPair : varIdPairs) {
    for (    Integer consId1 : varConsMap.get(varIdPair.get1())) {
      rltRows.add(new OrderedPair(consId1,varIdPair.get2()));
    }
    for (    Integer consId2 : varConsMap.get(varIdPair.get2())) {
      rltRows.add(new OrderedPair(consId2,varIdPair.get1()));
    }
  }
  return rltRows;
}

Fixed version (ground truth):
@Override public Collection<OrderedPair> getRltRowsForEq(int startFac,int endFac,int numVars,RowType type){
  List<Factor> eqFactors=Utilities.sublist(rlt.getEqFactors(),startFac,endFac);
  Map<Integer,List<Integer>> varConsMap=getVarConsMap(eqFactors);
  Set<OrderedPair> rltRows=new HashSet<OrderedPair>();
  for (  UnorderedPair varIdPair : varIdPairs) {
    for (    Integer consId1 : Utilities.safeGet(varConsMap,varIdPair.get1())) {
      rltRows.add(new OrderedPair(consId1,varIdPair.get2()));
    }
    for (    Integer consId2 : Utilities.safeGet(varConsMap,varIdPair.get2())) {
      rltRows.add(new OrderedPair(consId2,varIdPair.get1()));
    }
  }
  return rltRows;
}
Program: 131664
Project: 131664
Buggy source:
public static <X>Double safeGet(Map<X,Double> map,X key){
  Double value=map.get(key);
  if (value == null) {
    return DOUBLE_ZERO;
  }
  return value;
}

Fixed version (ground truth):
public static <X,Y>List<Y> safeGet(Map<X,List<Y>> map,X key){
  List<Y> list=map.get(key);
  if (list == null) {
    return Collections.emptyList();
  }
 else {
    return list;
  }
}
Program: 131665
Project: 131665
Buggy source:
public CptBounds(IndexedCpt icpt){
  int[][] supFreqCm=icpt.getTotSupervisedFreqCm();
  int[][] totMaxFreqCm=icpt.getTotalMaxFreqCm();
  lbs=new double[2][icpt.getNumConds()][];
  ubs=new double[2][icpt.getNumConds()][];
  for (  Type type : Type.values()) {
    int t=type.getAsInt();
    for (int c=0; c < lbs[t].length; c++) {
      lbs[t][c]=new double[icpt.getNumParams(c)];
      ubs[t][c]=new double[lbs[t][c].length];
      if (type == Type.PARAM) {
        Arrays.fill(lbs[t][c],DEFAULT_LOWER_BOUND);
        Arrays.fill(ubs[t][c],DEFAULT_UPPER_BOUND);
        double totMaxFreqC=Vectors.sum(totMaxFreqCm[c]);
        for (int m=0; m < lbs[t][c].length; m++) {
          if (totMaxFreqCm[c][m] == 0 && totMaxFreqC > 0) {
            ubs[t][c][m]=lbs[t][c][m];
          }
        }
      }
 else {
        for (int m=0; m < lbs[t][c].length; m++) {
          lbs[t][c][m]=supFreqCm[c][m];
          ubs[t][c][m]=totMaxFreqCm[c][m];
        }
      }
    }
  }
}

Fixed version (ground truth):
public CptBounds(IndexedCpt icpt){
  int[][] supFreqCm=icpt.getTotSupervisedFreqCm();
  int[][] totMaxFreqCm=icpt.getTotMaxFreqCm();
  lbs=new double[2][icpt.getNumConds()][];
  ubs=new double[2][icpt.getNumConds()][];
  for (  Type type : Type.values()) {
    int t=type.getAsInt();
    for (int c=0; c < lbs[t].length; c++) {
      lbs[t][c]=new double[icpt.getNumParams(c)];
      ubs[t][c]=new double[lbs[t][c].length];
      if (type == Type.PARAM) {
        Arrays.fill(lbs[t][c],DEFAULT_LOWER_BOUND);
        Arrays.fill(ubs[t][c],DEFAULT_UPPER_BOUND);
        double totMaxFreqCmVal=Vectors.sum(totMaxFreqCm[c]);
        for (int m=0; m < lbs[t][c].length; m++) {
          if (totMaxFreqCm[c][m] == 0 && totMaxFreqCmVal > 0) {
            ubs[t][c][m]=lbs[t][c][m];
          }
        }
      }
 else {
        for (int m=0; m < lbs[t][c].length; m++) {
          lbs[t][c][m]=supFreqCm[c][m];
          ubs[t][c][m]=totMaxFreqCm[c][m];
        }
      }
    }
  }
}
Program: 131667
Project: 131667
Buggy source:
protected static DmvRltRelaxation getLp(DmvTrainCorpus corpus,final int numCuts,boolean envelopeOnly){
  CutCountComputer ccc=new CutCountComputer(){
    @Override public int getNumCuts(    int numParams){
      return numCuts;
    }
  }
;
  DmvRltRelaxPrm prm=new DmvRltRelaxPrm(new File("String_Node_Str"),numCuts,ccc,envelopeOnly);
  prm.rltPrm.nameRltVarsAndCons=false;
  DmvRltRelaxation dw=new DmvRltRelaxation(prm);
  dw.init1(corpus);
  dw.init2(null);
  return dw;
}

Fixed version (ground truth):
protected static DmvRltRelaxation getLp(DmvTrainCorpus corpus,final int numCuts,boolean envelopeOnly){
  CutCountComputer ccc=new CutCountComputer(){
    @Override public int getNumCuts(    int numParams){
      return numCuts;
    }
  }
;
  DmvRltRelaxPrm prm=new DmvRltRelaxPrm(new File("String_Node_Str"),numCuts,ccc,envelopeOnly);
  prm.rltPrm.nameRltVarsAndCons=false;
  DmvRltRelaxation relax=new DmvRltRelaxation(prm);
  relax.init1(corpus);
  relax.init2(null);
  return relax;
}
Program: 131668
Project: 131668
Buggy source:
@Test public void testSupervised(){
  DmvModel dmvModel=SimpleStaticDmvModel.getThreePosTagInstance();
  DmvDepTreeGenerator generator=new DmvDepTreeGenerator(dmvModel,Prng.nextInt(1000000));
  DepTreebank treebank=generator.getTreebank(10);
  DmvTrainCorpus corpus=new DmvTrainCorpus(treebank,1.0);
  DmvRltRelaxPrm prm=new DmvRltRelaxPrm(null,100,new CutCountComputer(),false);
  prm.tempDir=new File("String_Node_Str");
  prm.stoPrm.minSumForCuts=1.000001;
  DmvRltRelaxation dwRelax=new DmvRltRelaxation(prm);
  dwRelax.init1(corpus);
  dwRelax.init2(null);
  RelaxedDmvSolution relaxSol=(RelaxedDmvSolution)dwRelax.solveRelaxation();
  DmvMStep mStep=new DmvMStep(0.0);
  DmvModel m1=mStep.getModel(treebank);
  DmvObjective obj=new DmvObjective(corpus);
  double m1Obj=obj.computeTrueObjective(m1,treebank);
  Assert.assertEquals(m1Obj,relaxSol.getScore(),1e-4);
}

Fixed version (ground truth):
@Test public void testSupervised(){
  DmvModel dmvModel=SimpleStaticDmvModel.getThreePosTagInstance();
  DmvDepTreeGenerator generator=new DmvDepTreeGenerator(dmvModel,Prng.nextInt(1000000));
  DepTreebank treebank=generator.getTreebank(100);
  DmvTrainCorpus corpus=new DmvTrainCorpus(treebank,1.0);
  DmvRltRelaxPrm prm=new DmvRltRelaxPrm(null,100,new CutCountComputer(),false);
  prm.tempDir=new File("String_Node_Str");
  prm.stoPrm.minSumForCuts=1.000001;
  DmvRltRelaxation dwRelax=new DmvRltRelaxation(prm);
  dwRelax.init1(corpus);
  dwRelax.init2(null);
  RelaxedDmvSolution relaxSol=(RelaxedDmvSolution)dwRelax.solveRelaxation();
  double[][] regret=RegretVariableSelector.getRegretCm(relaxSol);
  for (int c=0; c < regret.length; c++) {
    for (int m=0; m < regret[c].length; m++) {
      Assert.assertEquals(0.0,regret[c][m],1e-11);
    }
  }
  Assert.assertEquals(0.0,relaxSol.getTreebank().getPropFracArcs(),1e-13);
  DmvMStep mStep=new DmvMStep(0.0);
  DmvModel m1=mStep.getModel(treebank);
  DmvObjective obj=new DmvObjective(corpus);
  double m1Obj=obj.computeTrueObjective(m1,treebank);
  Assert.assertEquals(m1Obj,relaxSol.getScore(),0.4);
}
Program: 131669
Project: 131669
Buggy source:
@Test public void testEarlyStopping(){
  DmvModel dmvModel=SimpleStaticDmvModel.getAltThreePosTagInstance();
  DmvDepTreeGenerator generator=new DmvDepTreeGenerator(dmvModel,Prng.nextInt(1000000));
  DepTreebank treebank=generator.getTreebank(50);
  DmvTrainCorpus corpus=new DmvTrainCorpus(treebank,0.0);
  double incumbentScore=-1.2;
  DmvRltRelaxation relax=getLp(corpus,1);
  DmvSolution initSol=DmvDantzigWolfeRelaxationTest.getInitFeasSol(corpus);
  double offsetProb=0.5;
  double probOfSkip=0.5;
  LocalBnBDmvTrainer.setBoundsFromInitSol(relax,initSol,offsetProb,probOfSkip);
  RelaxedDmvSolution relaxSol=(RelaxedDmvSolution)relax.solveRelaxation(incumbentScore,0);
  Assert.assertTrue(relaxSol.getScore() <= incumbentScore);
}

Fixed version (ground truth):
@Test public void testEarlyStopping(){
  DmvModel dmvModel=SimpleStaticDmvModel.getAltThreePosTagInstance();
  DmvDepTreeGenerator generator=new DmvDepTreeGenerator(dmvModel,Prng.nextInt(1000000));
  DepTreebank treebank=generator.getTreebank(50);
  DmvTrainCorpus corpus=new DmvTrainCorpus(treebank,0.0);
  double incumbentScore=-3.0;
  DmvRltRelaxPrm prm=new DmvRltRelaxPrm();
  prm.tempDir=new File("String_Node_Str");
  prm.rltPrm.envelopeOnly=false;
  prm.rltPrm.nameRltVarsAndCons=false;
  prm.cplexPrm.simplexDisplay=2;
  DmvRltRelaxation relax=new DmvRltRelaxation(prm);
  relax.init1(corpus);
  relax.init2(null);
  DmvSolution initSol=DmvDantzigWolfeRelaxationTest.getInitFeasSol(corpus);
  double offsetProb=0.5;
  double probOfSkip=0.25;
  LocalBnBDmvTrainer.setBoundsFromInitSol(relax,initSol,offsetProb,probOfSkip);
  RelaxedDmvSolution relaxSol=(RelaxedDmvSolution)relax.solveRelaxation(incumbentScore,0);
  System.out.println(relaxSol.getScore());
  Assert.assertTrue(relaxSol.getScore() <= incumbentScore);
}
Program: 131670
Project: 131670
Buggy source:
@Test public void testCounts(){
  SentenceCollection sentences=new SentenceCollection();
  sentences.addSentenceFromString("String_Node_Str");
  sentences.addSentenceFromString("String_Node_Str");
  sentences.addSentenceFromString("String_Node_Str");
  IndexedDmvModel idm=getIdm(sentences);
  assertEquals(1 + 6 + 3 * 2 * 2,idm.getNumConds());
  assertEquals(3,idm.getNumParams(0));
  assertEquals(3,idm.getNumParams(4));
  assertEquals(2,idm.getNumParams(10));
  assertEquals("String_Node_Str",idm.getName(1,2));
  for (int i=0; i < idm.getNumSentVars(0); i++) {
    int c=idm.getC(0,i);
    int m=idm.getM(0,i);
    System.out.println(idm.getName(c,m));
  }
  assertEquals(2 + 2 + (1 + 3 + 1+ 3),idm.getNumSentVars(0));
  int c, m, s;
  c=0;
  m=2;
  s=2;
  assertEquals("String_Node_Str",idm.getName(c,m));
  assertEquals(1,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  assertEquals(-1,idm.getSi(0,c,m));
  assertEquals(-1,idm.getSi(1,c,m));
  c=1;
  m=0;
  s=1;
  assertEquals("String_Node_Str",idm.getName(c,m));
  assertEquals(3,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  assertEquals(-1,idm.getSi(0,c,m));
  assertEquals(-1,idm.getSi(2,c,m));
  c=1 + 6;
  m=0;
  s=1;
  assertEquals("String_Node_Str",idm.getName(c,m));
  assertEquals(3,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  s=0;
  assertEquals(1,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  s=2;
  assertEquals(1,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  int[][] maxFreqCm=idm.getTotalMaxFreqCm();
  assertEquals(2,maxFreqCm[0][1]);
}

Fixed version (ground truth):
@Test public void testCounts(){
  SentenceCollection sentences=new SentenceCollection();
  sentences.addSentenceFromString("String_Node_Str");
  sentences.addSentenceFromString("String_Node_Str");
  sentences.addSentenceFromString("String_Node_Str");
  IndexedDmvModel idm=getIdm(sentences);
  assertEquals(1 + 6 + 3 * 2 * 2,idm.getNumConds());
  assertEquals(3,idm.getNumParams(0));
  assertEquals(3,idm.getNumParams(4));
  assertEquals(2,idm.getNumParams(10));
  assertEquals("String_Node_Str",idm.getName(1,2));
  for (int i=0; i < idm.getNumSentVars(0); i++) {
    int c=idm.getC(0,i);
    int m=idm.getM(0,i);
    System.out.println(idm.getName(c,m));
  }
  assertEquals(2 + 2 + (1 + 3 + 1+ 3),idm.getNumSentVars(0));
  int c, m, s;
  c=0;
  m=2;
  s=2;
  assertEquals("String_Node_Str",idm.getName(c,m));
  assertEquals(1,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  assertEquals(-1,idm.getSi(0,c,m));
  assertEquals(-1,idm.getSi(1,c,m));
  c=1;
  m=0;
  s=1;
  assertEquals("String_Node_Str",idm.getName(c,m));
  assertEquals(3,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  assertEquals(-1,idm.getSi(0,c,m));
  assertEquals(-1,idm.getSi(2,c,m));
  c=1 + 6;
  m=0;
  s=1;
  assertEquals("String_Node_Str",idm.getName(c,m));
  assertEquals(3,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  s=0;
  assertEquals(1,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  s=2;
  assertEquals(1,idm.getMaxFreq(s,idm.getSi(s,c,m)));
  int[][] maxFreqCm=idm.getTotMaxFreqCm();
  assertEquals(2,maxFreqCm[0][1]);
}
Program: 131671
Project: 131671
Buggy source:
private void setCplexParams(IloCplex cplex) throws IloException, FileNotFoundException {
  cplex.setParam(DoubleParam.WorkMem,workMemMegs);
  cplex.setParam(IntParam.Threads,numThreads);
  cplex.setParam(IntParam.ParallelMode,1);
  cplex.setParam(IntParam.RootAlg,simplexAlgorithm);
  cplex.setParam(IntParam.ItLim,maxSimplexIterations);
  cplex.setParam(DoubleParam.TiLim,timeoutSeconds);
  cplex.setParam(IntParam.AdvInd,1);
}

Fixed version (ground truth):
private void setCplexParams(IloCplex cplex) throws IloException, FileNotFoundException {
  cplex.setParam(DoubleParam.WorkMem,workMemMegs);
  cplex.setParam(IntParam.Threads,numThreads);
  cplex.setParam(IntParam.ParallelMode,1);
  cplex.setParam(IntParam.RootAlg,simplexAlgorithm);
  cplex.setParam(IntParam.ItLim,maxSimplexIterations);
  cplex.setParam(DoubleParam.TiLim,timeoutSeconds);
  cplex.setParam(IntParam.AdvInd,1);
  cplex.setParam(IntParam.SimDisplay,simplexDisplay);
}
Program: 131672
Project: 131672
Buggy source:
private void printSpaceRemaining(int numProcessed,double rootLogSpace,double logSpaceRemain){
  log.info("String_Node_Str" + logSpaceRemain);
  if (numProcessed % 10000 == 0) {
    double logSpaceRemainAdd=computeLogSpaceRemain();
    log.info("String_Node_Str" + logSpaceRemainAdd);
    if (!Utilities.equals(logSpaceRemain,logSpaceRemainAdd,1e-4)) {
      log.warn("String_Node_Str");
    }
  }
  log.info("String_Node_Str" + Utilities.exp(logSpaceRemain));
  log.info("String_Node_Str" + Utilities.exp(logSpaceRemain - rootLogSpace));
}

Fixed version (ground truth):
private void printSpaceRemaining(int numProcessed,double rootLogSpace,double logSpaceRemain){
  log.info("String_Node_Str" + logSpaceRemain);
  log.info("String_Node_Str" + Utilities.exp(logSpaceRemain));
  log.info("String_Node_Str" + Utilities.exp(logSpaceRemain - rootLogSpace));
}
Program: 131673
Project: 131673
Buggy source:
/** 
 * @return negative infinity if the problem is infeasible, and an upperbound otherwise
 */
@Override public double getOptimisticBound(double incumbentScore){
  if (!isOptimisticBoundCached) {
    if (dwRelax != null) {
      if (warmStart != null) {
        dwRelax.setWarmStart(warmStart);
      }
      relaxSol=(RelaxedDmvSolution)dwRelax.solveRelaxation(incumbentScore,depth);
      optimisticBound=relaxSol.getScore();
      isOptimisticBoundCached=true;
      warmStart=dwRelax.getWarmStart();
    }
 else     if (parent != null) {
      return parent.getOptimisticBound();
    }
 else {
      return LazyBranchAndBoundSolver.BEST_SCORE;
    }
  }
  return optimisticBound;
}

Fixed version (ground truth):
/** 
 * @return negative infinity if the problem is infeasible, and an upperbound otherwise
 */
@Override public double getOptimisticBound(double incumbentScore){
  if (!isOptimisticBoundCached) {
    if (dwRelax != null) {
      if (warmStart != null) {
        dwRelax.setWarmStart(warmStart);
      }
      relaxSol=(RelaxedDmvSolution)dwRelax.solveRelaxation(incumbentScore,depth);
      if (optimisticBound < relaxSol.getScore()) {
        relaxSol.setScore(optimisticBound);
      }
      optimisticBound=relaxSol.getScore();
      isOptimisticBoundCached=true;
      warmStart=dwRelax.getWarmStart();
    }
 else     if (parent != null) {
      return parent.getOptimisticBound();
    }
 else {
      return LazyBranchAndBoundSolver.BEST_SCORE;
    }
  }
  return optimisticBound;
}
Program: 131674
Project: 131674
Buggy source:
@Override public void updateTimeRemaining(double timeoutSeconds){
  CplexPrm.updateTimeoutSeconds(cplex,timeoutSeconds);
}

Fixed version (ground truth):
@Override public void updateTimeRemaining(double timeoutSeconds){
  prm.timeoutSeconds=timeoutSeconds;
  CplexPrm.updateTimeoutSeconds(cplex,timeoutSeconds);
}
Program: 131676
Project: 131676
Buggy source:
public CptBounds(IndexedCpt icpt){
  int[][] totMaxFreqCm=icpt.getTotalMaxFreqCm();
  lbs=new double[2][icpt.getNumConds()][];
  ubs=new double[2][icpt.getNumConds()][];
  for (  Type type : Type.values()) {
    int t=type.getAsInt();
    for (int c=0; c < lbs[t].length; c++) {
      lbs[t][c]=new double[icpt.getNumParams(c)];
      ubs[t][c]=new double[lbs[t][c].length];
      if (type == Type.PARAM) {
        Arrays.fill(lbs[t][c],DEFAULT_LOWER_BOUND);
        Arrays.fill(ubs[t][c],DEFAULT_UPPER_BOUND);
        double totMaxFreqC=Vectors.sum(totMaxFreqCm[c]);
        for (int m=0; m < lbs[t][c].length; m++) {
          if (totMaxFreqCm[c][m] == 0 && totMaxFreqC > 0) {
            ubs[t][c][m]=lbs[t][c][m];
          }
        }
      }
 else {
        Arrays.fill(lbs[t][c],0);
        for (int m=0; m < lbs[t][c].length; m++) {
          ubs[t][c][m]=totMaxFreqCm[c][m];
        }
      }
    }
  }
}

Fixed version (ground truth):
public CptBounds(IndexedCpt icpt){
  int[][] supFreqCm=icpt.getTotSupervisedFreqCm();
  int[][] totMaxFreqCm=icpt.getTotalMaxFreqCm();
  lbs=new double[2][icpt.getNumConds()][];
  ubs=new double[2][icpt.getNumConds()][];
  for (  Type type : Type.values()) {
    int t=type.getAsInt();
    for (int c=0; c < lbs[t].length; c++) {
      lbs[t][c]=new double[icpt.getNumParams(c)];
      ubs[t][c]=new double[lbs[t][c].length];
      if (type == Type.PARAM) {
        Arrays.fill(lbs[t][c],DEFAULT_LOWER_BOUND);
        Arrays.fill(ubs[t][c],DEFAULT_UPPER_BOUND);
        double totMaxFreqC=Vectors.sum(totMaxFreqCm[c]);
        for (int m=0; m < lbs[t][c].length; m++) {
          if (totMaxFreqCm[c][m] == 0 && totMaxFreqC > 0) {
            ubs[t][c][m]=lbs[t][c][m];
          }
        }
      }
 else {
        for (int m=0; m < lbs[t][c].length; m++) {
          lbs[t][c][m]=supFreqCm[c][m];
          ubs[t][c][m]=totMaxFreqCm[c][m];
        }
      }
    }
  }
}
Program: 131677
Project: 131677
Buggy source:
/** 
 * Used by DmvBoundsFactory
 */
public int[][] getTotalMaxFreqCm();

Fixed version (ground truth):
public int[][] getTotalMaxFreqCm();
Program: 131678
Project: 131678
Buggy source:
public String getName(int c,int m){
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
@Override public String getName(int c,int m){
  throw new RuntimeException("String_Node_Str");
}
Program: 131679
Project: 131679
Buggy source:
public int getNumTotalParams(){
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
@Override public int getNumTotalParams(){
  throw new RuntimeException("String_Node_Str");
}
Program: 131680
Project: 131680
Buggy source:
public int[][] getTotalMaxFreqCm(){
  int[][] totMaxFreqCm=new int[numConds][numParams];
  for (int i=0; i < totMaxFreqCm.length; i++) {
    Arrays.fill(totMaxFreqCm[i],1);
  }
  return totMaxFreqCm;
}

Fixed version (ground truth):
@Override public int[][] getTotalMaxFreqCm(){
  int[][] totMaxFreqCm=new int[numConds][numParams];
  for (int i=0; i < totMaxFreqCm.length; i++) {
    Arrays.fill(totMaxFreqCm[i],1);
  }
  return totMaxFreqCm;
}
Program: 131681
Project: 131681
Buggy source:
public int getNumNonZeroUnsupMaxFreqCms(){
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
@Override public int getNumNonZeroUnsupMaxFreqCms(){
  throw new RuntimeException("String_Node_Str");
}
Program: 131682
Project: 131682
Buggy source:
private void init(IndexedDmvModel idm){
  int[][] maxFreqCm=idm.getTotalMaxFreqCm();
  int numCm=0;
  for (int c=0; c < maxFreqCm.length; c++) {
    numCm+=maxFreqCm[c].length;
  }
  cms=new CM[numCm];
  freqs=new double[numCm];
  for (int c=0, i=0; c < maxFreqCm.length; c++) {
    for (int m=0; m < maxFreqCm[c].length; m++) {
      cms[i]=new CM(c,m);
      freqs[i]=uniform && maxFreqCm[c][m] > 0 ? 1.0 : maxFreqCm[c][m];
      i++;
    }
  }
}

Fixed version (ground truth):
private void init(IndexedDmvModel idm){
  int[][] maxFreqCm=idm.getTotUnsupervisedMaxFreqCm();
  int numCm=0;
  for (int c=0; c < maxFreqCm.length; c++) {
    numCm+=maxFreqCm[c].length;
  }
  cms=new CM[numCm];
  freqs=new double[numCm];
  for (int c=0, i=0; c < maxFreqCm.length; c++) {
    for (int m=0; m < maxFreqCm[c].length; m++) {
      cms[i]=new CM(c,m);
      freqs[i]=uniform && maxFreqCm[c][m] > 0 ? 1.0 : maxFreqCm[c][m];
      i++;
    }
  }
}
Program: 131683
Project: 131683
Buggy source:
protected RelaxedSolution extractSolution(RelaxStatus status,double objective) throws UnknownObjectException, IloException {
  double[][] optimalLogProbs=extractRelaxedLogProbs();
  double[][] optimalFeatCounts=getFeatureCounts();
  double[][] objVals=new double[idm.getNumConds()][];
  for (int c=0; c < idm.getNumConds(); c++) {
    objVals[c]=cplex.getValues(mp.objVars[c]);
  }
  double trueRelaxObj=dmvObj.computeTrueObjective(optimalLogProbs,optimalFeatCounts);
  RelaxedDepTreebank treebank=extractRelaxedParse();
  log.info("String_Node_Str" + treebank.getPropFracArcs());
  return new RelaxedDmvSolution(Utilities.copyOf(optimalLogProbs),treebank,objective,status,Utilities.copyOf(optimalFeatCounts),Utilities.copyOf(objVals),trueRelaxObj);
}

Fixed version (ground truth):
protected RelaxedSolution extractSolution(RelaxStatus status,double objective) throws UnknownObjectException, IloException {
  double[][] optimalLogProbs=extractRelaxedLogProbs();
  double[][] optimalFeatCounts=getFeatureCounts();
  double[][] objVals=new double[idm.getNumConds()][];
  for (int c=0; c < idm.getNumConds(); c++) {
    objVals[c]=cplex.getValues(mp.objVars[c]);
  }
  int[][] totSupFreqCm=idm.getTotSupervisedFreqCm();
  for (int c=0; c < idm.getNumConds(); c++) {
    for (int m=0; m < idm.getNumParams(c); m++) {
      optimalFeatCounts[c][m]+=totSupFreqCm[c][m];
      objVals[c][m]+=optimalLogProbs[c][m] * (double)totSupFreqCm[c][m];
    }
  }
  double trueRelaxObj=dmvObj.computeTrueObjective(optimalLogProbs,optimalFeatCounts);
  RelaxedDepTreebank treebank=extractRelaxedParse();
  log.info("String_Node_Str" + treebank.getPropFracArcs());
  return new RelaxedDmvSolution(Utilities.copyOf(optimalLogProbs),treebank,objective,status,Utilities.copyOf(optimalFeatCounts),Utilities.copyOf(objVals),trueRelaxObj);
}
Program: 131685
Project: 131685
Buggy source:
@Test public void testSemiSupervisedOnSynthetic(){
  DmvModel dmvModel=SimpleStaticDmvModel.getThreePosTagInstance();
  DmvTrainCorpus trainCorpus=DmvCkyParserTest.getSemiSupervisedSyntheticCorpus(dmvModel);
  DmvDantzigWolfeRelaxation dw=getDw(trainCorpus,10);
  DmvSolution initBoundsSol=LocalBnBDmvTrainer.getInitSol(InitSol.VITERBI_EM,trainCorpus,dw,null,null);
  LocalBnBDmvTrainer.setBoundsFromInitSol(dw,initBoundsSol,0.1,0.0);
  RelaxedDmvSolution relaxSol=(RelaxedDmvSolution)dw.solveRelaxation();
  assertEquals(-14.813,relaxSol.getScore(),1e-3);
}

Fixed version (ground truth):
@Test public void testSemiSupervisedOnSynthetic(){
  DmvModel dmvModel=SimpleStaticDmvModel.getThreePosTagInstance();
  DmvTrainCorpus trainCorpus=DmvCkyParserTest.getSemiSupervisedSyntheticCorpus(dmvModel);
  DmvDantzigWolfeRelaxation dw=getDw(trainCorpus,10);
  DmvSolution initBoundsSol=LocalBnBDmvTrainer.getInitSol(InitSol.VITERBI_EM,trainCorpus,dw,null,null);
  LocalBnBDmvTrainer.setBoundsFromInitSol(dw,initBoundsSol,0.1,0.0);
  RelaxedDmvSolution relaxSol=(RelaxedDmvSolution)dw.solveRelaxation();
  assertEquals(-277.897,relaxSol.getScore(),1e-3);
}
Program: 131687
Project: 131687
Buggy source:
private int addCuts(IloCplex cplex,int cut) throws UnknownObjectException, IloException {
  List<Integer> rows=sto.projectModelParamsAndAddCuts();
  return mp.rlt.addRows(rows);
}

Fixed version (ground truth):
private int addCuts(IloCplex cplex,int cut) throws UnknownObjectException, IloException {
  List<Integer> rows=sto.projectModelParamsAndAddCuts();
  return rows.size() + mp.rlt.addRowsAsFactors(rows);
}
Program: 131689
Project: 131689
Buggy source:
@Override public VariableId select(DmvProblemNode node){
  CptBounds origBounds=node.getBounds();
  RelaxedDmvSolution relaxSol=node.getRelaxedSolution();
  double[][] regret=getRegretCm(relaxSol);
  if (regret == null) {
    log.warn("String_Node_Str");
    return randBrancher.select(node);
  }
  for (int c=0; c < regret.length; c++) {
    for (int m=0; m < regret[c].length; m++) {
      if (!origBounds.canBranch(Type.PARAM,c,m)) {
        regret[c][m]=Double.NEGATIVE_INFINITY;
      }
    }
  }
  IntTuple max=Utilities.getArgmax(regret);
  int c=max.get(0);
  int m=max.get(1);
  if (c == -1 || m == -1 || regret[c][m] == Double.NEGATIVE_INFINITY) {
    log.warn("String_Node_Str" + node.getId());
    return new VariableId();
  }
  String name=node.getIdm().getName(c,m);
  log.info(String.format("String_Node_Str",c,m,name,regret[c][m]));
  assert(regret[c][m] != Double.NEGATIVE_INFINITY);
  return new VariableId(c,m);
}

Fixed version (ground truth):
@Override public VariableId select(DmvProblemNode node){
  CptBounds origBounds=node.getBounds();
  RelaxedDmvSolution relaxSol=node.getRelaxedSolution();
  double[][] regret=getRegretCm(relaxSol);
  if (regret == null) {
    log.warn("String_Node_Str");
    return randBrancher.select(node);
  }
  for (int c=0; c < regret.length; c++) {
    for (int m=0; m < regret[c].length; m++) {
      if (!origBounds.canBranch(Type.PARAM,c,m)) {
        regret[c][m]=Double.NEGATIVE_INFINITY;
      }
    }
  }
  IntTuple max=Utilities.getArgmax(regret);
  int c=max.get(0);
  int m=max.get(1);
  assert(!Double.isNaN(regret[c][m]));
  if (c == -1 || m == -1) {
    log.warn("String_Node_Str" + node.getId());
    return new VariableId();
  }
  String name=node.getIdm().getName(c,m);
  log.info(String.format("String_Node_Str",c,m,name,regret[c][m]));
  assert(!Double.isInfinite(regret[c][m]));
  return new VariableId(c,m);
}
Program: 131690
Project: 131690
Buggy source:
public DmvSolution getProjectedDmvSolution(RelaxedDmvSolution relaxSol){
  if (!relaxSol.getStatus().hasSolution()) {
    return null;
  }
  double[][] logProbs=relaxSol.getLogProbs();
  for (int c=0; c < logProbs.length; c++) {
    double[] probs=Vectors.getExp(logProbs[c]);
    probs=Projections.getProjectedParams(probs);
    logProbs[c]=Vectors.getLog(probs);
  }
  DepTreebank treebank=getProjectedParses(relaxSol.getTreebank());
  double score=obj.computeTrueObjective(logProbs,treebank);
  DmvSolution sol=new DmvSolution(logProbs,idm,treebank,score);
  return sol;
}

Fixed version (ground truth):
public DmvSolution getProjectedDmvSolution(RelaxedDmvSolution relaxSol){
  if (!relaxSol.getStatus().hasSolution()) {
    return null;
  }
  double[][] logProbs=Utilities.copyOf(relaxSol.getLogProbs());
  for (int c=0; c < logProbs.length; c++) {
    double[] probs=Vectors.getExp(logProbs[c]);
    probs=Projections.getProjectedParams(probs);
    logProbs[c]=Vectors.getLog(probs);
  }
  DepTreebank treebank=getProjectedParses(relaxSol.getTreebank());
  double score=obj.computeTrueObjective(logProbs,treebank);
  DmvSolution sol=new DmvSolution(logProbs,idm,treebank,score);
  return sol;
}
Program: 131692
Project: 131692
Buggy source:
public static BoundFactor getBoundFactorUpper(IloNumVar[] numVars,int colIdx) throws IloException {
  double varUb=numVars[colIdx].getUB();
  if (varUb != Rlt.CPLEX_POS_INF) {
    int[] varInd=new int[]{colIdx};
    double[] varVal=new double[]{1.0};
    return new BoundFactor(varUb,varInd,varVal,colIdx,Lu.UPPER);
  }
  return null;
}

Fixed version (ground truth):
public static BoundFactor getBoundFactorUpper(IloNumVar[] numVars,int colIdx,IloLPMatrix mat) throws IloException {
  double varUb=numVars[colIdx].getUB();
  if (varUb < CPLEX_POS_INF_CUTOFF) {
    int[] varInd=new int[]{colIdx};
    double[] varVal=new double[]{1.0};
    return new BoundFactor(varUb,varInd,varVal,colIdx,Lu.UPPER,mat);
  }
  return null;
}
Program: 131693
Project: 131693
Buggy source:
public BoundFactor(double g,int[] Gind,double[] Gval,int colIdx,Lu lu){
  super(g,Gind,Gval);
  this.colIdx=colIdx;
  this.lu=lu;
}

Fixed version (ground truth):
public BoundFactor(double g,int[] Gind,double[] Gval,int colIdx,Lu lu,IloLPMatrix mat){
  super(g,Gind,Gval,mat);
  this.colIdx=colIdx;
  this.lu=lu;
}
Program: 131694
Project: 131694
Buggy source:
public RowFactor(double g,int[] Gind,double[] Gval,int rowIdx,RowFactorType type){
  super(g,Gind,Gval);
  this.rowIdx=rowIdx;
  this.type=type;
}

Fixed version (ground truth):
public RowFactor(double g,int[] Gind,double[] Gval,int rowIdx,RowFactorType type,IloLPMatrix mat){
  super(g,Gind,Gval,mat);
  this.rowIdx=rowIdx;
  this.type=type;
}
Program: 131695
Project: 131695
Buggy source:
/** 
 * Creates the constraint and bounds factors.
 */
public static List<Factor> getFactors(IloLPMatrix mat,boolean envelopeOnly) throws IloException {
  int n=mat.getNcols();
  int m=mat.getNrows();
  IloNumVar[] numVars=mat.getNumVars();
  List<Factor> factors=new ArrayList<Factor>();
  for (int colIdx=0; colIdx < n; colIdx++) {
    BoundFactor bfLb=getBoundFactorLower(numVars,colIdx);
    if (bfLb != null) {
      factors.add(bfLb);
    }
    BoundFactor bfUb=getBoundFactorUpper(numVars,colIdx);
    if (bfUb != null) {
      factors.add(bfUb);
    }
  }
  if (!envelopeOnly) {
    int startRow=0;
    int numRows=m;
    addRowFactors(startRow,numRows,mat,factors);
  }
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str");
    for (    Factor f : factors) {
      log.trace("String_Node_Str" + f);
    }
  }
  return factors;
}

Fixed version (ground truth):
/** 
 * Creates the constraint and bounds factors.
 */
public static List<Factor> getFactors(IloLPMatrix mat,boolean envelopeOnly) throws IloException {
  int n=mat.getNcols();
  int m=mat.getNrows();
  IloNumVar[] numVars=mat.getNumVars();
  List<Factor> factors=new ArrayList<Factor>();
  for (int colIdx=0; colIdx < n; colIdx++) {
    BoundFactor bfLb=getBoundFactorLower(numVars,colIdx,mat);
    if (bfLb != null) {
      factors.add(bfLb);
    }
    BoundFactor bfUb=getBoundFactorUpper(numVars,colIdx,mat);
    if (bfUb != null) {
      factors.add(bfUb);
    }
  }
  if (!envelopeOnly) {
    int startRow=0;
    int numRows=m;
    addRowFactors(startRow,numRows,mat,factors);
  }
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str");
    for (    Factor f : factors) {
      log.trace("String_Node_Str" + f);
    }
  }
  return factors;
}
Program: 131696
Project: 131696
Buggy source:
public static BoundFactor getBoundFactorLower(IloNumVar[] numVars,int colIdx) throws IloException {
  double varLb=numVars[colIdx].getLB();
  if (varLb != Rlt.CPLEX_NEG_INF) {
    int[] varInd=new int[]{colIdx};
    double[] varVal=new double[]{-1.0};
    return new BoundFactor(-varLb,varInd,varVal,colIdx,Lu.LOWER);
  }
  return null;
}

Fixed version (ground truth):
public static BoundFactor getBoundFactorLower(IloNumVar[] numVars,int colIdx,IloLPMatrix mat) throws IloException {
  double varLb=numVars[colIdx].getLB();
  if (CPLEX_NEG_INF_CUTOFF < varLb) {
    int[] varInd=new int[]{colIdx};
    double[] varVal=new double[]{-1.0};
    return new BoundFactor(-varLb,varInd,varVal,colIdx,Lu.LOWER,mat);
  }
  return null;
}