[JuMP] Sum function with additional constraints on indexes


#1

My Objective Function is the following:

@setObjective(m,Min, sum{costs[i,j]*x[i,j,k,t],i= nodes, j = nodes, k = vehicles, t = periods})

AND I would like to make “i < j” in the sum expression above! It is like adding a constraint on the indexes only for this expression. Is this possible? How is the syntax?

Thank you very much.


#2

That is ancient syntax.
Read the docs:
http://www.juliaopt.org/JuMP.jl/0.17/quickstart.html

You can (now) use an if clause inside sum.


#3

I worked with Julia only once for a college project. It’s been a long time. I had no idea the syntax had changed. Thank you very much. You helped a lot.