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

How to add conditionals in quicksum for loop?

回答済み

コメント

2件のコメント

  • 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

サインインしてコメントを残してください。