Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when querying dual objective value for an unbounded model with at least one unbounded variable #254

Closed
mtanneau opened this issue Dec 3, 2024 · 2 comments · Fixed by #255

Comments

@mtanneau
Copy link

mtanneau commented Dec 3, 2024

I have running into an AssertError when querying dual_objective_value for an unbounded model with at least one unbounded variable.
The code blow was executed on Julia 1.11.1, JuMP 1.23.5 and HiGHS v1.12.1

julia> using JuMP, HiGHS

julia> model = Model(HiGHS.Optimizer);

julia> @variable(model, x);  # unbounded variable

julia> @objective(model, Min, x);

julia> optimize!(model)  # unbounded, as expected
Running HiGHS 1.8.1 (git hash: 4a7f24ac6): Copyright (c) 2024 HiGHS under MIT licence terms
Coefficient ranges:
  Cost   [1e+00, 1e+00]
  Bound  [0e+00, 0e+00]
Solving LP without presolve, or with basis, or unconstrained
Solving an unconstrained LP with 1 columns
Model status        : Unbounded
Objective value     :  0.0000000000e+00
Relative P-D gap    :  1.0000000000e+00
HiGHS run time      :          0.00

julia> dual_objective_value(model)
ERROR: AssertionError: isfinite(u)
Stacktrace:
  [1] _active_bound
    @ ~/.julia/packages/HiGHS/P0qbU/src/MOI_wrapper.jl:2275 [inlined]
  [2] get(model::HiGHS.Optimizer, attr::MathOptInterface.DualObjectiveValue)
    @ HiGHS ~/.julia/packages/HiGHS/P0qbU/src/MOI_wrapper.jl:2228
  [3] get
    @ ~/.julia/packages/MathOptInterface/gLl4d/src/Bridges/bridge_optimizer.jl:889 [inlined]
  [4] _get_model_attribute(model::MathOptInterface.Utilities.CachingOptimizer{…}, attr::MathOptInterface.DualObjectiveValue)
    @ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/gLl4d/src/Utilities/cachingoptimizer.jl:847
  [5] get
    @ ~/.julia/packages/MathOptInterface/gLl4d/src/Utilities/cachingoptimizer.jl:900 [inlined]
  [6] _moi_get_result(model::MathOptInterface.Utilities.CachingOptimizer{…}, args::MathOptInterface.DualObjectiveValue)
    @ JuMP ~/.julia/packages/JuMP/i68GU/src/optimizer_interface.jl:1053
  [7] get(model::Model, attr::MathOptInterface.DualObjectiveValue)
    @ JuMP ~/.julia/packages/JuMP/i68GU/src/optimizer_interface.jl:1073
  [8] dual_objective_value(model::Model; result::Int64)
    @ JuMP ~/.julia/packages/JuMP/i68GU/src/objective.jl:167
  [9] dual_objective_value(model::Model)
    @ JuMP ~/.julia/packages/JuMP/i68GU/src/objective.jl:163
 [10] top-level scope
    @ REPL[6]:1
Some type information was truncated. Use `show(err)` to see complete types.

The stacktrace points to this line:

@assert isfinite(u)

which I believe is only triggered when hitting an unbounded variable

@odow
Copy link
Member

odow commented Dec 4, 2024

Oops. This is embarrassing...

@odow
Copy link
Member

odow commented Dec 4, 2024

Actually this is less embarrassing than it seems. The issue is that your model is primal unbounded, and you've asked for the dual objective value (which is meaningless).

We can fix the bug, but it will return the dual objective at the dual infeasible point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants