다음 파일을 실행하려고합니다. 나는 한 장씩 업로드를 시도했다. 이것이 일부 구성 요소가 주석 처리 된 이유입니다. 어떤 구성 요소를 활성화했는지에 관계없이 제약 조건 부분에 대해이 오류가 표시됩니다.Julia LoadError : MethodError : addconstraint (:: Int64, :: Jump.GenericAffExpr {Float64, JuMP.Variable}})와 일치하는 메서드가 없습니다.
using JuMP
using Gurobi
pset = ["packaging1", "packaging2"]
size_pset = 2
fset = ["filling1", "filling2"]
size_fset = 2
mset = ["manufacturing1","manufacturing2"]
size_mset = 2
timeset = [1,2,3,4,5,6,7,8,9,10]
size_timeset = 10
fgset = ["product1","product2"]
size_fgset = 2
bulkset = ["bulk1","bulk2"]
size_bulkset = size_fgset
apiset = ["api1","api2"]
size_apiset = 2
scenarioset = ["s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","s12","s13","s14","s15","s16"]
size_scenarioset = 16
CFF = 0.7
CFP = 0.5
SR = 2
RW = 2
KGS = 2
ESTputP= 100
ESTputF= 100
ESTputM= 100
m = Model(solver=GurobiSolver())
@variable(m, ThputM[1:size_mset, 1:size_timeset, 1:size_apiset, 1:size_scenarioset] >= 0)
@variable(m, InThputM[1:size_fset, 1:size_timeset, 1:size_apiset, 1:size_bulkset, 1:size_scenarioset] >= 0)
@variable(m, XP_p[1:size_pset, 1:size_timeset, 1:size_fgset] >= 0)
@variable(m, XP_n[1:size_pset, 1:size_timeset, 1:size_fgset] >= 0)
@variable(m, XF_p[1:size_fset, 1:size_timeset, 1:size_bulkset] >= 0)
@variable(m, XF_n[1:size_fset, 1:size_timeset, 1:size_bulkset] >= 0)
@variable(m, XM_p[1:size_mset, 1:size_timeset, 1:size_apiset] >= 0)
@variable(m, XM_n[1:size_mset, 1:size_timeset, 1:size_apiset] >= 0)
#objective
@objective(m, Min, sum(XM_p[m,t,a]+XM_n[m,t,a] for m=1:size_mset for t=1:size_timeset for a=1:size_apiset)+
sum(XF_p[f,t,b]+XF_n[f,t,b] for f=1:size_fset for t=1:size_timeset for b=1:size_bulkset)+
sum(XP_p[p,t,f]+XP_n[p,t,f] for p=1:size_pset for t=1:size_timeset for f=1:size_fgset))
# Constraints:
#@constraint(m, thput_relateM[m=1:size_mset, t=1:size_timeset, a=1:size_apiset, s=1:size_scenarioset],ThputM[m,t,a,s]==SR*RW*KGS)
@constraint(m, thput_relate_M_Bulk_API[m=1:size_mset, t=1:size_timeset, a=1:size_apiset, s=1:size_scenarioset],
sum(InThputM[m,t,a,b,s] for b=1:size_bulkset)==ThputM[m,t,a,s])
writeLP(m, 'Sifomodel.lp'; genericnames=false)
status = solve(m)
println("Solve status: ", status)
println("Objective value: ", getobjectivevalue(m))
특히 "제약 조건 업로드"에 대한 공명은 무엇입니까?