Program: 19790
Project: 19790
Buggy source:
@Override protected String chooseGroup(){
  if (this.getDataModel().getGroupId() != null)   return this.getDataModel().getGroupId();
  String chosenGroup="String_Node_Str";
  double currentHeuristic, previousHeuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction;
  double trustFaction, trustSum;
  int numKnownTrustValues;
  System.out.println(getConn().availableGroups().size());
  if (chosenGroup.equals("String_Node_Str")) {
    String optimalGrouping="String_Node_Str";
    for (    String trustee : getConn().getUngroupedAgents()) {
      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.5 && (previousHeuristic < currentHeuristic)) {
          optimalGrouping=trustee;
          previousHeuristic=currentHeuristic;
        }
      }
    }
    if (optimalGrouping.equals("String_Node_Str")) {
      return null;
    }
 else {
      GroupDataInitialiser myGroup=new GroupDataInitialiser(this.uniformRandLong(),(this.getDataModel().getEconomicBelief() + getConn().getAgentById(optimalGrouping).getEconomicBelief()) / 2);
      Class<? extends AbstractGroupAgent> gtype=getConn().getAllowedGroupTypes().get(0);
      chosenGroup=getConn().createGroup(gtype,myGroup);
    }
  }
  return chosenGroup;
}

Fixed version (ground truth):
@Override protected String chooseGroup(){
  if (this.getDataModel().getGroupId() != null)   return null;
  if (getConn().availableGroups().isEmpty()) {
    if (getConn().getAllowedGroupTypes().isEmpty())     return null;
    Class<? extends AbstractGroupAgent> gtype=getConn().getAllowedGroupTypes().get(0);
    return getConn().createGroup(gtype,new GroupDataInitialiser(this.uniformRandLong(),getDataModel().getEconomicBelief()));
  }
  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, trustSum;
  int numKnownTrustValues;
  PublicGroupDataModel aGroup;
  for (  String groupID : getConn().availableGroups()) {
    aGroup=getConn().getGroupById(groupID);
    numKnownTrustValues=0;
    trustSum=0;
    for (    String trustee : aGroup.getMemberList()) {
      Double trustValue=this.getDataModel().getTrust(trustee);
      if (trustValue != null) {
        trustSum+=trustValue;
        numKnownTrustValues++;
      }
    }
    if (numKnownTrustValues != 0) {
      trustFaction=trustSum / numKnownTrustValues;
    }
 else {
      trustFaction=0;
    }
    economic=aGroup.getCurrentEconomicPoisition() - this.getDataModel().getEconomicBelief();
    social=aGroup.getEstimatedSocialLocation() - 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.5 && previousHeuristic < currentHeuristic) {
      chosenGroup=aGroup.getId();
      previousHeuristic=currentHeuristic;
    }
  }
  System.out.println("String_Node_Str" + currentHeuristic + "String_Node_Str"+ trustFaction+ "String_Node_Str"+ esFaction);
  if (!chosenGroup.isEmpty())   return chosenGroup;
  return null;
}