Program: 131634
Project: 131634
Buggy source:
public void run() throws ParseException, IOException {
  DepTreebank trainTreebank;
  DmvModel goldModel=null;
  if (trainType == DatasetType.PTB || trainType == DatasetType.CONLL_X || trainType == DatasetType.CONLL_2009) {
    log.info("String_Node_Str" + train);
    Alphabet<Label> alphabet=new Alphabet<Label>();
    trainTreebank=DepTreebankReader.getTreebank(train,trainType,DepTreebankReader.maxSentenceLength,alphabet);
  }
 else   if (trainType == DatasetType.SYNTHETIC) {
    if (synthetic == null) {
      throw new ParseException("String_Node_Str");
    }
    if (synthetic.equals("String_Node_Str")) {
      goldModel=SimpleStaticDmvModel.getTwoPosTagInstance();
    }
 else     if (synthetic.equals("String_Node_Str")) {
      goldModel=SimpleStaticDmvModel.getThreePosTagInstance();
    }
 else     if (synthetic.equals("String_Node_Str")) {
      goldModel=SimpleStaticDmvModel.getAltThreePosTagInstance();
    }
 else {
      throw new ParseException("String_Node_Str" + synthetic);
    }
    DmvDepTreeGenerator generator=new DmvDepTreeGenerator(goldModel,syntheticSeed);
    trainTreebank=generator.getTreebank(DepTreebankReader.maxNumSentences);
  }
 else {
    throw new ParseException("String_Node_Str");
  }
  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(trainTreebank);
  DepTreebank testTreebank=null;
  if (test != null) {
    log.info("String_Node_Str" + test);
    testTreebank=DepTreebankReader.getTreebank(test,testType,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 (relaxOnly) {
    DmvSolFactory initSolFactory=new DmvSolFactory(TrainerFactory.getDmvSolFactoryPrm(trainTreebank,goldModel));
    DmvSolution initSol=initSolFactory.getInitFeasSol(trainCorpus);
    DmvRelaxationFactory relaxFactory=TrainerFactory.getDmvRelaxationFactory();
    DmvRelaxation relax=relaxFactory.getInstance(trainCorpus,initSol);
    DmvSolution initBoundsSol=updateBounds(trainCorpus,relax,trainTreebank,goldModel);
    Timer timer=new Timer();
    timer.start();
    DmvProblemNode rootNode=new DmvProblemNode(null);
    DmvRelaxedSolution relaxSol=(DmvRelaxedSolution)relax.getRelaxedSolution(rootNode);
    timer.stop();
    log.info("String_Node_Str" + timer.totMs());
    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()));
    }
    DmvProjectorFactory projectorFactory=TrainerFactory.getDmvProjectorFactory(trainTreebank,goldModel);
    DmvProjector dmvProjector=(DmvProjector)projectorFactory.getInstance(trainCorpus,relax);
    DmvSolution projSol=dmvProjector.getProjectedDmvSolution(relaxSol);
    if (projSol != null) {
      log.info("String_Node_Str" + projSol.getScore());
    }
 else {
      log.warn("String_Node_Str");
    }
  }
 else {
    log.info("String_Node_Str");
    Trainer trainer=TrainerFactory.getTrainer(trainTreebank,goldModel);
    if (trainer instanceof BnBDmvTrainer) {
      BnBDmvTrainer bnb=(BnBDmvTrainer)trainer;
      bnb.init(trainCorpus);
      updateBounds(trainCorpus,bnb.getRootRelaxation(),trainTreebank,goldModel);
      bnb.train();
    }
 else {
      trainer.train(trainCorpus);
    }
    DmvModel model=(DmvModel)trainer.getModel();
    evalAndWrite(model,trainTreebank,"String_Node_Str");
    if (testTreebank != null) {
      evalAndWrite(model,testTreebank,"String_Node_Str");
    }
    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() throws ParseException, IOException {
  DepTreebank trainTreebank;
  DmvModel goldModel=null;
  if (trainType == DatasetType.PTB || trainType == DatasetType.CONLL_X || trainType == DatasetType.CONLL_2009) {
    log.info("String_Node_Str" + train);
    Alphabet<Label> alphabet=new Alphabet<Label>();
    trainTreebank=DepTreebankReader.getTreebank(train,trainType,DepTreebankReader.maxSentenceLength,alphabet);
  }
 else   if (trainType == DatasetType.SYNTHETIC) {
    if (synthetic == null) {
      throw new ParseException("String_Node_Str");
    }
    if (synthetic.equals("String_Node_Str")) {
      goldModel=SimpleStaticDmvModel.getTwoPosTagInstance();
    }
 else     if (synthetic.equals("String_Node_Str")) {
      goldModel=SimpleStaticDmvModel.getThreePosTagInstance();
    }
 else     if (synthetic.equals("String_Node_Str")) {
      goldModel=SimpleStaticDmvModel.getAltThreePosTagInstance();
    }
 else {
      throw new ParseException("String_Node_Str" + synthetic);
    }
    DmvDepTreeGenerator generator=new DmvDepTreeGenerator(goldModel,syntheticSeed);
    trainTreebank=generator.getTreebank(DepTreebankReader.maxNumSentences);
  }
 else {
    throw new ParseException("String_Node_Str");
  }
  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(trainTreebank);
  DepTreebank testTreebank=null;
  if (test != null) {
    log.info("String_Node_Str" + test);
    testTreebank=DepTreebankReader.getTreebank(test,testType,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 (relaxOnly) {
    DmvSolFactory initSolFactory=new DmvSolFactory(TrainerFactory.getDmvSolFactoryPrm(trainTreebank,goldModel));
    DmvSolution initSol=initSolFactory.getInitFeasSol(trainCorpus);
    DmvRelaxationFactory relaxFactory=TrainerFactory.getDmvRelaxationFactory();
    DmvRelaxation relax=relaxFactory.getInstance(trainCorpus,initSol);
    DmvSolution initBoundsSol=updateBounds(trainCorpus,relax,trainTreebank,goldModel);
    Timer timer=new Timer();
    timer.start();
    DmvProblemNode rootNode=new DmvProblemNode(null);
    DmvRelaxedSolution relaxSol=(DmvRelaxedSolution)relax.getRelaxedSolution(rootNode);
    timer.stop();
    log.info("String_Node_Str" + timer.totMs());
    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()));
    }
    DmvProjectorFactory projectorFactory=TrainerFactory.getDmvProjectorFactory(trainTreebank,goldModel);
    DmvProjector dmvProjector=(DmvProjector)projectorFactory.getInstance(trainCorpus,relax);
    DmvSolution projSol=dmvProjector.getProjectedDmvSolution(relaxSol);
    if (projSol != null) {
      log.info("String_Node_Str" + projSol.getScore());
    }
 else {
      log.warn("String_Node_Str");
    }
  }
 else {
    log.info("String_Node_Str");
    Trainer trainer=TrainerFactory.getTrainer(trainTreebank,goldModel);
    if (trainer instanceof BnBDmvTrainer) {
      BnBDmvTrainer bnb=(BnBDmvTrainer)trainer;
      bnb.init(trainCorpus);
      updateBounds(trainCorpus,bnb.getRootRelaxation(),trainTreebank,goldModel);
      bnb.train();
    }
 else {
      trainer.train(trainCorpus);
    }
    DmvModel model=(DmvModel)trainer.getModel();
    evalAndWrite(model,trainTreebank,"String_Node_Str",trainOut,trainType);
    if (testTreebank != null) {
      evalAndWrite(model,testTreebank,"String_Node_Str",testOut,testType);
    }
    if (printModel != null) {
      BufferedWriter writer=new BufferedWriter(new FileWriter(printModel));
      writer.write("String_Node_Str");
      writer.write(model.toString());
      writer.close();
    }
  }
}