2
votes

I'm new to Julia and JuMP, a library I'm going to use.

Trying to define the following constraint, after having defined the variables, I receive an error:

for r = 1:11
    for d = 1:7
        for s = 1:12
            @constraint(model, mod(ris_day_ora[r,d,s],0.5)==0)
        end
    end
end

Here the error:

ERROR: LoadError: MethodError: no method matching mod(::VariableRef, ::Float64)

Could you please help me?

Thanks a lot in advance!

1

1 Answers

0
votes

You cannot have a mod in a JuMP constraint.

You need to reformulate the model and there are many ways to do that. In your case the easiest thing would be to declare ris_day_ora as Int and then divide it everywhere by 2.

@variable(model, ris_day_ora[1:11, 1:7, 1:12] >=0, Int)

And now everywhere in the code use ris_day_ora[r,d,s]/2.0 instead of ris_day_ora[r,d,s].