Function getindex does not accept keyword arguments

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

# 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

# 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

# return the optimal value of the objective function and its minimizers
return getValue(g), getValue(w), w_f-getValue(w), getObjectiveValue(ed)


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?

It looks like you are using a very old version of JuMP, and perhaps also quite an old version of Julia. Can you tell us what version of Julia and JuMP this is?

1 Like