Skip to main content

How to add conditionals in quicksum for loop?

Answered

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.
  • Michel Soares
    • Gurobi-versary
    • Thought Leader

    Hi Scott,

    You may try doing this instead:

    quicksum(self.b_plus[j, i, t] for j in range(self.noCells) if j!=i) -
                        quicksum(self.b_minus[i, j, t] for j in range(self.noCells) if j!=i)
    0
  • scott zheng
    • Gurobi-versary
    • First Comment
    • First Question

    U r the most clever. That really makes sense.

    Thank you, Michel

     

    0

Post is closed for comments.