I'm looking for a solution to a linear programming problem and I need to define the following constraints:
gji = 1 if guest j is seated at table i, 0 otherwise
gki = 1 if guest k is seated at table i, 0 otherwise
pjik = gij * gik = 1 if guest j AND guest k are seated at table i, 0 otherwise
I wrote the first two costrains (using the Pulp library), but I don't know how to represent the multiplication of gji*gki
My code:
Gji = LpVariable.matrix("Gji",(range(0,number_guest),range(0,number_table)),lowBound=0, upBound=1, cat='binary')
Gki = LpVariable.matrix("Gki",(range(0,number_guest),range(0,number_table)),lowBound=0, upBound=1, cat='binary')
for row in range (0,number_guest):
prob += lpSum(Gji[row])<=1
prob += lpSum(Gji[row])>=1
for columns in range (0,number_table):
prob += lpSum(np.matrix(Gji).T[columns].tolist()) <= a
How can I write the costrain for Pjki?