MODEL:
 ! Assembly line balancing model;
   ! Assign tasks to stations in an assembly line so
     precedence constraints are satisfied, and 
     each station is assigned approximately the
     same amount of work.;
SETS:
   ! There is a set of tasks, each with a duration T;
   TASK: T;

   ! Predecessor,successor pairings must be
     observed(e.g. A must be done before B, B 
     before C, etc.);
   PRED( TASK, TASK);

   ! There are a specified number of workstations;
   STATION;

   TXS( TASK, STATION): X;
   !  X(I,K) = 1
     if task I is assigned to station K;
 ENDSETS
DATA: ! Data taken from Chase and Aquilano, POM; ! There is an estimated time required for each task..; TASK= A B C D E F G H I J K; T = 45 11 9 50 15 12 12 12 12 8 9; PRED= A,B B,C C,F C,G F,J G,J J,K D,E E,H E,I H,J I,J ; ! There are 4 stations; STATION= 1..4; ENDDATA ! The model; ! *Warning* may be slow for more than 15 tasks; ! For each task, there must be one assigned station; @FOR( TASK( I): @SUM( STATION( K): X( I, K)) = 1); ! Precedence constraints; ! For each precedence pair, the predecessor task I cannot be assigned to a later station than its successor task J; @FOR( PRED( I, J): @SUM( STATION( K): K * X( J, K) - K * X( I, K)) >= 0); ! For each station, the total time for the assigned tasks must be less than the maximum cycle time, CYCTIME; @FOR( STATION( K): @SUM( TXS( I, K): T( I) * X( I, K)) <= CYCTIME); ! Minimize the maximum cycle time; MIN = CYCTIME; ! The X(I,J) assignment variables are binary integers; @FOR( TXS: @BIN( X)); END