(self, objectivefx)
return result
The StagedOptimizer overwrites the default behaviour of optimize(). It passes the best point of the previous
        stage to the next stage. If the optimization is interrupted or fails, this process stops and the OptimizeResult 
        is returned.
The StagedOptimizer overwrites the default behaviour of optimize(). It passes the best point of the previous
        stage to the next stage. If the optimization is interrupted or fails, this process stops and the OptimizeResult 
        is returned.
The StagedOptimizer overwrites the default behaviour of optimize () . It passes the best point of the previous stage to the next stage . If the optimization is interrupted or fails this process stops and the OptimizeResult is returned .
def optimize(self, objectivefx):
        """
        The StagedOptimizer overwrites the default behaviour of optimize(). It passes the best point of the previous
        stage to the next stage. If the optimization is interrupted or fails, this process stops and the OptimizeResult 
        is returned.
        """

        results = []
        for current, following in zip(self.optimizers[:-1], self.optimizers[1:]):
            result = current.optimize(objectivefx)
            results.append(result)
            if not result.success:
                result.message += " StagedOptimizer interrupted after {0}.".format(current.__class__.__name__)
                break
            following.set_initial(self._best_x(results)[0])

        if result.success:
            result = self.optimizers[-1].optimize(objectivefx)
            results.append(result)

        result.nfev = sum(r.nfev for r in results)
        result.nstages = len(results)
        if any(r.success for r in results):
            result.x, result.fun = self._best_x(results)
        return result
def optimize ( self , objectivefx ) : results = [ ] for current , following in zip ( self . optimizers [ : - 1 ] , self . optimizers [ 1 : ] ) : result = current . optimize ( objectivefx ) results . append ( result ) if not result . success : result . message += " StagedOptimizer interrupted after {0}." . format ( current . __class__ . __name__ ) break following . set_initial ( self . _best_x ( results ) [ 0 ] ) if result . success : result = self . optimizers [ - 1 ] . optimize ( objectivefx ) results . append ( result ) result . nfev = sum ( r . nfev for r in results ) result . nstages = len ( results ) if any ( r . success for r in results ) : result . x , result . fun = self . _best_x ( results ) return result