Skip to main content

Portfolio optimisation with Gurobi Optimizer version 10.0.1 build v10.0.1rc0 (win64)

Answered

Comments

1 comment

  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Manu,

    The issue will be your nested quicksums.  The quicksum expects a generator expression or iterable and returns a LinExpr object, so you are trying to sum linear expressions with the outer quicksum which won't work.

    I suspect you mean to write

    portfolio_volatility = gp.quicksum(covariance_matrix[i, j] * weights[i] * weights[j] for i in assets for j in assets)

    - Riley

    0

Please sign in to leave a comment.