# CPLEX OPL - Problem of arrangements and increments

I have a problem involving work shifts and assembly stations.

1. Work shifts have the subscript = T
2. Workstations have the subscript = J

My decision variable is X[t][j]

For each turn (T) I am trying to use the value of the array below and substract a generic value like (2) through each assembly station (J).

For example: AM[t][j] matrix For each shift [t] X[t][j] = M1[t][j] + X[t][j] – 2.

Example first shift (time), and each work station (j).

• X1 = 100 + 0 – 2 = 98
• X = 0 + 98 – 2 = 96
• X = 0 + 96 – 2 = 94

Example second shift (time), and each work station (j).

• X2 = 0 + 200 – 2 = 198
• X = 0 + 198 – 2 = 196
• X = 0 + 196 - 2 = 194

This is my cplex code.

subject to {
forall (t in T, j in J)
Constrain2: X1[t][j] == sum (j in J) M1[t][j] - 2; }

However, I get the following results

• X1 = 98
• X = 98
• X = 98

It is not decreasing, it just puts the same value of the previous box.

Could you advise me how to subtract the value through each workstation for each time.

• Welcome to ORSE. First, please elaborate more on the problem specifications. For example, what does $M$ mean? What is the role of the $AM$ matrix and its differences from $M$? In the mentioned expression index $j$ is coming in the outer-loop while again it comes in the RHS and in the inner-loop! Aug 2, 2022 at 7:30
• Also for more cleaning, I suggest using index $s$ for each shift and index $w$ for each workstation. :) Aug 2, 2022 at 7:36