Skip to main content

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

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Riley Clement
    • 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

Post is closed for comments.