(self, x, bounds=None, copy=False, copy_always=False)
return x_out
sets out-of-bounds components of ``x`` on the bounds.

        Arguments
        ---------
            `bounds`
                can be `None`, in which case the "default" bounds are used,
                or ``[lb, ub]``, where `lb` and `ub`
                represent lower and upper domain bounds respectively that
                can be `None` or a scalar or a list or array of length ``len(self)``

        code is more or less copy-paste from Solution.repair, but never tested
sets out-of-bounds components of ``x`` on the bounds.
sets out - of - bounds components of x on the bounds .
def repair(self, x, bounds=None, copy=False, copy_always=False):
        """sets out-of-bounds components of ``x`` on the bounds.

        Arguments
        ---------
            `bounds`
                can be `None`, in which case the "default" bounds are used,
                or ``[lb, ub]``, where `lb` and `ub`
                represent lower and upper domain bounds respectively that
                can be `None` or a scalar or a list or array of length ``len(self)``

        code is more or less copy-paste from Solution.repair, but never tested

        """
        # TODO (old data): CPU(N,lam,iter=20,200,100): 3.3s of 8s for two bounds, 1.8s of 6.5s for one bound
        # TODO: test whether np.max([bounds[0], x], axis=0) etc is speed relevant

        if bounds is None:
            bounds = self.bounds
        if copy_always:
            x_out = array(x, copy=True)
        if bounds not in (None, [None, None], (None, None)):  # solely for effiency
            x_out = array(x, copy=True) if copy and not copy_always else x
            if bounds[0] is not None:
                if np.isscalar(bounds[0]):
                    for i in xrange(len(x)):
                        x_out[i] = max([bounds[0], x[i]])
                else:
                    for i in xrange(len(x)):
                        if bounds[0][i] is not None:
                            x_out[i] = max([bounds[0][i], x[i]])
            if bounds[1] is not None:
                if np.isscalar(bounds[1]):
                    for i in xrange(len(x)):
                        x_out[i] = min([bounds[1], x[i]])
                else:
                    for i in xrange(len(x)):
                        if bounds[1][i] is not None:
                            x_out[i] = min([bounds[1][i], x[i]])
        return x_out
def repair ( self , x , bounds = None , copy = False , copy_always = False ) : # TODO (old data): CPU(N,lam,iter=20,200,100): 3.3s of 8s for two bounds, 1.8s of 6.5s for one bound # TODO: test whether np.max([bounds[0], x], axis=0) etc is speed relevant if bounds is None : bounds = self . bounds if copy_always : x_out = array ( x , copy = True ) if bounds not in ( None , [ None , None ] , ( None , None ) ) : # solely for effiency x_out = array ( x , copy = True ) if copy and not copy_always else x if bounds [ 0 ] is not None : if np . isscalar ( bounds [ 0 ] ) : for i in xrange ( len ( x ) ) : x_out [ i ] = max ( [ bounds [ 0 ] , x [ i ] ] ) else : for i in xrange ( len ( x ) ) : if bounds [ 0 ] [ i ] is not None : x_out [ i ] = max ( [ bounds [ 0 ] [ i ] , x [ i ] ] ) if bounds [ 1 ] is not None : if np . isscalar ( bounds [ 1 ] ) : for i in xrange ( len ( x ) ) : x_out [ i ] = min ( [ bounds [ 1 ] , x [ i ] ] ) else : for i in xrange ( len ( x ) ) : if bounds [ 1 ] [ i ] is not None : x_out [ i ] = min ( [ bounds [ 1 ] [ i ] , x [ i ] ] ) return x_out