The bounds of the random variable.
        
        Set `self.i=0.95` to return the 95% interval if this is used for setting
        bounds on optimizers/etc. where infinite bounds may not be useful.
517230
def bounds(self):
        
        return [scipy.stats.norm.interval(self.i, loc=m, scale=s) for s, m in zip(self.sigma, self.mu)]
202
def get_bounds(self):
        

        size = self.get_size()
        top_left = self.get_position([0, 0])

        # t, r, b, l
        bounds = [top_left[1], top_left[0] + size[0], top_left[1] + size[1], top_left[0]]
        return bounds
541898
def CredibleInterval(self, percentage=90):
        
        prob = (1 - percentage / 100.0) / 2
        interval = self.Value(prob), self.Value(1 - prob)
        return interval
1290142
def check_feasibility(x_bounds, lowerbound, upperbound):
    '''
    
    '''
    # x_bounds should be sorted, so even for "discrete_int" type,
    # the smallest and the largest number should the first and the last element
    x_bounds_lowerbound = sum([x_bound[0] for x_bound in x_bounds])
    x_bounds_upperbound = sum([x_bound[-1] for x_bound in x_bounds])

    # return ((x_bounds_lowerbound <= lowerbound) and (x_bounds_upperbound >= lowerbound)) or \
    #        ((x_bounds_lowerbound <= upperbound) and (x_bounds_upperbound >= upperbound))
    return (x_bounds_lowerbound <= lowerbound <= x_bounds_upperbound) or \
           (x_bounds_lowerbound <= upperbound <= x_bounds_upperbound)
115440
def sd(self):
        ''''''
        v = self.var()
        if len(v):
            return np.sqrt(v)
        else:
            return None
683168
def bounds(self):
        
        corners = self.bounds_corners
        bounds = np.array([corners.min(axis=0),
                           corners.max(axis=0)])
        return bounds
390835
def valueAt(self, percent):
        
        values = self.values()
        if percent < 0:
            index = 0
        elif percent > 1:
            index = -1
        else:
            index = percent * (len(values) - 1)
        
        # allow some floating point errors for the index (30% left or right)
        remain = index % 1
        if remain < 0.3 or 0.7 < remain:
            try:
                return values[int(round(index))]
            except IndexError:
                return None
        return None
589085
def nearest_interval(self, interval):
        
        thresh_range = 25  # in cents
        if interval < self.intervals[0] - thresh_range or interval > self.intervals[-1] + thresh_range:
            raise IndexError("The interval given is beyond " + str(thresh_range)
                             + " cents over the range of intervals defined.")

        index = find_nearest_index(self.intervals, interval)
        return self.intervals[index]
176307
def bounds(self):
        
        bounds = []
        for p in self.params:
            if p.fixed:
                if p.value >= 0.0:
                    bounds.append([np.nextafter(p.value, 0), p.value])
                else:
                    bounds.append([p.value, np.nextafter(p.value, 0)])
            else:
                bounds.append([p.min, p.max])
        return bounds
1284253
def ping_interval(self, value):
        

        if not isinstance(value, int):
            raise TypeError("ping interval must be int")
        if value < 0:
            raise ValueError("ping interval must be greater then 0")

        self._ping_interval = value
1299447
def set_variable_bounds(self, name, lower, upper):
        """"""
        self.bounds[name] = (lower, upper)
        self._reset_solution()
463389
def random(self):
        
        minimum = self.minimum() or 0
        maximum = self.maximum() or 100
        return random.randint(minimum, maximum)
478492
def _get_internal_delta(self):
        

        if self._transformation is None:

            return self._delta

        else:

            delta_int = None

            for i in range(2):

                # Try using the low bound

                low_bound_ext = self.value - self.delta

                # Make sure we are within the margins

                if low_bound_ext > self.min_value:

                    # Ok, let's use that for the delta
                    low_bound_int = self._transformation.forward(low_bound_ext)

                    delta_int = abs(low_bound_int - self._get_internal_value())

                    break

                else:

                    # Nope, try with the hi bound

                    hi_bound_ext = self.value + self._delta

                    if hi_bound_ext < self.max_value:

                        # Ok, let's use it
                        hi_bound_int = self._transformation.forward(hi_bound_ext)
                        delta_int = abs(hi_bound_int - self._get_internal_value())

                        break

                    else:

                        # Fix delta
                        self.delta = abs(self.value - self.min_value) / 4.0

                        if self.delta == 0:

                            # Parameter at the minimum
                            self.delta = abs(self.value - self.max_value) / 4.0

                        # Try again
                        continue

            assert delta_int is not None, "Bug"

            return delta_int
1368368
private int randomValue(IntVar x) {
        int i = rnd.nextInt(x.getDomainSize());
        DisposableValueIterator ite = x.getValueIterator(true);
        int pos = -1;
        try {
            while (i >= 0) {
                pos = ite.next();
                i--;
            }
        } finally {
            ite.dispose();
        }
        return pos;
    }
667478
def _in_bounds(prop, instance, value):
    """"""
    if (
            (prop.min is not None and value < prop.min) or
            (prop.max is not None and value > prop.max)
    ):
        prop.error(instance, value, extra='Not within allowed range.')
1143549
def min(self):
        
        return int(self._min) if not np.isinf(self._min) else self._min
1067472
def within_limits(self, value):
        

        return (self.limits[0] is None or value >= self.limits[0]) and (self.limits[1] is None or value <= self.limits[1])