Program: 131722
Project: 131722
Buggy source:
@Test public void testQualityOfRelaxation() throws IOException {
  DmvModel goldModel=SimpleStaticDmvModel.getThreePosTagInstance();
  DmvDepTreeGenerator generator=new DmvDepTreeGenerator(goldModel,Prng.nextInt(1000000));
  DepTreebank goldTreebank=generator.getTreebank(100);
  System.out.println(goldTreebank);
  System.out.println(goldModel);
  SentenceCollection sentences=goldTreebank.getSentences();
  DmvDantzigWolfeRelaxationResolution dw=getDw(sentences,100);
  IndexedDmvModel idm=dw.getIdm();
  double[][] goldLogProbs=idm.getCmLogProbs(DmvModelConverter.getDepProbMatrix(goldModel,sentences.getLabelAlphabet()));
  DmvSolution goldSol=new DmvSolution(goldLogProbs,idm,goldTreebank,dw.computeTrueObjective(goldLogProbs,goldTreebank));
  InitSol opt=InitSol.GOLD;
  DmvSolution initSol;
  if (opt == InitSol.VITERBI_EM) {
    initSol=getInitFeasSol(sentences);
  }
 else   if (opt == InitSol.GOLD) {
    initSol=goldSol;
  }
 else   if (opt == InitSol.RANDOM || opt == InitSol.UNIFORM) {
    DmvWeightGenerator weightGen;
    if (opt == InitSol.RANDOM) {
      Prng.seed(System.currentTimeMillis());
      weightGen=new DmvRandomWeightGenerator(0.00001);
    }
 else {
      weightGen=new DmvUniformWeightGenerator();
    }
    DmvModelFactory modelFactory=new DmvModelFactory(weightGen);
    DmvModel randModel=(DmvModel)modelFactory.getInstance(sentences);
    double[][] logProbs=idm.getCmLogProbs(DmvModelConverter.getDepProbMatrix(randModel,sentences.getLabelAlphabet()));
    ViterbiParser parser=new DmvCkyParser();
    DepTreebank treebank=parser.getViterbiParse(sentences,randModel);
    initSol=new DmvSolution(logProbs,idm,treebank,dw.computeTrueObjective(logProbs,treebank));
  }
 else {
    throw new IllegalStateException("String_Node_Str" + opt);
  }
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + goldSol.getScore() + "String_Node_Str");
  sb.append("String_Node_Str" + initSol.getScore());
  sb.append("String_Node_Str");
  RDataFrame df=new RDataFrame();
  Stopwatch timer=new Stopwatch();
  for (double offsetProb=10e-7; offsetProb <= 1.001; offsetProb+=0.05) {
    for (double probOfSkipCm=0.0; probOfSkipCm <= 0.2; probOfSkipCm+=0.1) {
      int numTimes=1;
      double avgScore=0.0;
      for (int i=0; i < numTimes; i++) {
        timer.start();
        setBoundsFromInitSol(dw,initSol,offsetProb,probOfSkipCm);
        RelaxedDmvSolution relaxSol=dw.solveRelaxation();
        avgScore+=relaxSol.getScore();
        timer.stop();
        System.out.println("String_Node_Str" + Time.avgMs(timer) * (numTimes * 0.5 / 0.01 * 1.0 / 0.1 - i * offsetProb / 0.01 * probOfSkipCm / 0.1) / 1000);
      }
      avgScore/=(double)numTimes;
      RRow row=new RRow();
      row.put("String_Node_Str",offsetProb);
      row.put("String_Node_Str",probOfSkipCm * 100);
      row.put("String_Node_Str",avgScore);
      row.put("String_Node_Str",Math.abs(avgScore - initSol.getScore()) / Math.abs(initSol.getScore()));
      row.put("String_Node_Str",containsInitSol(dw.getBounds(),goldSol.getLogProbs()));
      df.add(row);
    }
  }
  System.out.println(df);
  System.out.println(sb);
  System.out.println("String_Node_Str" + Time.totMs(timer) / df.getNumRows());
  FileWriter writer=new FileWriter("String_Node_Str");
  df.write(writer);
  writer.close();
}

Fixed version (ground truth):
@Test public void testQualityOfRelaxation() throws IOException {
  DmvModel goldModel=SimpleStaticDmvModel.getThreePosTagInstance();
  DmvDepTreeGenerator generator=new DmvDepTreeGenerator(goldModel,Prng.nextInt(1000000));
  DepTreebank goldTreebank=generator.getTreebank(100);
  System.out.println(goldTreebank);
  System.out.println(goldModel);
  SentenceCollection sentences=goldTreebank.getSentences();
  DmvDantzigWolfeRelaxationResolution dw=getDw(sentences,100);
  IndexedDmvModel idm=dw.getIdm();
  double[][] goldLogProbs=idm.getCmLogProbs(DmvModelConverter.getDepProbMatrix(goldModel,sentences.getLabelAlphabet()));
  DmvSolution goldSol=new DmvSolution(goldLogProbs,idm,goldTreebank,dw.computeTrueObjective(goldLogProbs,goldTreebank));
  InitSol opt=InitSol.GOLD;
  DmvSolution initSol;
  if (opt == InitSol.VITERBI_EM) {
    initSol=getInitFeasSol(sentences);
  }
 else   if (opt == InitSol.GOLD) {
    initSol=goldSol;
  }
 else   if (opt == InitSol.RANDOM || opt == InitSol.UNIFORM) {
    DmvWeightGenerator weightGen;
    if (opt == InitSol.RANDOM) {
      Prng.seed(System.currentTimeMillis());
      weightGen=new DmvRandomWeightGenerator(0.00001);
    }
 else {
      weightGen=new DmvUniformWeightGenerator();
    }
    DmvModelFactory modelFactory=new DmvModelFactory(weightGen);
    DmvModel randModel=(DmvModel)modelFactory.getInstance(sentences);
    double[][] logProbs=idm.getCmLogProbs(DmvModelConverter.getDepProbMatrix(randModel,sentences.getLabelAlphabet()));
    ViterbiParser parser=new DmvCkyParser();
    DepTreebank treebank=parser.getViterbiParse(sentences,randModel);
    initSol=new DmvSolution(logProbs,idm,treebank,dw.computeTrueObjective(logProbs,treebank));
  }
 else {
    throw new IllegalStateException("String_Node_Str" + opt);
  }
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str" + goldSol.getScore() + "String_Node_Str");
  sb.append("String_Node_Str" + initSol.getScore());
  sb.append("String_Node_Str");
  RDataFrame df=new RDataFrame();
  Stopwatch timer=new Stopwatch();
  for (double offsetProb=10e-7; offsetProb <= 1.001; offsetProb+=0.05) {
    for (double probOfSkipCm=0.0; probOfSkipCm <= 0.2; probOfSkipCm+=0.1) {
      int numTimes=1;
      double avgScore=0.0;
      for (int i=0; i < numTimes; i++) {
        timer.start();
        LocalBnBDmvTrainer.setBoundsFromInitSol(dw,initSol,offsetProb,probOfSkipCm);
        RelaxedDmvSolution relaxSol=dw.solveRelaxation();
        avgScore+=relaxSol.getScore();
        timer.stop();
        System.out.println("String_Node_Str" + Time.avgMs(timer) * (numTimes * 0.5 / 0.01 * 1.0 / 0.1 - i * offsetProb / 0.01 * probOfSkipCm / 0.1) / 1000);
      }
      avgScore/=(double)numTimes;
      RRow row=new RRow();
      row.put("String_Node_Str",offsetProb);
      row.put("String_Node_Str",probOfSkipCm * 100);
      row.put("String_Node_Str",avgScore);
      row.put("String_Node_Str",Math.abs(avgScore - initSol.getScore()) / Math.abs(initSol.getScore()));
      row.put("String_Node_Str",containsInitSol(dw.getBounds(),goldSol.getLogProbs()));
      df.add(row);
    }
  }
  System.out.println(df);
  System.out.println(sb);
  System.out.println("String_Node_Str" + Time.totMs(timer) / df.getNumRows());
  FileWriter writer=new FileWriter("String_Node_Str");
  df.write(writer);
  writer.close();
}