def check_boundaries(self, pop):
        """
        Check and fix the boundaries of the given population.
        :param pop: Population to check and fix boundaries
        :return: Population with corrected boundaries
        """
        # check whether numpy array or pymoo population is given
        if isinstance(pop, Population):
            pop = pop.get("X")

        # check if any solution is outside the bounds
        for individual in pop:
            for i in range(len(individual)):
                if individual[i] > self.problem.xu[i]:
                    individual[i] = self.problem.xu[i]
                elif individual[i] < self.problem.xl[i]:
                    individual[i] = self.problem.xl[i]
        return pop

        Check and fix the boundaries of the given population.
        :param pop: Population to check and fix boundaries
        :return: Population with corrected boundaries
        
pymoo/algorithms/moo/kgb.py