Proper declaration of constraint

Constraint below says for each k, k=1, k=22, k=43 (since k is < length(TIME)=63)
PLEVEL[1]<=…
PLEVEL[22]<=…
PLEVEL[43]<=…
PLEVEL1 is binary.

s1[k in 1:interval:length(TIME) if k<length(TIME)],
PLEVEL[k]-limit<=M*PLEVEL1 #M - big number

I need your advice whether the the part within is properly defined.
Thanks!

Sorry definition of a constraint in what? JuMP.jl? If so, this is the wrong category, it should be in Mathematical Optimization, I can change the category (it is a “regular” user power), if this is the case.

1 Like

Yes, this is for JuMP. I’ve changed the category. @mamo, please remember my suggestion to format your code correctly and provide a minimal working example.

1 Like

Yes, thanks Henrique, my mistake.

Will do. Thanks odow.

I think you want the functionality described at the end of this section.

Something like that (untested):

@constraint(model, [k=1:interval:(length(TIME)-1)], PLEVEL[k] - limit <= M * PLEVEL1)
1 Like