Matching Model    Model: MATCHD

Pair matching problems require a number of objects be grouped into pairs subject to some criteria. The objective may be to minimize cost, to group like objects, etc. As an example, the following matching model pairs workers into offices to minimize total incompatibilities between paired individuals. A detailed discussion of this model may be found in Using Sets.

MODEL:

 

SETS:

  ANALYSTS / 1..8/;

  PAIRS( ANALYSTS, ANALYSTS) | &2 #GT# &1:

   RATING, MATCH;

ENDSETS

 

DATA:

  RATING =

     9  3  4  2  1  5  6

        1  7  3  5  2  1

           4  4  2  9  2

              1  5  5  2

                 8  7  6

                    2  3

                       4;

ENDDATA

 

MIN = @SUM( PAIRS( I, J):

RATING( I, J) * MATCH( I, J));

 

@FOR( ANALYSTS( I):

@SUM( PAIRS( J, K) | J #EQ# I #OR# K #EQ# I:

 MATCH( J, K)) = 1

);

 

@FOR( PAIRS( I, J): @BIN( MATCH( I, J)));

 

END

Model: MATCHD