def next(self, basis, element, objective):
    delta_objective = np.abs((self.last_objective - objective))
    self.last_objective = objective
    carry_on = True
    if self.first_run:
        self._step = (self._step + 1)
        if (self._step == self.max_l):
            self.first_run = False
            self._step = 0
            (c, x, n) = self.shells[self._step]
            self.shells[self._step] = (c, x, min((n + 1), self.max_n))
    else:
        if (delta_objective < self.target):
            self.shell_done[self._step] = 0
        self._step = ((self._step + 1) % self.max_l)
        (c, x, n) = self.shells[self._step]
        if (n == self.max_n):
            self.shell_done[self._step] = 0
        elif (self.shell_done[self._step] != 0):
            self.shells[self._step] = (c, x, (n + 1))
        carry_on = (np.sum(self.shell_done) != 0)
    return carry_on
def next(self, basis, element, objective):
    delta_objective = np.abs((self.last_objective - objective))
    self.last_objective = objective
    carry_on = True
    if self.first_run:
        self._step = (self._step + 1)
        if (self._step == self.max_l):
            self.first_run = False
            self._step = 0
            (c, x, n) = self.shells[self._step]
            self.shells[self._step] = (c, x, min((n + 1), self.max_n))
    else:
        if (delta_objective < self.target):
            self.shell_done[self._step] = 0
        self._step = ((self._step + 1) % self.max_l)
        (c, x, n) = self.shells[self._step]
        if (n == self.max_n):
            self.shell_done[self._step] = 0
        elif (self.shell_done[self._step] != 0):
            self.shells[self._step] = (c, x, (n + 1))
        carry_on = (np.sum(self.shell_done) != 0)
    return carry_on