Program: 19750
Project: 19750
Buggy source:
/** 
 * This method enables agents to check their compatibility with other free agents
 * @param none
 * @return The group ID that this agent has chosen to join. If null no group is chosen.
 */
private String freeAgentsGrouping(){
  String chosenGroup="String_Node_Str";
  double currentHeuristic=0, previousHeuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction=0;
  double trustFaction=0;
  String bestPartner="String_Node_Str";
  for (  String trustee : getConn().getUngroupedAgents()) {
    if ((!this.getId().equals(trustee)) && (!invitationHolders.contains(trustee)) && (!groupFounders.contains(trustee))) {
      Double trustValue=this.getDataModel().getTrust(trustee);
      if (trustValue != null)       trustFaction=trustValue;
      economic=getConn().getAgentById(trustee).getEconomicBelief() - getDataModel().getEconomicBelief();
      social=getConn().getAgentById(trustee).getSocialBelief() - getDataModel().getSocialBelief();
      vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
      esFaction=1 - (vectorDistance / maxDistance);
      currentHeuristic=0.5 * trustFaction + 0.5 * esFaction;
      if ((currentHeuristic > 0.6) && (previousHeuristic < currentHeuristic)) {
        bestPartner=trustee;
        previousHeuristic=currentHeuristic;
      }
    }
  }
  if (bestPartner.equals("String_Node_Str"))   return null;
 else {
    GroupDataInitialiser myGroup=new GroupDataInitialiser(this.uniformRandLong(),(this.getDataModel().getEconomicBelief() + getConn().getAgentById(bestPartner).getEconomicBelief()) / 2);
    Class<? extends AbstractGroupAgent> gtype=getConn().getAllowedGroupTypes().get(0);
    chosenGroup=getConn().createGroup(gtype,myGroup,bestPartner);
    groupFounders.add(this.getId());
    return chosenGroup;
  }
}

Fixed version (ground truth):
/** 
 * This method enables agents to check their compatibility with other free agents
 * @param none
 * @return The group ID that this agent has chosen to join. If null no group is chosen.
 */
private String freeAgentsGrouping(){
  String chosenGroup="String_Node_Str";
  double currentHeuristic=0, previousHeuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction=0;
  double trustFaction=0;
  String bestPartner="String_Node_Str";
  for (  String trustee : getConn().getUngroupedAgents()) {
    if ((!this.getId().equals(trustee)) && (!invitationHolders.contains(trustee)) && (!groupFounders.contains(trustee))) {
      Double trustValue=this.getDataModel().getTrust(trustee);
      if (trustValue != null)       trustFaction=trustValue;
      economic=getConn().getAgentById(trustee).getEconomicBelief() - getDataModel().getEconomicBelief();
      social=getConn().getAgentById(trustee).getSocialBelief() - getDataModel().getSocialBelief();
      vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
      esFaction=1 - (vectorDistance / maxDistance);
      currentHeuristic=0.7 * trustFaction + 0.3 * esFaction;
      if ((currentHeuristic > 0.7) && (previousHeuristic < currentHeuristic)) {
        bestPartner=trustee;
        previousHeuristic=currentHeuristic;
      }
    }
  }
  if (bestPartner.equals("String_Node_Str"))   return null;
 else {
    GroupDataInitialiser myGroup=new GroupDataInitialiser(this.uniformRandLong(),(this.getDataModel().getEconomicBelief() + getConn().getAgentById(bestPartner).getEconomicBelief()) / 2);
    Class<? extends AbstractGroupAgent> gtype=getConn().getAllowedGroupTypes().get(0);
    chosenGroup=getConn().createGroup(gtype,myGroup,bestPartner);
    groupFounders.add(this.getId());
    return chosenGroup;
  }
}