The Solution
The entire formulation for our matching example and parts of its solution appear below.
MODEL:
SETS:
ANALYSTS;
PAIRS( ANALYSTS, ANALYSTS) | &2 #GT# &1:
RATING, MATCH;
ENDSETS
DATA:
ANALYSTS = 1..8;
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
Global optimal solution found.
Objective value: 6.000000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
MATCH( 1, 2) 0.0000000 9.000000
MATCH( 1, 3) 0.0000000 3.000000
MATCH( 1, 4) 0.0000000 4.000000
MATCH( 1, 5) 0.0000000 2.000000
MATCH( 1, 6) 1.000000 1.000000
MATCH( 1, 7) 0.0000000 5.000000
MATCH( 1, 8) 0.0000000 6.000000
MATCH( 2, 3) 0.0000000 1.000000
MATCH( 2, 4) 0.0000000 7.000000
MATCH( 2, 5) 0.0000000 3.000000
MATCH( 2, 6) 0.0000000 5.000000
MATCH( 2, 7) 1.000000 2.000000
MATCH( 2, 8) 0.0000000 1.000000
MATCH( 3, 4) 0.0000000 4.000000
MATCH( 3, 5) 0.0000000 4.000000
MATCH( 3, 6) 0.0000000 2.000000
MATCH( 3, 7) 0.0000000 9.000000
MATCH( 3, 8) 1.000000 2.000000
MATCH( 4, 5) 1.000000 1.000000
MATCH( 4, 6) 0.0000000 5.000000
MATCH( 4, 7) 0.0000000 5.000000
MATCH( 4, 8) 0.0000000 2.000000
MATCH( 5, 6) 0.0000000 8.000000
MATCH( 5, 7) 0.0000000 7.000000
MATCH( 5, 8) 0.0000000 6.000000
MATCH( 6, 7) 0.0000000 2.000000
MATCH( 6, 8) 0.0000000 3.000000
MATCH( 7, 8) 0.0000000 4.000000
Solution to MATCHD
From the objective value, we know the total sum of the incompatibility ratings for the optimal pairings is 6. Scanning the Value column for 1s, we find the optimal pairings: (1,6), (2,7), (3,8), and (4,5).