I am trying to use the package Dualization.jl, to reformulate a primal problem and solving the dual model separately. However, after solving I am not able to access the solution (the variable values) as they don’t seem to be attached to the JuMP model generated by the function dualize
.
model = Model()
@variables(model, begin
x1>=0
x2
x3
x4<=0
end)
@constraint(model, con1, x1 - 2*x2 + 3*x3 + 4*x4 <= 3)
@constraint(model, con2, x2 + 3*x3 <= -5)
@constraint(model, con3, 2*x1 - 3*x2 - 7*x3 - 4*x4 == -2)
@objective(model, Min, 3*x1 + 2*x2 - 3*x3 + 4*x4)
dual_model = dualize(model; dual_names = DualNames("y_", "y_"))
set_optimizer(dual_model, Gurobi.Optimizer)
optimize!(dual_model)
sol = (value.(y_con1_1), value.(y_con2_1), value.(y_con3_1))
println(sol)
On running this script, the dual_model
is solved correctly, but then on trying to access the solution it throws an error: UndefVarError: y_con1_1 not defined
.
I am probably missing out on something trivial here. Can someone point it out? Thank you.