Help with Normal Distribution

Because when I compile my model I get the following error message:

MethodError: no method matching Normal(; μ=0.16, σ=0.05)
using JuMP, Gurobi, Random, Distributions
Modelmathematical = Model(Gurobi.Optimizer)

a = 280
w = 5
t = 18
#Parameters
Q = rand(280,5)
A = 1:a 
W = 1:w
T = 1:t 
FC = 3
RD = rand(280)
RHE = [150,150,150,150,150]
OHE = [25,25,25,25,25]
NE = [14,56,25,67,122]
WH = rand(18,5)

#Variable
@variable(Modelmathematical ,s[A,T]>=0)
@variable(Modelmathematical ,x[A,T]>=0)

Random.seed!(123) # Setting the seed
violationcases_ok = 0
violationcases = 0

for ctd = 1:10000
    n = zeros(Float64,a)
    for a in A
        d = Normal(μ = 0.16, σ = 0.05)
        n[a]=rand(d,1)
    end

   for t in T, w in W
        charge = value.(sum(Q[a,w]*x[a,t]+n[a]*[x][a,t]+s[a,t] for a in A if RD[a]<=FC))
        capacity = RHE[w]+OHE[w]*NE[w]-WH[w,t]
            if charge <= capacity
                violationcases_ok = violationcases_ok+1
            else
                violationcases = violationcases+1
            end
    end

    percentage = violationcases/(violationcases_ok+violationcases)
    return percentage
end

It seems Normal does not accept keyword arguments. You have to just do Normal(0.16, 0.05) instead of using keyword arguments.

3 Likes