I would need to implement constraint on sum of absolute values.
(E.g.: natural constraint for "Leverage" in portfolio optimization problem, while allowing negative weights)
Naive solution would be:
max_leverage = 2
model.st(sum(abs(x)) <= max_leverage)
But this will ends up with error:
"TypeError: 'Convex' object is not iterable"
Is there reccomended way how to approach this problem?
I would need to implement constraint on sum of absolute values. (E.g.: natural constraint for "Leverage" in portfolio optimization problem, while allowing negative weights)
Naive solution would be: max_leverage = 2 model.st(sum(abs(x)) <= max_leverage)
But this will ends up with error: "TypeError: 'Convex' object is not iterable"
Is there reccomended way how to approach this problem?