MATLAB: How to use disjoint constraints with intlinprog? Two variables can’t have the same solution (x1-x2 != 0)

boundsconstraintsintegerintlinproglinearlogical?MATLABnonlinearorprogramming

Hi,
I have a a number of people which have to go into rooms in pairs. If two people know each other they cannot go into the same room (and some cost function to maximize). I was trying to use intlinprog and having the solution vector be the people, where the value of the vector at each position is the room each person goes to.
Eg:
x1 (Joe)
x2 (Mary)
There are 3 rooms. So the bounds are:
1 <= x1,x2 <= 3
Joe knows Mary so my constraint would be:
x1-x2 != 0
Since they have to go to different rooms. How do I add this constraint to intlinprog? Any light shed on this ways to solve this problem would be greatly appreciated.

Best Answer

x_ij decision variable ; x_ij = 1 if person i enters room j, x_ij=0 else.
For Mary and Joe and three rooms this means that the three inequalities
x_Mary,1 + x_Joe,1 <= 1
x_Mary,2 + x_Joe,2 <= 1
x_Mary,3 + x_Joe,3 <= 1
must hold.
Best wishes
Torsten.