Skip to content

Add ConflictCount and conflict_index to ConstraintConflictStatus #2775

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,16 @@ struct ConflictStatus <: AbstractModelAttribute end

attribute_value_type(::ConflictStatus) = ConflictStatusCode

"""
ConflictCount()

An [`AbstractModelAttribute`](@ref) for the number of conflicts found by the
solver in the most recent call to [`compute_conflict!`](@ref).
"""
struct ConflictCount <: AbstractModelAttribute end

attribute_value_type(::ConflictCount) = Int

"""
ListOfVariableAttributesSet()

Expand Down Expand Up @@ -2677,8 +2687,24 @@ end

A constraint attribute to query the [`ConflictParticipationStatusCode`](@ref)
indicating whether the constraint participates in the conflict.

## `conflict_index`

The optimizer may return multiple conflicts. See [`ConflictCount`](@ref)
for querying the number of conflicts found.

## Implementation

Optimizers should implement the following methods:
```julia
MOI.get(::Optimizer, ::MOI.ConstraintConflictStatus, ::MOI.ConstraintIndex)::T
```
They should not implement [`set`](@ref) or [`supports`](@ref).
"""
struct ConstraintConflictStatus <: AbstractConstraintAttribute end
struct ConstraintConflictStatus <: AbstractConstraintAttribute
conflict_index::Int
ConstraintConflictStatus(conflict_index = 1) = new(conflict_index)
end

function attribute_value_type(::ConstraintConflictStatus)
return ConflictParticipationStatusCode
Expand Down
Loading