def init_dcp_attr(self): shape = u.Shape(*intf.size(self.value)) # If scalar, check sign. Else unknown sign. if shape.size == (1, 1): sign = u.Sign.val_to_sign(self.value) else: sign = u.Sign.UNKNOWN self._dcp_attr = u.DCPAttr(sign, u.Curvature.CONSTANT, shape)
def init_dcp_attr(self): """Determines the curvature, sign, and shape from the arguments. """ sign = self.args[0].objective.args[0]._dcp_attr.sign if isinstance(self.args[0].objective, Minimize): curvature = u.curvature.Curvature.CONVEX elif isinstance(self.args[0].objective, Maximize): curvature = u.curvature.Curvature.CONCAVE else: raise Exception( ("You called partial_optimize with a Problem object that " "contains neither a Minimize nor a Maximize statement; " "this is not supported.")) self._dcp_attr = u.DCPAttr(sign, curvature, u.Shape(1, 1))
def init_dcp_attr(self): """Override. """ self._dcp_attr = utils.DCPAttr(utils.Sign.POSITIVE, utils.Curvature.AFFINE, utils.Shape(self._rows, self._cols))
def init_dcp_attr(self): shape = u.Shape(self._rows, self._cols) sign = u.Sign(self.sign_str) self._dcp_attr = u.DCPAttr(sign, u.Curvature.CONSTANT, shape)
def init_dcp_attr(self): shape = u.Shape(*intf.size(self.value)) sign = intf.sign(self.value) self._dcp_attr = u.DCPAttr(sign, u.Curvature.CONSTANT, shape)