Thursday, December 5, 2013

Example: a Lingo model for optimal sample matching

MODEL:

SETS:
  cDNA /1..6/;
  tDNA /1..6/;
  cDye /1..6/;
  tDye /1..6/;
  PAIR1(cDNA,tDNA) | &2 #GT# &1: WEIGHT1, WEIGHT2, MATCH1;
ENDSETS

DATA:

  WEIGHT1 =
31 26 36 8 46
9 1 23 11
12 10 2
12 10
34;

  WEIGHT2 =
0.7 0.6 1.0 1.5 1.7
0.9 0.5 1.0 0.2
0.4 1.1 0.3
0.2 0.4
1.6 ;

ENDDATA

[OBJ] MIN = @SUM( PAIR1(I,J): WEIGHT1(I,J)*MATCH1(I,J) + WEIGHT2(I,J)*MATCH1(I,J)*10 );


@FOR( tDNA( I):
 @SUM( PAIR1( J, K) | J #EQ# I #OR# K #EQ# I:
  MATCH1(J, K) ) = 1
);

@FOR( PAIR1( I, J): @BIN( MATCH1( I, J)));

@FOR( PAIR1(I,J):
  @ABS(control_DNA-test_DNA)<=50.0;
  @ABS(control_Dye-test_Dye)<=20.0;
);

END

No comments:

Post a Comment