Help implementing a weird model notation
回答済みHey guys, I recently came across this model notation and I am having a hard time understanding and implementing it in Gurobi.
[\\sum_{i,t:i.GG=1\wedge i.O=b}^{}x_{jit}\ge5 \forall j,b\]
How do I "understand" the sum? Do the equations have to be fulfilled for both inidzes or only for t?
My try looks like this:
for j in J:
for b in B:
model.addConstr(gp.quicksum(x[j,i,t] for t in T if GG[i] == 1 and O[i] == b for i in I if GG[I] == 1 and O[I] == b) <= 5)
0
-
Hi Lorenz,
The logical operator \(\wedge\) represents conjunction, i.e., the and condition. So, the expression \(\sum_{i,t:i.GG=1\wedge i.O=b}\) means summing over i,t such that i.CG=1 and i.O=b. There are no checks for the index t in this condition.
The constraint \[\sum_{i,t:i.GG=1\wedge i.O=b}x_{jit} \geq 5 \quad \forall j,b \] can be modelled as
m.addConstrs((gp.quicksum(x[j,i,t] for i in I for t in T if GG[i] == 1 and O[i] == b) >= 5 for j in J for b in B), name="test")
Best regards,
Simran0
サインインしてコメントを残してください。
コメント
1件のコメント