-1

I want to assign weight to ten different industries to construct a portfolio. But there is a constrain that at least 80% of the industry should come from an index, called ZZ800 index. The ind weights of ZZ800 index are known, for example, the A industry compose of 15% of ZZ800 index, which means that if I assign 50% of my portfolio to A industry, the maximum weight come from ZZ800 of A industry would only be 15%.

How can I write this constraint?

ind_weights_800 = [0.1, 0.4, 0.2, 0.05, 0.25]
x_weight = cp.Variable(5)

constraints = []
constraints.append(cp.sum(x_weight) == 1)

# this is the constraint I don't know how to write
ind_sum = 0
for i in range(10):
    ind_sum  = ind_sum  + min(x_weight[i], ind_weights_800[i])
constraints.append(ind_sum >= 0.8)
NotImplementedError: Strict inequalities are not allowed.
nan
  • 401
  • 4
  • 13

1 Answers1

-1

I have figured out:

ind_weights_800 = [0.1, 0.4, 0.2, 0.05, 0.25]
x_weight = cp.Variable(5)

constraints = []
constraints.append(cp.sum(x_weight) == 1)

# this is the constraint I don't know how to write
ind_sum = 0
for i in range(10):
    ind_sum  = ind_sum  + cp.minimum(x_weight[i], ind_weights_800[i])
constraints.append(ind_sum >= 0.8)

cp.minimum is the key.

nan
  • 401
  • 4
  • 13