Skip to content

Commit

Permalink
Remove dual solution warning from optimize!
Browse files Browse the repository at this point in the history
  • Loading branch information
gvidigal-psr committed Jul 1, 2024
1 parent 0d806e7 commit 18698a0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,18 @@ function MOI.get(
return MOI.get(model.optimizer, attr, optimizer_ci)
end

function MOI.get(
model::Optimizer,
attr::MOI.ConstraintDual,
c::MOI.ConstraintIndex{MOI.VariableIndex,MOI.Parameter{T}},
) where {T}
if !model.evaluate_duals
error()
end
optimizer_ci = get(model.constraint_outer_to_inner, c, c)
return MOI.get(model.optimizer, attr, optimizer_ci)
end

#
# Special Attributes
#
Expand Down Expand Up @@ -1355,10 +1367,7 @@ function MOI.optimize!(model::Optimizer)
_set_quadratic_product_in_obj!(model)
end
MOI.optimize!(model.optimizer)
if MOI.get(model, MOI.DualStatus()) == MOI.NO_SOLUTION &&
model.evaluate_duals
@warn "Dual solution not available, ignoring `evaluate_duals`"
elseif model.evaluate_duals
if model.evaluate_duals
_compute_dual_of_parameters!(model)
end
return
Expand Down

0 comments on commit 18698a0

Please sign in to comment.