Skip to content

Interface from IIS. #1056

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

Merged
merged 18 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions docs/src/apireference.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,19 @@ The value of the attribute is of type `TerminationStatusCode`.
TerminationStatusCode
```

### Conflict Status

The `ConflictStatus` attribute indicates why the conflict finder stopped executing.
The value of the attribute is of type `ConflictStatusCode`.

```@docs
compute_conflict!
ConflictStatus
ConflictStatusCode
ConstraintConflictStatus
ConflictParticipationStatusCode
```

### Result Status

The `PrimalStatus` and `DualStatus` attributes indicate how to interpret the result returned by the solver.
Expand Down
20 changes: 20 additions & 0 deletions src/MathOptInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ Start the solution procedure.
"""
function optimize! end

"""
compute_conflict!(optimizer::AbstractOptimizer)

Computes a minimal subset of constraints such that the model with the other
constraint removed is still infeasible.

Some solvers call a set of conflicting constraints an Irreducible Inconsistent
Subsystem (IIS).

See also [`ConflictStatus`](@ref) and [`ConstraintConflictStatus`](@ref).

### Note

If the model is modified after a call to `compute_conflict!`, the implementor
is not obliged to purge the conflict. Any calls to the above attributes may
return values for the original conflict without a warning. Similarly, when
modifying the model, the conflict can be discarded.
"""
function compute_conflict! end

"""
write_to_file(model::ModelLike, filename::String)

Expand Down
55 changes: 55 additions & 0 deletions src/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,35 @@ A model attribute for the number of results available.
"""
struct ResultCount <: AbstractModelAttribute end

"""
ConflictStatusCode

An Enum of possible values for the `ConflictStatus` attribute. This attribute
is meant to explain the reason why the conflict finder stopped executing in the
most recent call to [`compute_conflict!`](@ref).

Possible values are:
* `COMPUTE_CONFLICT_NOT_CALLED`: the function [`compute_conflict!`](@ref) has
not yet been called
* `NO_CONFLICT_EXISTS`: there is no conflict because the problem is feasible
* `NO_CONFLICT_FOUND`: the solver could not find a conflict
* `CONFLICT_FOUND`: at least one conflict could be found
"""
@enum ConflictStatusCode begin
COMPUTE_CONFLICT_NOT_CALLED
NO_CONFLICT_EXISTS
NO_CONFLICT_FOUND
CONFLICT_FOUND
end

"""
ConflictStatus()

A model attribute for the [`ConflictStatusCode`](@ref) explaining why the conflict
refiner stopped when computing the conflict.
"""
struct ConflictStatus <: AbstractModelAttribute end

## Variable attributes

"""
Expand Down Expand Up @@ -1117,6 +1146,30 @@ function throw_set_error_fallback(::ModelLike, ::ConstraintSet,
type $(typeof(set)). Use `transform` instead."""))
end

"""
ConflictParticipationStatusCode

An Enum of possible values for the [`ConstraintConflictStatus`](@ref) attribute.
This attribute is meant to indicate whether a given constraint participates
or not in the last computed conflict.

Possible values are:
* `NOT_IN_CONFLICT`: the constraint does not participate in the conflict
* `IN_CONFLICT`: the constraint participates in the conflict
* `MAYBE_IN_CONFLICT`: the constraint may participate in the conflict,
the solver was not able to prove that the constraint can be excluded from
the conflict
"""
@enum(ConflictParticipationStatusCode, NOT_IN_CONFLICT, IN_CONFLICT, MAYBE_IN_CONFLICT)

"""
ConstraintConflictStatus()

A constraint attribute indicating whether the constraint participates
in the conflict. Its type is [`ConflictParticipationStatusCode`](@ref).
"""
struct ConstraintConflictStatus <: AbstractConstraintAttribute end

## Termination status
"""
TerminationStatus()
Expand Down Expand Up @@ -1318,6 +1371,8 @@ function is_set_by_optimize(::Union{ObjectiveValue,
NodeCount,
RawSolver,
ResultCount,
ConflictStatus,
ConstraintConflictStatus,
TerminationStatus,
RawStatusString,
PrimalStatus,
Expand Down