Hi, welcome to Julia. I found the paper you are referencing (note, it might be nice in the future if you can directly provide us a link) here: https://laas.hal.science/hal-02318936v1/document and I implemented the model you cite in section 2 below, which retrieves the answer given in the paper of a cycle time of 9.5.
Because the paper conceptually uses a graph to structure the sets and constraints it considers, I use 2 DataFrames
to store information related to the vertices (T
) and edges (E
). You will note that we store p
, the times associated to each task with the tasks, as well as attach the vector of decision variables t
directly to the dataframe so they can be easily retrieved when we write constraint 1b. We store the H
variables directly with the dataframe that stores the edges as an edge list format.
One further note, you may find more focused help on optimization topics specifically by posting in the optimization specific forum here Optimization (Mathematical) - Julia Programming Language
using JuMP, HiGHS
using DataFrames
T = DataFrame(
i = [:s,1,2,3,4,5,6,7,:f],
p = [0,5,4,5,5,4,3,5,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]
)
model = JuMP.Model(HiGHS.Optimizer)
# cycle time
@variable(model, α)
# dec var: starting time and 1c
T.t = @variable(model, t[1:nrow(T)] ≥ 0)
# 1a
for i in eachrow(T)
@constraint(
model,
α ≥ i.p
)
end
# 1b
for e in eachrow(E)
i = e.src
j = e.tgt
ti = T[findfirst(T.i .== i), :t]
pi = T[findfirst(T.i .== i), :p]
tj = T[findfirst(T.i .== j), :t]
Hij = e.H
@constraint(
model,
tj + α*Hij ≥ ti + pi
)
end
# obj
@objective(
model,
Min,
α
)
optimize!(model)
# look at optimal vals of dec vars
value(α)
value.(T.t)