I need to put this objective function in Julia, but I don’t know how to build a sum that has 3 indexes. Can someone help me?
I started doing like this
using JuMP, Cbc
Model1 = Model(with_optimizer(Cbc.Optimizer))
CR = [11; 11; 11; 11; 11]
CO = [50; 50; 50; 50; 50]
#sets
a = 80 #atividades
t = 18 #peírodo de tempo
w = 5 #centro de trabalho
#variable
@variable(Model1,r[1:a,1:t], lower_bound=0)
@variable(Model1,o[1:a,1:t], lower_bound=0)
#objective function
@objective(Model1,Min,sum(CR[w]*(r[a,t]+o[a,t])+CO[w]*o[a,t]))
using JuMP
model = Model()
CR = [11; 11; 11; 11; 11]
CO = [50; 50; 50; 50; 50]
A = 1:80 #atividades
T = 1:18 #peírodo de tempo
W = 1:5 #centro de trabalho
@variable(model, r[A, T] >= 0)
@variable(model, o[A, T] >= 0)
@objective(
model,
Min,
sum(CR[w] * (r[a, t] + o[a, t]) + CO[w] * o[a, t] for w in W, a in A, t in T)
)
using JuMP, Cbc
Model1 = Model(with_optimizer(Cbc.Optimizer))
CR = [11; 11; 11; 11; 11]
CO = [50; 50; 50; 50; 50]
PS = [4951400; 4951400; 14154430]
A = 1:80 #atividades
T = 1:18 #peírodo de tempo
W = 1:5 #centro de trabalho
I = 1:5 #centro de trabalho
@variable(Model1, r[A,T] >= 0)
@variable(Model1, o[A,T] >= 0)
@variable(Model1,wr[W,T] >= 0)
@variable(Model1,wo[W,T] >= 0)
@variable(Model1,d[I] >= 0)
@objective(Model1,Min,sum(CR[w]*(r[a,t]+o[a,t])+CO[w]*o[a,t] for w in W, a in A, t in T)+sun(CR[w]*(wr[w,t]+wo[w,t])+CO[w]*wo[w,t] for w in W, t in T)+sun(PS[i]*(1-d[i]) for i in I))