Hello
I’m trying to make the “for” compile all the variables in the model, but whenever I compile it just returns the variable “c”
Can anybody help me ?
Thank you!!
using JuMP, MathOptInterface, GLPK, GLPKMathProgInterface
ModeloD = Model(solver = GLPKSolverMIP())
a = 4
t = 4
w = 2
A = 1:a
T = 1:t
W = 1:w
NE = [14, 53]
WH = [2489 1447 3513 20914; 11073 5414 1523 16282]
CR = [11, 12]
CO = [50, 51]
var = @variable(ModeloD,c[A],Bin)
var = @variable(ModeloD,r[A,T] <=0)
var = @variable(ModeloD,wo[W,T]>=0)
var = @variable(ModeloD,wr[W,T]<=0)
var = @variable(ModeloD,er[W,T]<=0)
var = @variable(ModeloD,eo[W,T]<=0)
var = @variable(ModeloD,s[A,T]<=0)
var = @variable(ModeloD,x[A,T]<=0)
@objective(ModeloD,Min,sum(CR[w]*(wr[w,t]+wo[w,t])+CO[w]*wo[w,t] for w in W, t in T))
for w = 1:w, t= 1:t
n= @constraint(ModeloD, er[w,t]<= NE[w])
#println(n)
end
for w = 1:w,t= 1:t
h = @constraint(ModeloD,eo[w,t]<=NE[w])
#println(h)
end
for w = 1:w,t= 1:t
ç = @constraint(ModeloD,wr[w,t]+wo[w,t]==WH[w,t])#25
#println(ç)
end
print(ModeloD)
status = solve(ModeloD)
println("Objective value: ", JuMP.getobjectivevalue(ModeloD))
#Compile all model variables
for w = 1:w, a = 1:a, t= 1:t
pp = JuMP.getvalue(var)
println(pp)
end
#The previous "for" should compile all of these variables
println("c = ", JuMP.getvalue(c))
println("r = ", JuMP.getvalue(r))
println("o = ", JuMP.getvalue(o))
println("wo = ", JuMP.getvalue(wo))
println("wr = ", JuMP.getvalue(wr))
println("er = ", JuMP.getvalue(er))
println("eo = ", JuMP.getvalue(eo))
println("s = ", JuMP.getvalue(s))
println("x = ", JuMP.getvalue(x))