Program: 131703
Project: 131703
Buggy source:
public void run(CommandLine cmd) throws ParseException, IOException {
  DepTreebank trainTreebank;
  DmvModel trueModel=null;
  if (cmd.hasOption("String_Node_Str")) {
    String trainPath=cmd.getOptionValue("String_Node_Str");
    log.info("String_Node_Str" + trainPath);
    int maxSentenceLength=Command.getOptionValue(cmd,"String_Node_Str",Integer.MAX_VALUE);
    Alphabet<Label> alphabet=new Alphabet<Label>();
    trainTreebank=getTreebank(cmd,trainPath,maxSentenceLength,alphabet);
  }
 else   if (cmd.hasOption("String_Node_Str")) {
    String synthetic=cmd.getOptionValue("String_Node_Str");
    if (synthetic.equals("String_Node_Str")) {
      trueModel=SimpleStaticDmvModel.getTwoPosTagInstance();
    }
 else     if (synthetic.equals("String_Node_Str")) {
      trueModel=SimpleStaticDmvModel.getThreePosTagInstance();
    }
 else     if (synthetic.equals("String_Node_Str")) {
      trueModel=SimpleStaticDmvModel.getAltThreePosTagInstance();
    }
 else {
      throw new ParseException("String_Node_Str" + synthetic);
    }
    long syntheticSeed=123454321;
    if (cmd.hasOption("String_Node_Str")) {
      syntheticSeed=Long.parseLong(cmd.getOptionValue("String_Node_Str"));
    }
    DmvDepTreeGenerator generator=new DmvDepTreeGenerator(trueModel,syntheticSeed);
    int maxNumSentences=Command.getOptionValue(cmd,"String_Node_Str",100);
    trainTreebank=generator.getTreebank(maxNumSentences);
  }
 else {
    throw new ParseException("String_Node_Str");
  }
  double propSupervised=Command.getOptionValue(cmd,"String_Node_Str",0.0);
  DmvTrainCorpus trainCorpus=new DmvTrainCorpus(trainTreebank,propSupervised);
  log.info("String_Node_Str" + trainCorpus.getNumUnlabeled());
  log.info("String_Node_Str" + trainCorpus.getNumLabeled());
  log.info("String_Node_Str" + trainTreebank.size());
  log.info("String_Node_Str" + trainTreebank.getNumTokens());
  log.info("String_Node_Str" + trainTreebank.getNumTypes());
  printSentences(cmd,trainTreebank);
  DepTreebank testTreebank=null;
  if (cmd.hasOption("String_Node_Str")) {
    String testPath=cmd.getOptionValue("String_Node_Str");
    log.info("String_Node_Str" + testPath);
    int maxSentenceLengthTest=Command.getOptionValue(cmd,"String_Node_Str",Integer.MAX_VALUE);
    testTreebank=getTreebank(cmd,testPath,maxSentenceLengthTest,trainTreebank.getAlphabet());
    log.info("String_Node_Str" + testTreebank.size());
    log.info("String_Node_Str" + testTreebank.getNumTokens());
    log.info("String_Node_Str" + testTreebank.getNumTypes());
  }
  if (cmd.hasOption("String_Node_Str")) {
    DmvRelaxation dw=(DmvRelaxation)TrainerFactory.getTrainer(cmd,trainTreebank,trueModel);
    dw.init1(trainCorpus);
    dw.init2(LocalBnBDmvTrainer.getInitSol(InitSol.UNIFORM,trainCorpus,null,null,null));
    DmvSolution initBoundsSol=updateBounds(cmd,trainCorpus,dw,trainTreebank,trueModel);
    Stopwatch timer=new Stopwatch();
    timer.start();
    RelaxedDmvSolution relaxSol=(RelaxedDmvSolution)dw.solveRelaxation();
    timer.stop();
    log.info("String_Node_Str" + Time.totMs(timer));
    log.info("String_Node_Str" + relaxSol.getScore());
    if (initBoundsSol != null) {
      log.info("String_Node_Str" + initBoundsSol.getScore());
      log.info("String_Node_Str" + Math.abs(relaxSol.getScore() - initBoundsSol.getScore()) / Math.abs(initBoundsSol.getScore()));
    }
    DmvProjector dmvProjector=new DmvProjector(trainCorpus,dw);
    DmvSolution projSol=dmvProjector.getProjectedDmvSolution(relaxSol);
    log.info("String_Node_Str" + projSol.getScore());
  }
 else {
    log.info("String_Node_Str");
    Trainer trainer=(Trainer)TrainerFactory.getTrainer(cmd,trainTreebank,trueModel);
    if (trainer instanceof BnBDmvTrainer) {
      BnBDmvTrainer bnb=(BnBDmvTrainer)trainer;
      bnb.init(trainCorpus);
      updateBounds(cmd,trainCorpus,bnb.getRootRelaxation(),trainTreebank,trueModel);
      bnb.train();
    }
 else {
      trainer.train(trainCorpus);
    }
    Model model=trainer.getModel();
    log.info("String_Node_Str");
    ViterbiParser parser=TrainerFactory.getEvalParser();
    Evaluator trainEval=new DependencyParserEvaluator(parser,trainTreebank,"String_Node_Str");
    trainEval.evaluate(model);
    trainEval.print();
    if (testTreebank != null) {
      log.info("String_Node_Str");
      Evaluator testEval=new DependencyParserEvaluator(parser,testTreebank,"String_Node_Str");
      testEval.evaluate(model);
      testEval.print();
    }
    String printModel=Command.getOptionValue(cmd,"String_Node_Str",null);
    if (printModel != null) {
      BufferedWriter writer=new BufferedWriter(new FileWriter(printModel));
      writer.write("String_Node_Str");
      writer.write(model.toString());
      writer.close();
    }
  }
}

Fixed version (ground truth):
public void run(CommandLine cmd) throws ParseException, IOException {
  DepTreebank trainTreebank;
  DmvModel trueModel=null;
  if (cmd.hasOption("String_Node_Str")) {
    String trainPath=cmd.getOptionValue("String_Node_Str");
    log.info("String_Node_Str" + trainPath);
    int maxSentenceLength=Command.getOptionValue(cmd,"String_Node_Str",Integer.MAX_VALUE);
    Alphabet<Label> alphabet=new Alphabet<Label>();
    trainTreebank=getTreebank(cmd,trainPath,maxSentenceLength,alphabet);
  }
 else   if (cmd.hasOption("String_Node_Str")) {
    String synthetic=cmd.getOptionValue("String_Node_Str");
    if (synthetic.equals("String_Node_Str")) {
      trueModel=SimpleStaticDmvModel.getTwoPosTagInstance();
    }
 else     if (synthetic.equals("String_Node_Str")) {
      trueModel=SimpleStaticDmvModel.getThreePosTagInstance();
    }
 else     if (synthetic.equals("String_Node_Str")) {
      trueModel=SimpleStaticDmvModel.getAltThreePosTagInstance();
    }
 else {
      throw new ParseException("String_Node_Str" + synthetic);
    }
    long syntheticSeed=123454321;
    if (cmd.hasOption("String_Node_Str")) {
      syntheticSeed=Long.parseLong(cmd.getOptionValue("String_Node_Str"));
    }
    DmvDepTreeGenerator generator=new DmvDepTreeGenerator(trueModel,syntheticSeed);
    int maxNumSentences=Command.getOptionValue(cmd,"String_Node_Str",100);
    trainTreebank=generator.getTreebank(maxNumSentences);
  }
 else {
    throw new ParseException("String_Node_Str");
  }
  double propSupervised=Command.getOptionValue(cmd,"String_Node_Str",0.0);
  DmvTrainCorpus trainCorpus=new DmvTrainCorpus(trainTreebank,propSupervised);
  log.info("String_Node_Str" + trainCorpus.getNumUnlabeled());
  log.info("String_Node_Str" + trainCorpus.getNumLabeled());
  log.info("String_Node_Str" + trainTreebank.size());
  log.info("String_Node_Str" + trainTreebank.getNumTokens());
  log.info("String_Node_Str" + trainTreebank.getNumTypes());
  printSentences(cmd,trainTreebank);
  DepTreebank testTreebank=null;
  if (cmd.hasOption("String_Node_Str")) {
    String testPath=cmd.getOptionValue("String_Node_Str");
    log.info("String_Node_Str" + testPath);
    int maxSentenceLengthTest=Command.getOptionValue(cmd,"String_Node_Str",Integer.MAX_VALUE);
    testTreebank=getTreebank(cmd,testPath,maxSentenceLengthTest,trainTreebank.getAlphabet());
    log.info("String_Node_Str" + testTreebank.size());
    log.info("String_Node_Str" + testTreebank.getNumTokens());
    log.info("String_Node_Str" + testTreebank.getNumTypes());
  }
  if (cmd.hasOption("String_Node_Str")) {
    DmvRelaxation dw=(DmvRelaxation)TrainerFactory.getTrainer(cmd,trainTreebank,trueModel);
    dw.init1(trainCorpus);
    dw.init2(LocalBnBDmvTrainer.getInitSol(InitSol.UNIFORM,trainCorpus,null,null,null));
    DmvSolution initBoundsSol=updateBounds(cmd,trainCorpus,dw,trainTreebank,trueModel);
    Stopwatch timer=new Stopwatch();
    timer.start();
    RelaxedDmvSolution relaxSol=(RelaxedDmvSolution)dw.solveRelaxation();
    timer.stop();
    log.info("String_Node_Str" + Time.totMs(timer));
    log.info("String_Node_Str" + relaxSol.getScore());
    if (initBoundsSol != null) {
      log.info("String_Node_Str" + initBoundsSol.getScore());
      log.info("String_Node_Str" + Math.abs(relaxSol.getScore() - initBoundsSol.getScore()) / Math.abs(initBoundsSol.getScore()));
    }
    DmvProjector dmvProjector=new DmvProjector(trainCorpus);
    DmvSolution projSol=dmvProjector.getProjectedDmvSolution(relaxSol);
    log.info("String_Node_Str" + projSol.getScore());
  }
 else {
    log.info("String_Node_Str");
    Trainer trainer=(Trainer)TrainerFactory.getTrainer(cmd,trainTreebank,trueModel);
    if (trainer instanceof BnBDmvTrainer) {
      BnBDmvTrainer bnb=(BnBDmvTrainer)trainer;
      bnb.init(trainCorpus);
      updateBounds(cmd,trainCorpus,bnb.getRootRelaxation(),trainTreebank,trueModel);
      bnb.train();
    }
 else {
      trainer.train(trainCorpus);
    }
    Model model=trainer.getModel();
    log.info("String_Node_Str");
    ViterbiParser parser=TrainerFactory.getEvalParser();
    Evaluator trainEval=new DependencyParserEvaluator(parser,trainTreebank,"String_Node_Str");
    trainEval.evaluate(model);
    trainEval.print();
    if (testTreebank != null) {
      log.info("String_Node_Str");
      Evaluator testEval=new DependencyParserEvaluator(parser,testTreebank,"String_Node_Str");
      testEval.evaluate(model);
      testEval.print();
    }
    String printModel=Command.getOptionValue(cmd,"String_Node_Str",null);
    if (printModel != null) {
      BufferedWriter writer=new BufferedWriter(new FileWriter(printModel));
      writer.write("String_Node_Str");
      writer.write(model.toString());
      writer.close();
    }
  }
}