Help on model a problem/function to use with Optimization.jl

Here are some link for the papers I’m trying to reproduce the base model.

image

The image above also have the main equation I’m trying to work with. As you could see its a bit more complicated system than the one I wrote in the initial post. But I’m sure if I could model the function Eval_EQ_SUM, I could model the complete system.

I found a way to eliminate the inner Sum, but to do that I should call a function with some if/else logic. Dont see how could i put it in a single statemente like the one in examples (2x + 3y)

I’ll do some tests now with JuMP.jl. Its a way more clear in its tutorial “who goes where”.

In/with JuMP.jl, can I do something like this ???

function f(a)
    if a > 10
        return 2*a
    elseif a < 4
        return 3*a
    else
        return a^2
    end
end

@objective(model, Min, f(x) + 20y)