Write constraint
回答済みPlease visit the following (LINK) to have access the google colab file.
At this cell (LINK), I am trying to write the following constraint
### Constraints
- **Maximum investment**
x_1 + x_2 = a
I have tried the following code
m.addConstr(sum(StockWeight[i] for i in range(0,2)) == MaxInvest, name = 'MaxInvest')but the output is wrong.
0
-
Could you elaborate what exactly is wrong with this constraint?
The code you wrote adds the constraint
MaxInvest: StockWeight[0] + StockWeight[1] = MaxInvest
0 -
I solved it Jaromił Najman, thanks for the support.
0
サインインしてコメントを残してください。
コメント
2件のコメント