Program: 131656
Project: 131656
Buggy source:
public static Trainer getTrainer(DepTreebank goldTreebank,DmvModel goldModel) throws ParseException {
  if (!modelName.equals("String_Node_Str")) {
    throw new ParseException("String_Node_Str" + modelName);
  }
  DmvRelaxationFactory relaxFactory=null;
  if (algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str")) {
    relaxFactory=getDmvRelaxationFactory();
  }
  DependencyParserEvaluator parserEvaluator=new DependencyParserEvaluator(getEvalParser(),goldTreebank,"String_Node_Str");
  Trainer trainer=null;
  DmvViterbiEMTrainer viterbiTrainer=null;
  if (algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str")) {
    ViterbiParser parser;
    IlpSolverFactory ilpSolverFactory=null;
    if (parserName.startsWith("String_Node_Str")) {
      IlpSolverId ilpSolverId=IlpSolverId.getById(ilpSolver);
      ilpSolverFactory=new IlpSolverFactory(ilpSolverId,numThreads,ilpWorkMemMegs);
    }
    if (parserName.equals("String_Node_Str")) {
      parser=new DmvCkyParser();
    }
 else     if (parserName.equals("String_Node_Str")) {
      parser=new IlpViterbiSentenceParser(formulation,ilpSolverFactory);
    }
 else     if (parserName.equals("String_Node_Str")) {
      parser=new IlpViterbiParser(formulation,ilpSolverFactory);
    }
 else     if (parserName.equals("String_Node_Str") || parserName.equals("String_Node_Str")) {
      DeltaGenerator deltaGen;
      if (deltaGenerator.equals("String_Node_Str")) {
        deltaGen=new FixedIntervalDeltaGenerator(interval,numPerSide);
      }
 else       if (deltaGenerator.equals("String_Node_Str")) {
        deltaGen=new FactorDeltaGenerator(factor,numPerSide);
      }
 else {
        throw new ParseException("String_Node_Str" + deltaGenerator);
      }
      if (parserName.equals("String_Node_Str")) {
        parser=new IlpViterbiParserWithDeltas(formulation,ilpSolverFactory,deltaGen);
      }
 else       if (parserName.equals("String_Node_Str")) {
        parser=new InitializedIlpViterbiParserWithDeltas(formulation,ilpSolverFactory,deltaGen,ilpSolverFactory);
      }
 else {
        throw new ParseException("String_Node_Str" + parserName);
      }
    }
 else {
      throw new ParseException("String_Node_Str" + parserName);
    }
    ModelFactory modelFactory;
    if (initWeights.equals("String_Node_Str")) {
      modelFactory=new UniformDmvModelFactory();
    }
 else     if (initWeights.equals("String_Node_Str")) {
      modelFactory=new RandomDmvModelFactory(lambda);
    }
 else     if (initWeights.equals("String_Node_Str")) {
      modelFactory=new SupervisedDmvModelFactory(goldTreebank);
    }
 else     if (initWeights.equals("String_Node_Str")) {
      modelFactory=new FixableModelFactory(null);
      ((FixableModelFactory)modelFactory).fixModel(goldModel);
    }
 else {
      throw new ParseException("String_Node_Str" + initWeights);
    }
    if (algorithm.equals("String_Node_Str")) {
      DmvViterbiEMTrainerPrm vtPrm=new DmvViterbiEMTrainerPrm(iterations,convergenceRatio,numRestarts,timeoutSeconds,lambda,parserEvaluator);
      trainer=new DmvViterbiEMTrainer(vtPrm,parser,modelFactory);
    }
    if (algorithm.equals("String_Node_Str")) {
      DmvViterbiEMTrainerPrm vtPrm=new DmvViterbiEMTrainerPrm(iterations,convergenceRatio,0,Double.POSITIVE_INFINITY,lambda,null);
      viterbiTrainer=new DmvViterbiEMTrainer(vtPrm,parser,modelFactory);
    }
  }
  CptBoundsDeltaFactory brancher=null;
  if (algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str")) {
    VariableSplitter varSplitter;
    if (varSplit.equals("String_Node_Str")) {
      varSplitter=new MidpointVarSplitter(MidpointChoice.HALF_PROB);
    }
 else     if (varSplit.equals("String_Node_Str")) {
      varSplitter=new MidpointVarSplitter(MidpointChoice.HALF_LOGPROB);
    }
 else {
      throw new ParseException("String_Node_Str" + varSplit);
    }
    VariableSelector varSelector;
    if (varSelection.equals("String_Node_Str")) {
      varSelector=new FullStrongVariableSelector(varSplitter);
    }
 else     if (varSelection.equals("String_Node_Str")) {
      varSelector=new PseudocostVariableSelector(varSplitter);
    }
 else     if (varSelection.equals("String_Node_Str")) {
      varSelector=new RegretVariableSelector();
    }
 else     if (varSelection.equals("String_Node_Str")) {
      varSelector=new RandomVariableSelector(true);
    }
 else     if (varSelection.equals("String_Node_Str")) {
      varSelector=new RandomVariableSelector(false);
    }
 else {
      throw new ParseException("String_Node_Str" + varSelection);
    }
    brancher=new BasicCptBoundsDeltaFactory(varSelector,varSplitter);
  }
  NodeOrderer nodeOrderer=null;
  if (nodeOrder.equals("String_Node_Str")) {
    nodeOrderer=new PqNodeOrderer(new BfsComparator());
  }
 else   if (nodeOrder.equals("String_Node_Str")) {
    DfsNodeOrdererPrm prm=new DfsNodeOrdererPrm();
    nodeOrderer=new DfsNodeOrderer(prm);
  }
 else   if (nodeOrder.equals("String_Node_Str")) {
    PlungingBfsNodeOrdererPrm prm=new PlungingBfsNodeOrdererPrm();
    prm.localRelativeGapThreshold=localRelativeGapThreshold;
    nodeOrderer=new PlungingBfsNodeOrderer(prm);
  }
 else   if (nodeOrder.equals("String_Node_Str")) {
    nodeOrderer=new DfsRandChildAtDepthNodeOrderer(60);
  }
 else   if (nodeOrder.equals("String_Node_Str")) {
    nodeOrderer=new DfsRandWalkNodeOrderer(60);
  }
  DmvSolFactoryPrm initSolPrm=getDmvSolFactoryPrm();
  DmvProjectorFactory projectorFactory=getDmvProjectorFactory();
  LazyBnbSolverPrm bnbPrm=new LazyBnbSolverPrm();
  bnbPrm.disableFathoming=disableFathoming;
  bnbPrm.epsilon=epsilon;
  bnbPrm.evaluator=new DmvSolutionEvaluator(parserEvaluator);
  bnbPrm.leafNodeOrderer=nodeOrderer;
  bnbPrm.timeoutSeconds=timeoutSeconds;
  if (algorithm.equals("String_Node_Str")) {
    bnbPrm.evaluator=null;
    bnbPrm.timeoutSeconds=bnbTimeoutSeconds;
    LocalBnBDmvTrainerPrm lbPrm=new LocalBnBDmvTrainerPrm(viterbiTrainer,bnbPrm,brancher,relaxFactory,projectorFactory,numRestarts,offsetProb,probOfSkipCm,timeoutSeconds,parserEvaluator,initSolPrm);
    trainer=new LocalBnBDmvTrainer(lbPrm);
  }
 else   if (algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str")) {
    LazyBnbSolverFactory bnbSolverFactory;
    if (algorithm.equals("String_Node_Str")) {
      RandWalkBnbSamplerPrm prm=new RandWalkBnbSamplerPrm();
      prm.maxSamples=10000;
      bnbSolverFactory=prm;
    }
 else     if (algorithm.equals("String_Node_Str")) {
      DepthStratifiedBnbSamplerPrm prm=new DepthStratifiedBnbSamplerPrm();
      prm.maxDepth=60;
      bnbSolverFactory=prm;
    }
 else     if (algorithm.equals("String_Node_Str")) {
      bnbSolverFactory=bnbPrm;
    }
 else {
      throw new ParseException("String_Node_Str" + algorithm);
    }
    BnBDmvTrainerPrm bnbtPrm=new BnBDmvTrainerPrm();
    bnbtPrm.initSolPrm=initSolPrm;
    bnbtPrm.brancher=brancher;
    bnbtPrm.bnbSolverFactory=bnbSolverFactory;
    bnbtPrm.relaxFactory=relaxFactory;
    bnbtPrm.projectorFactory=projectorFactory;
    trainer=new BnBDmvTrainer(bnbtPrm);
  }
  if (trainer == null) {
    throw new ParseException("String_Node_Str" + algorithm);
  }
  return trainer;
}

Fixed version (ground truth):
public static Trainer getTrainer(DepTreebank goldTreebank,DmvModel goldModel) throws ParseException {
  if (!modelName.equals("String_Node_Str")) {
    throw new ParseException("String_Node_Str" + modelName);
  }
  DmvRelaxationFactory relaxFactory=null;
  if (algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str")|| algorithm.equals("String_Node_Str")) {
    relaxFactory=getDmvRelaxationFactory();
  }
  DependencyParserEvaluator parserEvaluator=new DependencyParserEvaluator(getEvalParser(),goldTreebank,"String_Node_Str");
  Trainer trainer=null;
  DmvViterbiEMTrainer viterbiTrainer=null;
  if (algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str")) {
    ViterbiParser parser;
    IlpSolverFactory ilpSolverFactory=null;
    if (parserName.startsWith("String_Node_Str")) {
      IlpSolverId ilpSolverId=IlpSolverId.getById(ilpSolver);
      ilpSolverFactory=new IlpSolverFactory(ilpSolverId,numThreads,ilpWorkMemMegs);
    }
    if (parserName.equals("String_Node_Str")) {
      parser=new DmvCkyParser();
    }
 else     if (parserName.equals("String_Node_Str")) {
      parser=new IlpViterbiSentenceParser(formulation,ilpSolverFactory);
    }
 else     if (parserName.equals("String_Node_Str")) {
      parser=new IlpViterbiParser(formulation,ilpSolverFactory);
    }
 else     if (parserName.equals("String_Node_Str") || parserName.equals("String_Node_Str")) {
      DeltaGenerator deltaGen;
      if (deltaGenerator.equals("String_Node_Str")) {
        deltaGen=new FixedIntervalDeltaGenerator(interval,numPerSide);
      }
 else       if (deltaGenerator.equals("String_Node_Str")) {
        deltaGen=new FactorDeltaGenerator(factor,numPerSide);
      }
 else {
        throw new ParseException("String_Node_Str" + deltaGenerator);
      }
      if (parserName.equals("String_Node_Str")) {
        parser=new IlpViterbiParserWithDeltas(formulation,ilpSolverFactory,deltaGen);
      }
 else       if (parserName.equals("String_Node_Str")) {
        parser=new InitializedIlpViterbiParserWithDeltas(formulation,ilpSolverFactory,deltaGen,ilpSolverFactory);
      }
 else {
        throw new ParseException("String_Node_Str" + parserName);
      }
    }
 else {
      throw new ParseException("String_Node_Str" + parserName);
    }
    ModelFactory modelFactory;
    if (initWeights.equals("String_Node_Str")) {
      modelFactory=new UniformDmvModelFactory();
    }
 else     if (initWeights.equals("String_Node_Str")) {
      modelFactory=new RandomDmvModelFactory(lambda);
    }
 else     if (initWeights.equals("String_Node_Str")) {
      modelFactory=new SupervisedDmvModelFactory(goldTreebank);
    }
 else     if (initWeights.equals("String_Node_Str")) {
      modelFactory=new FixableModelFactory(null);
      ((FixableModelFactory)modelFactory).fixModel(goldModel);
    }
 else {
      throw new ParseException("String_Node_Str" + initWeights);
    }
    if (algorithm.equals("String_Node_Str")) {
      DmvViterbiEMTrainerPrm vtPrm=new DmvViterbiEMTrainerPrm(iterations,convergenceRatio,numRestarts,timeoutSeconds,lambda,parserEvaluator);
      trainer=new DmvViterbiEMTrainer(vtPrm,parser,modelFactory);
    }
    if (algorithm.equals("String_Node_Str")) {
      DmvViterbiEMTrainerPrm vtPrm=new DmvViterbiEMTrainerPrm(iterations,convergenceRatio,0,Double.POSITIVE_INFINITY,lambda,null);
      viterbiTrainer=new DmvViterbiEMTrainer(vtPrm,parser,modelFactory);
    }
  }
  CptBoundsDeltaFactory brancher=null;
  if (algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str")) {
    VariableSplitter varSplitter;
    if (varSplit.equals("String_Node_Str")) {
      varSplitter=new MidpointVarSplitter(MidpointChoice.HALF_PROB);
    }
 else     if (varSplit.equals("String_Node_Str")) {
      varSplitter=new MidpointVarSplitter(MidpointChoice.HALF_LOGPROB);
    }
 else {
      throw new ParseException("String_Node_Str" + varSplit);
    }
    VariableSelector varSelector;
    if (varSelection.equals("String_Node_Str")) {
      varSelector=new FullStrongVariableSelector(varSplitter);
    }
 else     if (varSelection.equals("String_Node_Str")) {
      varSelector=new PseudocostVariableSelector(varSplitter);
    }
 else     if (varSelection.equals("String_Node_Str")) {
      varSelector=new RegretVariableSelector();
    }
 else     if (varSelection.equals("String_Node_Str")) {
      varSelector=new RandomVariableSelector(true);
    }
 else     if (varSelection.equals("String_Node_Str")) {
      varSelector=new RandomVariableSelector(false);
    }
 else {
      throw new ParseException("String_Node_Str" + varSelection);
    }
    brancher=new BasicCptBoundsDeltaFactory(varSelector,varSplitter);
  }
  NodeOrderer nodeOrderer=null;
  if (nodeOrder.equals("String_Node_Str")) {
    nodeOrderer=new PqNodeOrderer(new BfsComparator());
  }
 else   if (nodeOrder.equals("String_Node_Str")) {
    DfsNodeOrdererPrm prm=new DfsNodeOrdererPrm();
    nodeOrderer=new DfsNodeOrderer(prm);
  }
 else   if (nodeOrder.equals("String_Node_Str")) {
    PlungingBfsNodeOrdererPrm prm=new PlungingBfsNodeOrdererPrm();
    prm.localRelativeGapThreshold=localRelativeGapThreshold;
    nodeOrderer=new PlungingBfsNodeOrderer(prm);
  }
 else   if (nodeOrder.equals("String_Node_Str")) {
    nodeOrderer=new DfsRandChildAtDepthNodeOrderer(60);
  }
 else   if (nodeOrder.equals("String_Node_Str")) {
    nodeOrderer=new DfsRandWalkNodeOrderer(60);
  }
  DmvSolFactoryPrm initSolPrm=getDmvSolFactoryPrm();
  DmvProjectorFactory projectorFactory=getDmvProjectorFactory();
  LazyBnbSolverPrm bnbPrm=new LazyBnbSolverPrm();
  bnbPrm.disableFathoming=disableFathoming;
  bnbPrm.epsilon=epsilon;
  bnbPrm.evaluator=new DmvSolutionEvaluator(parserEvaluator);
  bnbPrm.leafNodeOrderer=nodeOrderer;
  bnbPrm.timeoutSeconds=timeoutSeconds;
  if (algorithm.equals("String_Node_Str")) {
    bnbPrm.evaluator=null;
    bnbPrm.timeoutSeconds=bnbTimeoutSeconds;
    LocalBnBDmvTrainerPrm lbPrm=new LocalBnBDmvTrainerPrm(viterbiTrainer,bnbPrm,brancher,relaxFactory,projectorFactory,numRestarts,offsetProb,probOfSkipCm,timeoutSeconds,parserEvaluator,initSolPrm);
    trainer=new LocalBnBDmvTrainer(lbPrm);
  }
 else   if (algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str") || algorithm.equals("String_Node_Str")) {
    LazyBnbSolverFactory bnbSolverFactory;
    if (algorithm.equals("String_Node_Str")) {
      RandWalkBnbSamplerPrm prm=new RandWalkBnbSamplerPrm();
      prm.maxSamples=10000;
      bnbSolverFactory=prm;
    }
 else     if (algorithm.equals("String_Node_Str")) {
      DepthStratifiedBnbSamplerPrm prm=new DepthStratifiedBnbSamplerPrm();
      prm.maxDepth=60;
      bnbSolverFactory=prm;
    }
 else     if (algorithm.equals("String_Node_Str")) {
      bnbSolverFactory=bnbPrm;
    }
 else {
      throw new ParseException("String_Node_Str" + algorithm);
    }
    BnBDmvTrainerPrm bnbtPrm=new BnBDmvTrainerPrm();
    bnbtPrm.initSolPrm=initSolPrm;
    bnbtPrm.brancher=brancher;
    bnbtPrm.bnbSolverFactory=bnbSolverFactory;
    bnbtPrm.relaxFactory=relaxFactory;
    bnbtPrm.projectorFactory=projectorFactory;
    trainer=new BnBDmvTrainer(bnbtPrm);
  }
  if (trainer == null) {
    throw new ParseException("String_Node_Str" + algorithm);
  }
  return trainer;
}