def ystep(self): r"""Minimise Augmented Lagrangian with respect to :math:`\mathbf{y}`. """ AXU = self.AX + self.U Y0 = np.asarray(sl.shrink1(self.block_sep0(AXU), self.wl1 / self.rho), dtype=self.dtype) if self.opt['NonNegCoef']: Y0[Y0 < 0.0] = 0.0 Y1 = sl.proj_l2ball(self.block_sep1(AXU), self.S, self.epsilon, axes=0) self.Y = self.block_cat(Y0, Y1)
def ystep(self): r"""Minimise Augmented Lagrangian with respect to :math:`\mathbf{y}`. """ AXU = self.AX + self.U Y0 = np.asarray(sp.prox_l1(self.block_sep0(AXU), self.wl1 / self.rho), dtype=self.dtype) if self.opt['NonNegCoef']: Y0[Y0 < 0.0] = 0.0 Y1 = sl.proj_l2ball(self.block_sep1(AXU), self.S, self.epsilon, axes=0) self.Y = self.block_cat(Y0, Y1)
def eval_objfn(self): r"""Compute components of objective function as well as total contribution to objective function. The objective function is :math:`\| \mathbf{x} \|_1` and the constraint violation measure is :math:`P(\mathbf{x}) - \mathbf{x}` where :math:`P(\mathbf{x})` is the projection into the constraint set. """ obj = linalg.norm((self.wl1 * self.obfn_g0var()).ravel(), 1) cns = linalg.norm(sl.proj_l2ball(self.obfn_g1var(), self.S, self.epsilon, axes=0) - self.obfn_g1var()) return (obj, cns)
def eval_objfn(self): r"""Compute components of objective function as well as total contribution to objective function. The objective function is :math:`\| \mathbf{x} \|_1` and the constraint violation measure is :math:`P(\mathbf{x}) - \mathbf{x}` where :math:`P(\mathbf{x})` is the projection into the constraint set. """ obj = np.linalg.norm((self.wl1 * self.obfn_g0var()).ravel(), 1) cns = np.linalg.norm(sl.proj_l2ball( self.obfn_g1var(), self.S, self.epsilon, axes=0) - self.obfn_g1var()) return (obj, cns)
def test_17(self): b = np.array([0.0, 0.0, 2.0]) s = np.array([0.0, 0.0, 0.0]) r = 1.0 p = linalg.proj_l2ball(b, s, r) assert linalg.rrs(p, np.array([0.0, 0.0, 1.0])) < 1e-14