sum of absolute values constraint in semi definite programming

风流意气都作罢 提交于 2019-12-03 08:26:06

Your constraint is equivalent to the following eight constraints:

 x1 + x2 + x3 <= 10
 x1 + x2 - x3 <= 10
 x1 - x2 + x3 <= 10
 x1 - x2 - x3 <= 10
-x1 + x2 + x3 <= 10
-x1 + x2 - x3 <= 10
-x1 - x2 + x3 <= 10
-x1 - x2 - x3 <= 10

I haven't used cvxopt, so I don't know if there is an easier way to handle your constraint with that package. For example, your constraint is equivalent to |x|_1 <= 10, where |x|_1 is the 1-norm of x.

As an alternative to Warren's solution involving 2^n constraints for a sum of n absolute value terms, one could introduce n extra variables y1, y2, ..., yn and write the following n pairs of inequalites

-y1 <= x1 <= y1
-y2 <= x2 <= y2
...
-yn <= xn <= yn

which, combined with a single equality

y1+y2+...+yn = 10

are equivalent to the original constraint

abs(x1) + abs(x2) + ... + abs(xn) <= 10

Total cost: n new variables and 2n+1 linear constraints.

I have also seen the variation:

x_1 = x1_plus - x1_minus

x2 = x2_plus - x2_minus xN = xN_plus - xN_minus and x1_plus, x1_minus>=0 x2_plus, x2_minus>=0

xN_plus, xN_minus>=0

and

x1_plus+x1_minus + x2_plus+x2_minus + ... + xN_plus+xN_minus <=10

Cost: an additional 2N variables, N equality constraints + 2N+1 inequality constraints. Much more than @fanfan's but with other benefits.

xk_plus and x_k_minus can be used in an objective function to penalize either the absolute value of xk or to give different penalties for the positive and negative parts of xk. These slack variables are sometimes used to express transaction costs, e.g.,

max theta'mu - lambda/2 theta'Sigma theta -TC(buy+sell)

theta = theta0+buy-sell

buy,sell>=0

and allow for an asymmetry in TC if required.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!