I have a large problem; even model creation will take a long time, and I was thinking of using a thread-safe approach to speed up the process. Here is the code:

```
using Random
using JuMP
using HiGHS
using ThreadSafeDicts
struct Limit
mn::Float64
mx::Float64
end
I = 1:24
J = [randstring(12) for i in 1:60]
K = ["sample_"*string(i) for i in 1:100_000]
L = Dict()
X = ThreadSafeDict()
Y = Dict()
limits = Dict()
for i in I, j in J
limits[i, j] = Limit(rand(), rand())
L[i,j] = sort([rand(), rand(), rand()])
Threads.@threads for k in K
X[i, j, k] = rand()
end
end
model = Model(HiGHS.Optimizer)
BO = Dict()
ABO = Dict()
for i in I, j in J
mn = limits[i, j].mn
mx = limits[i, j].mx
m = max(mn, mx)
l = L[i,j]
BO[i, j, 1] = @variable(model, lower_bound = mn, upper_bound = 0.0)
BO[i, j, 4] = @variable(model, lower_bound = 0.0, upper_bound = mx)
for seg in 2:3
BO[i, j, seg] = @variable(model, lower_bound = mn, upper_bound = mx)
end
ABO[i, j] = @variable(model, lower_bound = 0.0, upper_bound = mx)
for k in K
x = X[i, j, k]
idx = 3
while idx ≥ 1 && l[idx] > x
idx -= 1
end
Y[i, j, k] = BO[i, j, idx+1]
end
end
```

Overall performance is unacceptable compared to AMPL; even if I modified the code to use Channel, that would not help (`julia> Threads.nthreads() 30`

)

```
using Random
using JuMP
using HiGHS
using ThreadSafeDicts
struct Limit
mn::Float64
mx::Float64
end
I = 1:24
J = [randstring(12) for i in 1:60]
K = ["sample_"*string(i) for i in 1:100_000]
L = Dict()
X = ThreadSafeDict()
Y = Dict()
limits = Dict()
for i in I, j in J
limits[i, j] = Limit(rand(), rand())
L[i,j] = sort([rand(), rand(), rand()])
Threads.@threads for k in K
X[i, j, k] = rand()
end
end
model = Model(HiGHS.Optimizer)
BO = Dict()
ABO = Dict()
for i in I, j in J
mn = limits[i, j].mn
mx = limits[i, j].mx
m = max(mn, mx)
l = L[i,j]
BO[i, j, 1] = @variable(model, lower_bound = mn, upper_bound = 0.0)
BO[i, j, 4] = @variable(model, lower_bound = 0.0, upper_bound = mx)
for seg in 2:3
BO[i, j, seg] = @variable(model, lower_bound = mn, upper_bound = mx)
end
ABO[i, j] = @variable(model, lower_bound = 0.0, upper_bound = mx)
for k in K
x = X[i, j, k]
idx = 3
while idx ≥ 1 && l[idx] > x
idx -= 1
end
Y[i, j, k] = BO[i, j, idx+1]
end
end
```

I would appreciate any suggestions.