Program: 189564
Project: 189564
Buggy source:
/** 
 * Note: this skips observations with a time delta of zero or less.
 */
@Override public void update(DataDistribution<VehicleState> target,Observation obs){
  final double timeDiff=prevTime == 0 ? 0 : (obs.getTimestamp().getTime() - prevTime) / 1000;
  prevTime=obs.getTimestamp().getTime();
  if (timeDiff <= 0)   return;
  final Multimap<VehicleState,DefaultWeightedValue<InferredPathEntry>> stateToPaths=HashMultimap.create();
  final Set<InferredPathEntry> evaluatedPaths=Sets.newHashSet();
  final List<DefaultWeightedValue<VehicleState>> resampler=Lists.newArrayList();
  for (  final VehicleState state : target.getDomain()) {
    state.getMovementFilter().predict(state.getBelief(),PathEdge.getEdge(state.getInferredEdge()),PathEdge.getEdge(state.getInferredEdge(),0d));
    final Set<InferredPath> instStateTransitions=inferredGraph.getPaths(state,obs.getObsCoords());
    state.getMovementFilter().setCurrentTimeDiff(timeDiff);
    double totalLogLik=Double.NEGATIVE_INFINITY;
    for (    final InferredPath path : instStateTransitions) {
      final InferredPathEntry infPath=path.getPredictiveLogLikelihood(obs,state);
      if (isDebug)       evaluatedPaths.add(infPath);
      totalLogLik=LogMath.add(totalLogLik,infPath.getTotalLogLikelihood());
      stateToPaths.put(state,new DefaultWeightedValue<InferredPathEntry>(infPath,infPath.getTotalLogLikelihood()));
    }
    resampler.add(new DefaultWeightedValue<VehicleState>(state,totalLogLik));
  }
  final Random rng=getRandom();
  final DataDistribution<VehicleState> resampleDist=StatisticsUtil.getLogNormalizedDistribution(resampler);
  @SuppressWarnings("String_Node_Str") final ArrayList<? extends VehicleState> smoothedStates=resampleDist.sample(rng,getNumParticles());
  target.clear();
  if (isDebug)   this.filterInfo.put(obs,new FilterInformation(evaluatedPaths,resampleDist));
  for (  final VehicleState state : smoothedStates) {
    final VehicleState newState=state.clone();
    final DataDistribution<InferredPathEntry> instStateDist=StatisticsUtil.getLogNormalizedDistribution(Lists.newArrayList(stateToPaths.get(newState)));
    final InferredPathEntry sampledPathEntry=instStateDist.sample(rng);
    final PathEdge sampledEdge;
    if (sampledPathEntry.getPath().getEdges().size() > 1) {
      final DataDistribution<PathEdge> pathEdgeDist=StatisticsUtil.getLogNormalizedDistribution(sampledPathEntry.getEdgeToPredictiveBelief());
      sampledEdge=pathEdgeDist.sample(rng);
    }
 else {
      sampledEdge=sampledPathEntry.getPath().getEdges().get(0);
    }
    final MultivariateGaussian sampledBelief=sampledPathEntry.getEdgeToPredictiveBelief().get(sampledEdge).getValue().clone();
    final StandardRoadTrackingFilter updatedFilter=sampledPathEntry.getFilter().clone();
    updatedFilter.measure(sampledBelief,obs.getProjectedPoint(),sampledEdge);
    InferredEdge prevEdge=sampledPathEntry.getPath().getEdges().get(0).getInferredEdge();
    final EdgeTransitionDistributions updatedEdgeTransDist=newState.getEdgeTransitionDist().clone();
    for (    final PathEdge edge : sampledPathEntry.getPath().getEdges()) {
      if (prevEdge != null)       updatedEdgeTransDist.update(prevEdge,edge.getInferredEdge());
      if (!edge.isEmptyEdge()) {
        edge.getInferredEdge().getVelocityEstimator().update(edge.getInferredEdge().getVelocityPrecisionDist(),sampledBelief.getMean().getElement(1));
      }
      prevEdge=edge.getInferredEdge();
    }
    final VehicleState newTransState=new VehicleState(this.inferredGraph,obs,updatedFilter,sampledBelief,updatedEdgeTransDist,sampledEdge,sampledPathEntry.getPath(),state);
    target.set(newTransState,1d / smoothedStates.size());
  }
}

Fixed version (ground truth):
/** 
 * Note: this skips observations with a time delta of zero or less.
 */
@Override public void update(DataDistribution<VehicleState> target,Observation obs){
  final double timeDiff=prevTime == 0 ? 0 : (obs.getTimestamp().getTime() - prevTime) / 1000;
  prevTime=obs.getTimestamp().getTime();
  if (timeDiff <= 0)   return;
  final Multimap<VehicleState,DefaultWeightedValue<InferredPathEntry>> stateToPaths=HashMultimap.create();
  final Set<InferredPath> evaluatedPaths=Sets.newHashSet();
  final List<DefaultWeightedValue<VehicleState>> resampler=Lists.newArrayList();
  for (  final VehicleState state : target.getDomain()) {
    final Set<InferredPath> instStateTransitions=inferredGraph.getPaths(state,obs.getObsCoords());
    state.getMovementFilter().setCurrentTimeDiff(timeDiff);
    double totalLogLik=Double.NEGATIVE_INFINITY;
    for (    final InferredPath path : instStateTransitions) {
      final InferredPathEntry infPath=path.getPredictiveLogLikelihood(obs,state);
      if (isDebug)       evaluatedPaths.add(path);
      totalLogLik=LogMath.add(totalLogLik,infPath.getTotalLogLikelihood());
      stateToPaths.put(state,new DefaultWeightedValue<InferredPathEntry>(infPath,infPath.getTotalLogLikelihood()));
    }
    resampler.add(new DefaultWeightedValue<VehicleState>(state,totalLogLik));
  }
  final Random rng=getRandom();
  final DataDistribution<VehicleState> resampleDist=StatisticsUtil.getLogNormalizedDistribution(resampler);
  @SuppressWarnings("String_Node_Str") final ArrayList<? extends VehicleState> smoothedStates=resampleDist.sample(rng,getNumParticles());
  target.clear();
  if (isDebug)   this.filterInfo.put(obs,new FilterInformation(evaluatedPaths,resampleDist));
  for (  final VehicleState state : smoothedStates) {
    final VehicleState newState=state.clone();
    final DataDistribution<InferredPathEntry> instStateDist=StatisticsUtil.getLogNormalizedDistribution(Lists.newArrayList(stateToPaths.get(newState)));
    final InferredPathEntry sampledPathEntry=instStateDist.sample(rng);
    final PathEdge sampledEdge;
    if (sampledPathEntry.getPath().getEdges().size() > 1) {
      final DataDistribution<PathEdge> pathEdgeDist=StatisticsUtil.getLogNormalizedDistribution(sampledPathEntry.getEdgeToPredictiveBelief());
      sampledEdge=pathEdgeDist.sample(rng);
    }
 else {
      sampledEdge=sampledPathEntry.getPath().getEdges().get(0);
    }
    final MultivariateGaussian sampledBelief=sampledPathEntry.getEdgeToPredictiveBelief().get(sampledEdge).getValue().clone();
    final StandardRoadTrackingFilter updatedFilter=sampledPathEntry.getFilter().clone();
    updatedFilter.measure(sampledBelief,obs.getProjectedPoint(),sampledEdge);
    InferredEdge prevEdge=sampledPathEntry.getPath().getEdges().get(0).getInferredEdge();
    final EdgeTransitionDistributions updatedEdgeTransDist=newState.getEdgeTransitionDist().clone();
    for (    final PathEdge edge : sampledPathEntry.getPath().getEdges()) {
      if (prevEdge != null)       updatedEdgeTransDist.update(prevEdge,edge.getInferredEdge());
      if (!edge.isEmptyEdge()) {
        edge.getInferredEdge().getVelocityEstimator().update(edge.getInferredEdge().getVelocityPrecisionDist(),sampledBelief.getMean().getElement(1));
      }
      prevEdge=edge.getInferredEdge();
    }
    final VehicleState newTransState=new VehicleState(this.inferredGraph,obs,updatedFilter,sampledBelief,updatedEdgeTransDist,sampledEdge,sampledPathEntry.getPath(),state);
    target.set(newTransState,1d / smoothedStates.size());
  }
}