Hello, I implemented this function for economic dispatch

function solve_ed(g_max, g_min, c_g, c_w, d, w_f)

#Define the economic dispatch (ED) model

ed=Model()

```
# Define decision variables
@defVar(ed, 0 <= g[i=1:2] <= g_max[i]) # power output of generators
@defVar(ed, 0 <= w <= w_f ) # wind power injection
# Define the objective function
@objective(ed,Min,sum{c_g[i] * g[i],i=1:2}+c_w * w)
# Define the constraint on the maximum and minimum power output of each generator
for i in 1:2
@constraint(ed, g[i] <= g_max[i]) #maximum
@constraint(ed, g[i] >= g_min[i]) #minimum
end
# Define the constraint on the wind power injection
@constraint(ed, w <= w_f)
# Define the power balance constraint
@constraint(ed, sum{g[i], i=1:2} + w == d)
# Solve statement
solve(ed)
# return the optimal value of the objective function and its minimizers
return getValue(g), getValue(w), w_f-getValue(w), getObjectiveValue(ed)
```

end

# Solve the economic dispatch problem

(g_opt,w_opt,ws_opt,obj)=solve_ed(g_max, g_min, c_g, c_w, d, w_f);

and i’m getting this error :

function getindex does not accept keyword arguments

Can anybody help me with this issue?