Skip to content

Commit

Permalink
Add infeasibility certificate back (#89)
Browse files Browse the repository at this point in the history
* Add infeasibility certificate back

* Exclude failing tests

* Enable working tests

* Fix format

* Exclude tests failing in CI

* Exclude failing tests

* Exclude failing tests

* Exclude failing tests
  • Loading branch information
blegat committed Mar 23, 2023
1 parent 9abd61b commit 79cf7de
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
26 changes: 22 additions & 4 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ function MOI.get(model::Optimizer, attr::MOI.PrimalStatus)
return MOI.FEASIBLE_POINT
elseif model.status == 1
return MOI.INFEASIBLE_POINT
# elseif model.status == 2
# return MOI.INFEASIBILITY_CERTIFICATE
elseif model.status == 2
return MOI.INFEASIBILITY_CERTIFICATE
elseif model.status == 3
return MOI.NEARLY_FEASIBLE_POINT
else
Expand All @@ -490,8 +490,8 @@ function MOI.get(model::Optimizer, attr::MOI.DualStatus)
return MOI.NO_SOLUTION
elseif model.status == 0
return MOI.FEASIBLE_POINT
# elseif model.status == 1
# return MOI.INFEASIBILITY_CERTIFICATE
elseif model.status == 1
return MOI.INFEASIBILITY_CERTIFICATE
elseif model.status == 2
return MOI.INFEASIBLE_POINT
elseif model.status == 3
Expand All @@ -505,11 +505,29 @@ MOI.get(model::Optimizer, ::MOI.SolveTimeSec) = model.solve_time

function MOI.get(model::Optimizer, attr::MOI.ObjectiveValue)
MOI.check_result_index_bounds(model, attr)
if MOI.get(model, MOI.PrimalStatus(attr.result_index)) ==
MOI.INFEASIBILITY_CERTIFICATE
throw(
MOI.GetAttributeNotAllowed(
attr,
"CSDP does not support getting the objective value corresponding to a certificate of dual infeasibility. Use a `MOI.Utilities.CachingOptimizer` layer so that it gets automatically computed from the value of the variables.",
),
)
end
return model.objective_sign * model.pobj
end

function MOI.get(model::Optimizer, attr::MOI.DualObjectiveValue)
MOI.check_result_index_bounds(model, attr)
if MOI.get(model, MOI.DualStatus(attr.result_index)) ==
MOI.INFEASIBILITY_CERTIFICATE
throw(
MOI.GetAttributeNotAllowed(
attr,
"CSDP does not support getting the dual objective value corresponding to a certificate of primal infeasibility. Use a `MOI.Utilities.CachingOptimizer` layer so that it gets automatically computed from the dual value of the constraints.",
),
)
end
return model.objective_sign * model.dobj
end

Expand Down
22 changes: 10 additions & 12 deletions test/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,33 +78,31 @@ function test_runtests()
# Empty constraint not supported:
"test_conic_PositiveSemidefiniteConeTriangle",
"test_linear_VectorAffineFunction_empty_row",
# Unable to bridge RotatedSecondOrderCone to PSD because the ...
# Unable to bridge RotatedSecondOrderCone to PSD because the the dimension is too small: got 2, expected >= 3
"test_conic_SecondOrderCone_INFEASIBLE",
"test_constraint_PrimalStart_DualStart_SecondOrderCone",
# TODO(odow): unknown test failures.
"test_conic_RotatedSecondOrderCone_VectorOfVariables",
"test_conic_SecondOrderCone_negative_initial_bound",
"test_variable_solve_with_lowerbound",
"test_modification_delete_variables_in_a_batch",
# Working locally but getting into numerical issues in CI
"test_quadratic_constraint_basic",
"test_quadratic_constraint_minimize",
"test_conic_SecondOrderCone_negative_post_bound",
"test_conic_SecondOrderCone_negative_post_bound_2",
"test_conic_SecondOrderCone_negative_post_bound_3",
"test_conic_SecondOrderCone_nonnegative_initial_bound",
"test_conic_SecondOrderCone_no_initial_bound",
"test_linear_integration",
"test_modification_coef_scalar_objective",
"test_modification_const_scalar_objective",
"test_modification_delete_variables_in_a_batch",
"test_modification_delete_variable_with_single_variable_obj",
"test_modification_set_singlevariable_lessthan",
"test_modification_transform_singlevariable_lessthan",
"test_objective_FEASIBILITY_SENSE_clears_objective",
"test_objective_ObjectiveFunction_blank",
"test_objective_ObjectiveFunction_constant",
"test_objective_ObjectiveFunction_duplicate_terms",
"test_objective_ObjectiveFunction_VariableIndex",
"test_quadratic_constraint_basic",
"test_quadratic_constraint_minimize",
"test_solve_result_index",
"test_modification_set_singlevariable_lessthan",
"test_objective_ObjectiveFunction_VariableIndex",
"test_conic_SecondOrderCone_nonnegative_initial_bound",
"test_solve_TerminationStatus_DUAL_INFEASIBLE",
"test_variable_solve_with_lowerbound",
],
)
return
Expand Down

2 comments on commit 79cf7de

@blegat
Copy link
Member Author

@blegat blegat commented on 79cf7de Mar 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: "Tag with name v1.1.0 already exists and points to a different commit"

Please sign in to comment.