How do I write @variable(z=x[1]+x[2])?

Swapping the order of statements

using JuMP

m = Model()
@variable(m, Z);
@variable(m, F[1:14]>=0);
#I have only included a portion of the constriant 
@constraint(m,8*F[1]+1.5*F[2]+10*F[3] <= Z);
@objective(m, Min, Z);
print(m)

seems to help.One tip: if you want to know what the macros (@variable etc.) are doing you can use @macroexpand.

2 Likes