def update(self, *args, **kwargs):
        solutions = kwargs['SOLUTIONS']

        if solutions:
            variables = []
            for s in solutions:
                variables.append(s.objectives)

            hv = HyperVolume(self.referencePoint)
            hv.is_minimization = True
            self.currentHyperVolume = hv.compute(variables)

            variation = float(abs(self.lastHyperVolume - self.currentHyperVolume) / self.currentHyperVolume)

            if variation <= self.HyperVolumeStagnationPercentage:
                self.counter += 1
                if self.counter >= 15:
                    self.HasReachVariation = True
                else:
                    self.lastHyperVolume = copy.deepcopy(self.currentHyperVolume)
            else:
                self.lastHyperVolume = copy.deepcopy(self.currentHyperVolume)
                self.counter = 0
                self.HasReachVariation = False

            print(self.counter)
    def update(self, *args, **kwargs):
        self.evaluations = kwargs['EVALUATIONS']
        solutions = kwargs['SOLUTIONS']

        if solutions:
            variables = []
            for s in solutions:
                variables.append(s.objectives)

            hv = HyperVolume(self.referencePoint)
            hv.is_minimization = True
            self.hyperVolumes.append(hv.compute(variables))

            # TODO: Implement to IGD

            if self.evaluations >= self.max_evaluations:
                fileValue = self._getFileValue()
                filename = 'Hist/' + str(self.AlgorithmName) + '/' + 'HV-' + str(fileValue) + '.txt'
                with open(filename, 'w') as f:
                    for hv in self.hyperVolumes:
                        f.write(str(hv))
                        f.write('\n')