Hello!!
Whenever I try to use getvalue the following error appears to me:
MethodError: no method matches getvalue (:: ConstraintRef {Model, JuMP.GenericRangeConstraint {JuMP.GenericAffExpr {Float64, Variable}}})
Could someone explain to me how this error came about?
Is there another method for printing the results of the decision variables?
Thanks
using JuMP, MathOptInterface, GLPK, GLPKMathProgInterface
ModeloD = Model(solver = GLPKSolverMIP())
a = 4
t = 4
w = 2
i = 2
A = 1:a
T = 1:t
W = 1:w
I = i:i
Q = [8780 0; 0 11310; 1000 0; 0 2000]
RD = [1, 2, 3, 1]
DL = [2, 4, 4, 3]
RHE = [150, 151]
OHE = [25, 26]
NE = [14, 53]
WH = [2489 1447 3513 20914; 11073 5414 1523 16282]
CR = [11, 12]
CO = [50, 51]
WA = [1, 2, 1, 2]
@variable(ModeloD,x[A,T]<=0)
@variable(ModeloD,s[A,T]<=0)
@variable(ModeloD,er[W,T]<=0)
@variable(ModeloD,r[A,T] <=0)
@variable(ModeloD,wr[W,T]<=0)
@variable(ModeloD,o[A,T]<=0)
@variable(ModeloD,c[A],Bin)
@objective(ModeloD,Min,sum(CR[WA[a]]*(r[a,t]+o[a,t])+CO[WA[a]]*o[a,t] for a in A, t in T))
for w = 1:w,t=1:t
m = @constraint(ModeloD,sum(r[a,t]+wr[w,t] for a in A)==RHE[w]*er[w,t])
println(m)
end
for a = 1:a, w = 1:w,t= 1:t
if Q[a,w]>0
p1 = @constraint(ModeloD,sum(s[a,t] for t = RD[a]:DL[a])==Q[a,w]*(1-c[a]))
#println(p1)
end
end
for w = 1:w,t= 1:t
r = @constraint(ModeloD,sum(Q[a,w]*x[a,t] for a in A)-sum(s[a,t] for a in A)<=(RHE[w]+OHE[w])*NE[w]-WH[w,t])
#println(r)
end
print(ModeloD)
println("r = ", JuMP.getvalue(r))