メインコンテンツへスキップ

How to add conditionals in quicksum for loop?

回答済み

コメント

3件のコメント

  • 正式なコメント
    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

投稿コメントは受け付けていません。