public AddressTable makeGroups(int minCapacity) {
    int noOfApps = addressTable.size();
    if (minCapacity == 0
        || noOfApps == 0
        || (MAX_CAPACITY * noOfApps < totalNoOfAgents)
        || minCapacity > 100) {
      throw new RuntimeException("Grouping could not be made");
    }

    if (totalNoOfAgents <= (minCapacity * noOfApps)) {
      balanceRoundRobin(minCapacity, minCapacity, noOfApps, Mode.FILL);
    } else {
      int x = totalNoOfAgents / noOfApps;
      balanceRoundRobin(x, minCapacity, noOfApps, Mode.FILL);
    }

    return addressTable;
  }
  public int fillApps(int agentIndex, int noToBeFilled, int appIndex) {
    int endIndex = agentIndex + noToBeFilled;
    AgentStateList newAgentStateList = new AgentStateList();
    AgentDataContainer newAgentDataContainer = new AgentDataContainer();

    for (; agentIndex < endIndex; agentIndex++) {
      AgentState agentState = agentStateList.get(agentIndex);
      String agentID = agentState.getID();
      ActionPerceptContainer actionPerceptContainer = agentDataContainer.get(agentID);

      newAgentStateList.add(agentState);
      newAgentDataContainer.put(agentID, actionPerceptContainer);
    }

    AddressAgentListTuple appsInfo = addressTable.get(appIndex);
    appsInfo.setAgentList(newAgentStateList);
    appsInfo.setAgentDataContainer(newAgentDataContainer);

    return agentIndex;
  }