Skip to main content

Quicksum in constraint leads to too many nonzeros

Ongoing

Comments

3 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.
  • Eli Towle
    • Gurobi Staff

    The degradation at timestep 2 is the sum of degradation at timestep 0 and 1, etc.

    Your constraints set the degradation equal to the sum of the weighted statuses at previous timesteps. Do you mean the degradation at timestep 2 is the sum of the weighted statuses (not degradations) at previous timesteps?

    If I understand your problem correctly, an equivalent, sparser formulation would set the degradation at time \( t \) equal to the degradation at time \( t - 1 \) plus \( c \) times the status at time \( t - 1\). I don't know exactly how you define your Python variables, but something like this should work:

    model.addConstr(deg[0] == 0)
    for t in T[1:]:
    model.addConstr(deg[t] == deg[t - 1] + c * z[t - 1])

     

    0
  • Pieter Degeling
    • Gurobi-versary
    • First Question
    • First Comment

    Hi Eli,

    Thanks so much for your quick response, it is really appreciated. I think this works perfectly!

    In this context, the coefficient c translates the on-off status to a degradation penalty. In my actual model, I defined various operations that lead to different degradation mechanisms. One of these is a penalty (degradation) for being on, described by c*z.
    The sum of degradation due to the various mechanisms leads to a degradation status for each timestep.
    In this example, the term 'sum of weighted statuses' is equal to the term 'total degradation'.

    Thanks again.

    Best regards,
    Pieter

    0

Post is closed for comments.