How to define Integer variable in LinearFractional.
for thebelwo code getting the error
MathOptInterface.UnsupportedConstraint{MathOptInterface.SingleVariable,MathOptInterface.Integer}: MathOptInterface.SingleVariable
-in-MathOptInterface.Integer
constraint is not supported by the model.
using JuMP
using Clp,Juniper,Ipopt,Cbc
mod = LinearFractionalModel(with_optimizer(Clp.Optimizer))
T =2
B = 10
C = 2
Csm= [1 2 ]
C_st = [1 2 ]
Dtp = [50 50
300 300]
P = 2
NSAFETY = 1
Cap_tb = [66 27
94 64
94 91
106 118
118 128
130 134
136 138
136 138
136 138
136 138]
@variable(mod,0<=X_tbp[t in 1:T,b in 1:B, p in 1:P],Int)
@variable(mod,0<=Y_tbc[t in 1:T,b in 1:B, c in 1:C],Int)
ET = @variable(mod, [c in 1:C,b in 1:B], base_name="ET", lower_bound=0.0)
@constraint(mod,con1[t in 1:T, b in 1:B],sum(X_tbp[t,b,p] for p in 1:P)<=Cap_tb[b,t])
@constraint(mod,con2[t in 1:T, p in 1:P],sum(X_tbp[t,b,p] for b in 1:B)<=Dtp[t,p])
@constraint(mod,con3[t in 1:T,b in 1:B],sum(Y_tbc[t,b,c] for c in 1:C)<=Cap_tb[b,t])
@constraint(mod,con444[c in 1:C-1,b in 1:B],ET[c+1,b]>= ET[c,b]+sum(Y_tbc[t,b,c] for t in 1:T)+sum(Y_tbc[t,b,c+1] for t in 1:T))
@constraint(mod,con333[c in 1:C,b in 1:B],ET[c,b]>=sum(Y_tbc[t,b,c] for t in 1:T))
for t in 1:T
for b in 1:B
@constraint(mod, sum(Y_tbc[t,b,c] for c in 1:C)==sum(X_tbp[t,b,p] for p in 1:P))
end
end
Tmov = @variable(mod, base_name="Tmov", lower_bound=0.0)
Ttmov = @variable(mod, base_name="Ttmov", lower_bound=0.0)
#@variable(mod,0<=Tmov)
#@variable(mod,0<=Ttmov)
C_s =[1 2] # number of containers moved per move
#for i in 1:1
#xpr4=0
for c in 1:C
#xpr4 += sum(Y_tbc[t,b,c] for t in 1:T,b in 1:B)*(C_s/C_st[c])
@constraint(mod, Tmov>=sum(Y_tbc[t,b,c] for t in 1:T for b in 1:B)*(C_s[c]/C_st[c]))
end
@constraint(mod,Ttmov== sum(Y_tbc[t,b,c]*(C_s[c]/C_st[c]) for t in 1:T,b in 1:B, c in 1:C))
#@expression(mod,denom,Tmov)
#end
numer= @expression(mod,Ttmov+1)
denom= @expression(mod,Tmov+1)
set_objective(mod, JuMP.MOI.MAX_SENSE, numer, denom)
optimize!(mod)
termination_status(mod)