def __init__(self, a, b, c=0): super().__init__(sets.R()) self.a, self.b, self.c = np.array(a).item(), np.array( b).item(), np.array(c).item() self.smooth = 2
def __init__(self, n, threshold): if threshold <= 0: raise ValueError("The threshold must be positive.") super().__init__(sets.R(n, 1)) self.threshold = threshold self.smooth = 2
def __init__(self, n=1, weight=1): # check arguments validity super().__init__(sets.R(n, 1)) self.weight = weight # l1 ball useful for computing the proximal self.l1_ball = sets.Ball_l1(np.zeros(self.dom.shape), 1)
def __init__(self, A, b, threshold): # each row in A and element of b represent a data point super().__init__(sets.R(A.shape[1], 1)) self.m = A.shape[0] # domain dim. and num. data points # store data as lists self.A = [A[d, ].reshape(self.dom.shape).T for d in range(self.m)] self.b = [np.array(b[d]).item() for d in range(self.m)] self.huber_fn = Huber(1, threshold) # Huber function self.smooth = 2
def __init__(self, A, b, c=0): A = np.array(A) super().__init__(sets.R(A.shape[0], 1)) A = A.reshape((A.shape[0], A.shape[0])) # check it is square # check b and c (reshaping if need be) b = self.dom.check_input(b) c = np.array(c).item() self.A, self.b, self.c = A, b, c self.smooth = 2
def __init__(self, n=1, weight=1): r""" Constructor of the cost. Parameters ---------- n : int Size of the unknown :math:`x`. weight : float, optional A weight multiplying the norm. Defaults to :math:`1`. """ # check arguments validity super().__init__(sets.R(n, 1)) self.weight = weight self.smooth = 0
def __init__(self, costs): """ Class constructor. Parameters ---------- costs : list The component costs. """ # check if there are dynamic costs times = [c.time for c in costs if c.is_dynamic] time = times[0] if len(times) > 0 else None super().__init__(sets.R(*costs[0].dom.shape, len(costs)), time) self.costs, self.N = costs, len(costs) self.smooth = min([c.smooth for c in costs])
def __init__(self, weight=1): super().__init__(sets.R()) self.weight, self.smooth = weight, 0
def __init__(self, t_s, t_max): super().__init__(sets.R(2, 1), sets.T(t_s, t_max=t_max)) self.smooth = 2
def __init__(self, t_s, t_max, omega=0.02 * math.pi, kappa=7.5, mu=1.75): super().__init__(sets.R(), sets.T(t_s, t_max=t_max)) self.omega, self.kappa, self.mu = omega, kappa, mu self.smooth = 2
def __init__(self): super().__init__(sets.R()) self.smooth = 2
def __init__(self, threshold): super().__init__(sets.R()) self.threshold, self.smooth = threshold, 2