Hi everyone, I am trying to work on the cyclic job shop scheduling problem mentioned in the following paper:https://laas.hal.science/hal-02318936v1/document especially equations from 5a to 5f and the example 2.
Attached the code below:
using JuMP
using CPLEX
using DataFrames
T = DataFrame(
i = [:s,1,2,3,4,5,6,7,:f],
p = [0,5,4,5,5,4,3,5,0],
m = [0,1,1,3,1,2,4,3,0]
)
E = DataFrame(
src = [ :s, 1, 2, 3, 4, :f, :s, 5, 6, 7],
tgt = [ 1, 2, 3, 4, :f, :s, 5, 6, 7, :f],
H = [0,0,0,0,0,2,0,0,0,0 ]
)
M=sum(T.p)
model=JuMP.Model(CPLEX.Optimizer)
@variable(model, V)
T.t = @variable(model, t[1:nrow(T)] >= 0)
#5f
T.u = @variable(model, u[1:nrow(T)] >= 0 )
D = Set{Tuple{Int, Int}}()
for i in 1:nrow(T), j in 1:nrow(T)
m_i = T.m[i]
m_j = T.m[j]
id_i = T.i[i]
id_j = T.i[j]
if i != j && m_i == m_j && m_i != 0
pair = (min(id_i, id_j), max(id_i, id_j))
push!(D, pair)
end
end
print(D)
@variable(model, K[i in 1:7, j in 1:7] >= 0, Int)
for (i, j) in D
idx_i = findfirst(T.i .== i)
idx_j = findfirst(T.i .== j)
pi = T.p[idx_i]
pj = T.p[idx_j]
@constraint(model, T.u[idx_j] ≥ T.u[idx_i] + V * pi - K[i, j])
@constraint(model, T.u[idx_i] ≥ T.u[idx_j] + V * pj - K[j, i])
@constraint(model, K[i,j] + K[j,i] ≥ 1)
end
#5a
for i in eachrow(T)
if i.p > 0
@constraint(model, V <= 1 / i.p)
end
end
#5b
for e in eachrow(E)
i = e.src
j = e.tgt
hij = e.H
ui = T[findfirst(T.i .== i), :u]
uj = T[findfirst(T.i .== j), :u]
pi = T[findfirst(T.i .== i), :p]
@constraint(model, uj + hij >= ui + V*pi)
end
@objective(model, Max, V)
optimize!(model)
println(value(V))
println(value(1/V))
Optimal cycle time should be 13, however, current code is still showing 9.5 so it is probably not taking into consideration the disjunctive constraints ( D and K[i,j))
Thanks in advance !