# Using Dualization

I would like to pass this model to Dual but I still haven’t got it. Could someone help me?
Thank you!

``````using JuMP, Cbc, Dualization

FabricaBrinquedos = Model(dual_optimizer(Cbc.Optimizer))#When I try to compile using dual the model has an error
#FabricaBrinquedos = Model(with_optimizer(Cbc.Optimizer))

L = [12 ;60]
T = [0.25 0.1 0.1; 0.5 0.75 0.4]
D = [36; 22; 15]

@variable(FabricaBrinquedos, X[i=1:2] >= 0)
@objective(FabricaBrinquedos,Max,sum(L[i]*X[i] for i=1:2))

for j in 1:3
@constraint(FabricaBrinquedos, sum(X[i]*T[i,j] for i=1:2) <= D[j])
end

print(FabricaBrinquedos)
optimize!(FabricaBrinquedos) #Status model
println("Valor objetivo:  ", JuMP.objective_value(FabricaBrinquedos))

status = FabricaBrinquedos# solves the model
println("valor:    ",  JuMP.value(X[i]) #

dual_model = dualize(FabricaBrinquedos, Cbc.Optimizer)
``````

If you only want the dual you don`t need to use any solver

``````using JuMP, Dualization

FabricaBrinquedos = Model()

L = [12 ;60]
T = [0.25 0.1 0.1; 0.5 0.75 0.4]
D = [36; 22; 15]

@variable(FabricaBrinquedos, X[i=1:2] >= 0)
@objective(FabricaBrinquedos,Max, sum(L[i]*X[i] for i=1:2))
@constraint(FabricaBrinquedos, con[j in 1:3], sum(X[i]*T[i,j] for i=1:2) <= D[j])

print(FabricaBrinquedos)
dual_model = dualize(FabricaBrinquedos, dual_names = DualNames("", ""))
print(dual_model)
``````

This code got me this

``````julia> print(dual_model)
Min -22 con[2]_1 - 15 con[3]_1 - 36 con[1]_1
Subject to
X[1] : 0.25 con[1]_1 + 0.1 con[2]_1 + 0.1 con[3]_1 + _1 = -12.0
X[2] : 0.5 con[1]_1 + 0.75 con[2]_1 + 0.4 con[3]_1 + _1 = -60.0
_1 ≥ 0.0
_1 ≥ 0.0
con[1]_1 ≤ 0.0
con[2]_1 ≤ 0.0
con[3]_1 ≤ 0.0
``````
3 Likes