sum_k_largest

picos.sum_k_largest(exp, k)

returns a Sum_k_Largest_Exp object representing the sum of the k largest elements of an affine expression exp. This can be used to enter constraints of the form \sum_{i=1}^k x_{i}^{\downarrow} \leq t. This kind of constraints is reformulated internally as a set of linear inequalities.

Example:

>>> import picos as pic
>>> prob = pic.Problem()
>>> x = prob.add_variable('x',3)
>>> t = prob.add_variable('t',1)
>>> pic.sum_k_largest(x,2) < 1
<Sum of Largest Elements Constraint: sum_2_largest(x) ≤ 1>
>>> pic.sum_k_largest(x,1) < t
<Sum of Largest Elements Constraint: max(x) ≤ t>