Program: 189460
Project: 189460
Buggy source:
/** 
 * This method returns the predictive distribution over the conditional path. Note that the prior must be converted to this path's distance and direction, and the current vehicle state must have a value for its path state parameter.
 * @param prior
 * @return
 */
@Override public PathStateMixtureDensityModel createPredictiveDistribution(MultivariateGaussian prior){
  final List<PathStateDistribution> distributions=Lists.newArrayList();
  final List<Double> weights=Lists.newArrayList();
  if (this.path.isNullPath()) {
    MultivariateGaussian groundDistribution;
    if (prior.getInputDimensionality() == 4) {
      groundDistribution=prior.clone();
    }
 else {
      final PathState prevPathState=this.currentState.getPathStateParam().getValue();
      groundDistribution=PathUtils.getGroundBeliefFromRoad(prior.clone(),prevPathState.getEdge(),true,true);
    }
    distributions.add(new PathStateDistribution(this.path,groundDistribution));
    weights.add(0d);
  }
 else {
    MultivariateGaussian roadDistribution;
    if (prior.getInputDimensionality() == 4) {
      roadDistribution=PathUtils.getRoadBeliefFromGround(prior,Iterables.getOnlyElement(this.path.getPathEdges()),true);
      if (roadDistribution.getMean().getElement(1) > 0d) {
        distributions.add(new PathStateDistribution(this.path,roadDistribution));
        weights.add(0d);
      }
    }
 else {
      roadDistribution=prior;
      for (      final PathEdge edge : this.path.getPathEdges()) {
        PathStateDistribution prediction=getPathEdgePredictive(roadDistribution,edge);
        if (prediction == null)         break;
        distributions.add(prediction);
        weights.add(this.path.getPathEdges().size() == 1 ? 0d : this.marginalPredictiveLogLikInternal(this.path,roadDistribution,edge));
      }
    }
  }
  final PathStateMixtureDensityModel result=new PathStateMixtureDensityModel(distributions,Doubles.toArray(weights));
  Preconditions.checkState(Math.abs(Math.exp(result.getPriorWeightSum()) - 1d) < 1e-5);
  return result;
}

Fixed version (ground truth):
/** 
 * This method returns the predictive distribution over the conditional path. Note that the prior must be converted to this path's distance and direction, and the current vehicle state must have a value for its path state parameter.
 * @param prior
 * @return
 */
@Override public PathStateMixtureDensityModel createPredictiveDistribution(MultivariateGaussian prior){
  final List<PathStateDistribution> distributions=Lists.newArrayList();
  final List<Double> weights=Lists.newArrayList();
  if (this.path.isNullPath()) {
    MultivariateGaussian groundDistribution;
    if (prior.getInputDimensionality() == 4) {
      groundDistribution=prior.clone();
    }
 else {
      final PathState prevPathState=this.currentState.getPathStateParam().getValue();
      groundDistribution=PathUtils.getGroundBeliefFromRoad(prior.clone(),prevPathState.getEdge(),true,true);
    }
    distributions.add(new PathStateDistribution(this.path,groundDistribution));
    weights.add(0d);
  }
 else {
    MultivariateGaussian roadDistribution;
    if (prior.getInputDimensionality() == 4) {
      roadDistribution=PathUtils.getRoadBeliefFromGround(prior,Iterables.getOnlyElement(this.path.getPathEdges()),true);
      if (roadDistribution.getMean().getElement(1) > 0d) {
        distributions.add(new PathStateDistribution(this.path,roadDistribution));
        weights.add(0d);
      }
    }
 else {
      roadDistribution=prior;
      for (      final PathEdge edge : this.path.getPathEdges()) {
        PathStateDistribution prediction=getPathEdgePredictive(roadDistribution,edge);
        if (prediction == null)         break;
        distributions.add(prediction);
        weights.add(this.path.getPathEdges().size() == 1 ? 0d : this.marginalPredictiveLogLikInternal(this.path,roadDistribution,edge));
      }
    }
  }
  final PathStateMixtureDensityModel result=new PathStateMixtureDensityModel(distributions,Doubles.toArray(weights));
  Preconditions.checkState(result.getDistributionCount() == 0 || Math.abs(Math.exp(result.getPriorWeightSum()) - 1d) < 1e-5);
  return result;
}