docs: @Override
    public boolean add(S solution) {
      //Iterator of individuals over the list
      Iterator<S> iterator = getSolutionList().iterator();
  
      while (iterator.hasNext()) {
        S element = iterator.next();
        int flag = dominanceComparator.compare(solution, element);
        if (flag == -1) { // The Individual to insert dominates other
          // individuals in  the setArchive
          iterator.remove(); //Delete it from the setArchive
          int location = grid.location(element);
          if (grid.getLocationDensity(location) > 1) {//The hypercube contains
            grid.removeSolution(location);            //more than one individual
          } else {
            grid.updateGrid(getSolutionList());
          }
        }
        else if (flag == 1) { // An Individual into the file dominates the
          // solution to insert
          return false; // The solution will not be inserted
        }
      }
  
      // At this point, the solution may be inserted
      if (this.size() == 0) { //The setArchive is empty
        this.getSolutionList().add(solution);
        grid.updateGrid(getSolutionList());
        return true;
      }
  
      if (this.getSolutionList().size() < this.getMaxSize()) { //The setArchive is not full
        grid.updateGrid(solution, getSolutionList()); // Update the grid if applicable
        int location;
        location = grid.location(solution); // Get the location of the solution
        grid.addSolution(location); // Increment the density of the hypercube
        getSolutionList().add(solution); // Add the solution to the list
        return true;
      }
  
      // At this point, the solution has to be inserted and the setArchive is full
      grid.updateGrid(solution, getSolutionList());
      int location = grid.location(solution);
      if (location == grid.getMostPopulatedHypercube()) { // The solution is in the
        // most populated hypercube
        return false; // Not inserted
      } else {
        // Remove an solution from most populated area
        prune();
        // A solution from most populated hypercube has been removed,
        // insert now the solution
        grid.addSolution(location);
        getSolutionList().add(solution);
      }
      return true;
    }