! Advertising insert assignment problem.
   We have a set of advertising inserts that
we want to send to list of potential customers.
Each customer is to get exactly NGET inserts,
at most one of each type.
   For each insert type i, we have AVAIL(i)
inserts available to be sent to customers.
   There is a value, e.g., expected sales
revenue, VAL(c,i), of sending customer c
insert i.  We want to allocate ad inserts
to customers so as to maximize value.
 In a typical real problem, there may
be around 1,000,000 customers, 100 insert
types, and each customer is to receive 
about 12 inserts.  The challenge is to
solve such a model with around
100,000,000 decision variables, and
 1,000,100 constraints;
! Keywords: 
   Advertising, Allocation, Insert Allocation, Mailing,
   Marketing, Media Selection;
SETS:
  AD: AVAIL;
  CUST;
  CXA( CUST, AD): VAL, Y;
ENDSETS
DATA: ! The insert types; AD= I1 I2 I3 I4 I5 I6; ! Number available of each; AVAIL = 6 9 7 9 7 6; ! The customers; CUST = C1..C10; ! Number ad inserts each is to receive; NGET = 4; ! The value of giving customer c (row), one copy of insert i (col); VAL = 1 3 6 4 2 7 2 1 0 2 4 3 7 3 4 4 2 7 8 1 0 2 4 3 1 3 6 3 5 7 9 1 0 2 4 3 1 3 5 0 2 5 4 1 3 2 4 3 2 3 6 4 2 0 8 1 2 2 4 9; ENDDATA ! Decision variables: Y(c,i) = 1 if customer c gets insert i, = 0 otherwise; ! Maximize value of inserts assigned to customers; MAX = TOTVAL; TOTVAL= @SUM( CXA(c,i): VAL(c,i)*Y(c,i)); ! For each insert type i, cannot assign more of an insert than are available; @FOR( AD(i): @SUM( CXA(c,i): Y(c,i)) <= AVAIL(i); ); ! Each customer must get her allotment; @FOR( CUST(c): @SUM( CXA(c,i): Y(c,i)) = NGET; ); ! At most one per customer of each insert; @FOR( CXA(c,i): @BIN(Y(c,i)); ); DATA: ! Display results in table form; @TEXT() = 'Total value delivered=', TOTVAL; @TEXT() = ' Table of who(row) gets what(col).'; @TEXT() = @TABLE(Y); ENDDATA