![]() constr1 = ( expr1 = x ) # Creates a 5 by 7 matrix constrained to have integer valued entries. Variable ( 10, boolean = True ) # expr1 must be boolean valued. # Creates a 10-vector constrained to have boolean valued entries. Variable((n, n), PSD=True) to create an n by n variable constrained to be symmetric and positive semidefinite. Many convex optimization problems involve constraining matrices to be positive or negative semidefinite (e.g., SDPs). Dual variable valuesĪre only recorded for explicit constraints. One downside of using attributes over explicit constraints is that dual variables will not be recorded. The main benefit is that specifying attributes enables more fine-grained DCP analysis.įor example, creating a variable x via x = Variable(nonpos=True) informs the DCP analyzer that x is nonpositive.Ĭreating the variable x via x = Variable() and adding the constraint x >= 0 separately does not provide any information What is the advantage then of specifying attributes in a variable? Many attributes, such as nonnegativity and symmetry, can be easily specified with constraints. Leaves, the operations compute an eigenvalue decomposition. \(O(n)\)), but for symmetric positive semidefinite or negative semidefinite In most cases project andĬhecking that a value satisfies a leaf’s properties are cheap operations (i.e., ![]() That the value satisfies the leaf’s properties. Which projects and assigns the value directly, without additionally checking Projection : 0.0Ī sensible idiom for assigning values to leaves isĮnsuring that the assigned value satisfies the leaf’s properties. The value field of Variables and Parameters can be assigned a value after construction,īut the assigned value must satisfy the object attributes.Ī Euclidean projection onto the set defined by the attributes is given by the Neg ( bool) – Is the variable constrained to be negative? Pos ( bool) – Is the variable constrained to be positive? Sparsity ( list of tuplewith) – Fixed sparsity pattern for the variable. Integer ( bool or list of tuple) – Is the variable integer? The semantics are the same as the boolean argument. Index is a tuple of length exactly equal to the Indices which should be constrained as boolean, where each The entire variable to be boolean, False, or a list of Hermitian ( bool) – Is the variable constrained to be Hermitian?īoolean ( bool or list of tuple) – Is the variable boolean (i.e., 0 or 1)? True, which constrains NSD ( bool) – Is the variable constrained to be symmetric negative semidefinite? PSD ( bool) – Is the variable constrained to be symmetric positive semidefinite? Symmetric ( bool) – Is the variable constrained to be symmetric?ĭiag ( bool) – Is the variable constrained to be diagonal? Imag ( bool) – Is the variable constrained to be imaginary? Nonpos ( bool) – Is the variable constrained to be nonpositive?Ĭomplex ( bool) – Is the variable constrained to be complex-valued? Nonneg ( bool) – Is the variable constrained to be nonnegative? ![]() ![]() Value ( numeric type) – A value to assign to the variable. ![]() Shape ( tuple or int) – The variable dimensions (0D by default). Only one attribute can be active (set to True). Leaf ( shape = None, value = None, nonneg = False, nonpos = False, complex = False, imag = False, symmetric = False, diag = False, PSD = False, NSD = False, hermitian = False, boolean = False, integer = False, sparsity = None, pos = False, neg = False ) ¶Ĭreates a Leaf object (e.g., Variable or Parameter). The full constructor for Leaf (the parent class Similarly, Parameter(nonpos=True) is a scalar parameter constrained to be nonpositive. Variables and parameters can be created with attributes specifying additional properties.įor example, Variable(nonneg=True) is a scalar variable constrained to be nonnegative. The fact that the dual variable is non-zero also tells us that if we tighten x - y >= 1, (i.e., increase the right-hand side), the optimal value of the problem will increase. By complementarity this implies that x - y is 1, which we can see is true. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |