The Constraints
We have the following three types of constraints in this model:
1. | each task must be assigned to one station, |
2. | precedence relations must be observed amongst the tasks, and |
3. | computation of the line cycle time variable, CYCTIME. |
The following expression sums up the assignment variable for each task and sets the sum to equal 1. This forces each task to be assigned to a single station.
! For each task, there must be one assigned
station;
@FOR( TASK( I): @SUM( STATION( K): X( I, K)) = 1);
We use the following expression to enforce the precedence relationships amongst the tasks:
! 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);
Suppose task I is a predecessor to task J. If I were incorrectly assigned to a workstation later than J, the sum of the terms K * X( I, K) would exceed the sum of the terms K * X( J, K) and the constraint would be violated. Thus, this constraint effectively enforces the predecessor relations.
We restrain the cycle time using the following constraints:
! 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);
The quantity:
@SUM( TXS( I, K): T( I) * X( I, K))
in this constraint computes the cycle time for station K. We use the @FOR statement to make the CYCTIME variable greater than or equal to the cycle times for all the workstations. If we couple this with the fact that we are minimizing CYCTIME in the objective, CYCTIME will be "squeezed" into exactly equaling the maximum of the cycle times for each of the workstations.
By "squeezing" CYCTIME to the correct value, we avoid using the @MAX function. Had the @MAX function been used, LINGO would have had to resort to its nonlinear solver to handle the piecewise linear @MAX. Avoiding nonlinear models whenever possible is a critical modeling practice.