Dear friends,
I hope this message finds you all well.
I am working on a Wagner family model with positional decision variables for the job shop scheduling problem, aiming to minimize total tardiness. For the toy model presented below, the global optimal solution is 6 time units. However, in my modeling, the tardiness is zero. I am unsure how to correctly compute the completion times and tardiness. Could anybody provide some assistance?
Best regards, Victor
Source code:
P = [2 5; 6 4; 2 3; 5 4; 6 7; 4 3; 6 5] # processing times
O = [1 2; 2 1; 2 1; 1 2; 2 1; 1 2; 1 2] # operations
d = [8 15 18 22 25 30 32] # due dates
V = 10000 # big-M
M = size(P,2)
N = size(P,1)
# Build matrix R[j,l,k]
R = zeros(Int64, N, N, M)
for j in 1:N
for i in 1:M
maq = O[j,i]
R[j,i,maq] = 1
end
end
# Decision variables
@variable(model, x[j in 1:N, h in 1:N, i in 1:M], Bin)
@variable(model, C[h in 1:N, i in 1:M] >=0)
@variable(model, T[j in 1:N] >=0)
# Objective function
@objective(model, Min, sum(T[j] for j in 1:N))
# Constraints
@constraint(model, [j=1:N, k=1:M], sum(x[j,h,k] for h=1:N) == 1)
@constraint(model, [h=1:N, k=1:M], sum(x[j,h,k] for j=1:N) == 1)
@constraint(model, [k=1:M], C[1,k] == sum(P[j,k]*x[j,1,k] for j=1:N))
@constraint(model, [h=2:N,k=1:M],C[h,k] >= C[h-1,k] + sum(P[j,k]*x[j,h,k] for j=1:N))
@constraint(model, [j=1:N,h=1:N,hh=1:N,l=2:M],
sum(R[j,l,k]*C[h,k] for k=1:M) >= sum(R[j,l-1,k]*C[hh,k] for k=1:M) +
sum(R[j,l,k]*P[j,k] for k=1:M) - V*(2 - sum(R[j,l,k]*x[j,h,k] for k=1:M) -
sum(R[j,l-1,k]*x[j,hh,k] for k=1:M)))
@constraint(model, [j in 1:N, k in 1:M], T[j] >= C[j,k] - sum(d[j]*x[j,h,k] for h=1:N))