I am trying to model an optimization problem in IBM ILOG CPLEX. Basically it is the classic assignment problem. I have to Sets A = {a_1,...,a_n} und B = {b_1,...b_m} and n < m. Every element of A has to be assigned to one element of B. To each element of B, at maximum one element of A can be assigned. From n < m, it follows that some elements of B remain free (nothing is assigned to them).
Modelling this is extremely easy. However, I have another constraint and I can't find a way to model that. The constraint is: all elements from B to which there is an assignment, have to be connected. The assignment has to be consecutive / sequential / however you want to call it.
Example: A = {a_1,a_2,a_3}, B = {b_1,b_2,b_3_b_4,b_5}
If some element from A is assigned to b_1, then b_2 and b_3 have assignments too.
If some element from A is assigned to b_3, b_4 and b_5 have assignments OR b_2 and b_4 have assignments OR b_1 and and b_2 have assignments.
In other words: If x means something is assigned to an element from B, these configurations are allowed: (xxx - -), (- xxx -), (- - xxx).
I use a decision variable x_ij with i in A and j in B. x_ij = 1 iff i is assigned to j.
Anyone got an idea how to model this restriction?
