'Model exists relation in a linear program (PuLP)

I'm trying to implement an exists relation as part of an LP using PuLP. I'd like to check whether there is a j for which x_ij + x_kj = 2.

for i in range(g):
  for k in range(g):
    prob += lp.lpSum((x[(i, j)] + x[(k, j)] == 2) for j in range(t)) == y[(i, k)]

The variables are all binary. I tried to model it using a sum of boolean expressions, which should result in 1 if y_ik is 1 and 0 otherwise. However, this approach doesn't work.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source