def __init__(self, args, constr_id=None): # TODO cast constants. # self.args = [cvxtypes.expression().cast_to_const(arg) for arg in args] self.args = args if constr_id is None: self.constr_id = lu.get_id() else: self.constr_id = constr_id self.dual_variables = [cvxtypes.variable()(arg.shape) for arg in args] super(Constraint, self).__init__()
def __init__(self, lh_exp, rh_exp): self.args = [lh_exp, rh_exp] self._expr = lh_exp - rh_exp self.dual_variable = cvxtypes.variable()(*self._expr.size) super(LeqConstraint, self).__init__()
def _construct_dual_variables(self, args): self.dual_variables = [cvxtypes.variable()(arg.shape) for arg in args]