Hello to all.

I’m trying to use Optimization.jl to solve a problem, but a I dont know how to define the problem in a way the package needs it. In my problem I have an Array of a Struct with several parameters and for each element of the Array I need the proper index of a field that is a StepRange type.

I’ll write here a smaller version of my struct and equation. Any help or hint is really appreciated, because I dont know even how to start it. Thanks in advance!!!

```
#Struct with problem values - needed an Array of it
struct L
a::Float64
b::Float64
s::StepRange{Time,Minute}
t1::Time
t2::Time
t3::Time
L() = new()
function L(a,b,t1,t2,t3)
s = t1:t2:t3
new(a,b,s,t1,t2,t3)
end
end
#GOAL is find all values of x that minimize this function
function Eval_EQ_SUM(H::Array{L,1},x::Array{Int64,1})
if length(H) ≠ length(x)
@error "H and x should have the same length"
return nothing
end
S = Vector{Float64}(undef,length(H))
for i in eachindex(H)
S[i] = H[i].a*EQ(H[i].s[x[i]]), H[i].b)
end
return sum(S)
end
#auxiliar function for better reading
function EQ(t::time, b::Float64)
if t < Time(2)
F = 2*b
elseif t > Time(4) && t < Time(12)
F = sqrt(b)
else
F = b^3
end
return F
end
```