`dualize()` cannot take `ignore_objective` argument

When using Dualization.jl to dualize an LP, I used the ignore_objective argument to turn off the objective. However, I received the following error:

ERROR: MethodError: no method matching dualize(::Model, ::Nothing; dual_names=DualNames("dual_", "dual_", "", ""), ignore_objective=true, consider_constrained_variables=false)
Closest candidates are:
  dualize(::Model, ::Any; dual_names) at /Users/chengguo/.julia/packages/Dualization/cjSlF/src/dualize.jl:197 got unsupported keyword arguments "ignore_objective", "consider_constrained_variables"
  dualize(::Model) at /Users/chengguo/.julia/packages/Dualization/cjSlF/src/dualize.jl:197 got unsupported keyword arguments "dual_names", "ignore_objective", "consider_constrained_variables"
Stacktrace:
 [1] kwerr(::NamedTuple{(:dual_names, :ignore_objective, :consider_constrained_variables), Tuple{DualNames, Bool, Bool}}, ::Function, ::Model, ::Nothing)
   @ Base ./error.jl:157
 [2] top-level scope
   @ ~/Dropbox/codes_sync/expansion_mechanism/codes/jl_code/try_dualize.jl:25```

Here is my code:

using JuMP, Dualization

m = Model()

@variable(m, x >= 0)
@variable(m, y >= 0)

@constraints(m, begin
    con1, 3 * x + 2 * y >= 9
    con2, 2 * x + y >= 6
    ub, x <= 2
end)

@objective(m, Min, 8 * x + 10 * y)

dual_m = Dualization.dualize(
        m;
        dual_names = DualNames("dual_", "dual_"),
        ignore_objective = true,
        consider_constrained_variables = false,
        )

I saw the same usage in the source code of BilevelJuMP.jl, so I am confused why I got the error. Any insights?

Version Info:
Julia: 1.6.3
JuMP: 1.11.0
Dualization.jl: 0.5.7

1 Like

Hi, @g001234 thanks for posting the question. I added the post as an issue on the Dualization repo. I should only be able to investigate it next week but maybe some other maintainers can help you in the meantime.

Thank you for the fast reply, @guilhermebodin ! Would you think any version of Dualization.jl does not have this issue? I am thinking about pinning it to an older version as a quick fix.

Hi Cheng, let me take a look.

See Fix dualizing JuMP model with kwargs by odow · Pull Request #159 · jump-dev/Dualization.jl · GitHub

Thank you so much for fixing this, Oscar! I had thought it’s something on my end so I didn’t open an issue. The update makes sense : )