Skip to content

Commit f65912f

Browse files
authored
Merge pull request #1056 from dourouc05/iis
Interface from IIS.
2 parents d891ec7 + 34eccbb commit f65912f

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

docs/src/apireference.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ The value of the attribute is of type `TerminationStatusCode`.
169169
TerminationStatusCode
170170
```
171171

172+
### Conflict Status
173+
174+
The `ConflictStatus` attribute indicates why the conflict finder stopped executing.
175+
The value of the attribute is of type `ConflictStatusCode`.
176+
177+
```@docs
178+
compute_conflict!
179+
ConflictStatus
180+
ConflictStatusCode
181+
ConstraintConflictStatus
182+
ConflictParticipationStatusCode
183+
```
184+
172185
### Result Status
173186

174187
The `PrimalStatus` and `DualStatus` attributes indicate how to interpret the result returned by the solver.

src/MathOptInterface.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ Start the solution procedure.
3232
"""
3333
function optimize! end
3434

35+
"""
36+
compute_conflict!(optimizer::AbstractOptimizer)
37+
38+
Computes a minimal subset of constraints such that the model with the other
39+
constraint removed is still infeasible.
40+
41+
Some solvers call a set of conflicting constraints an Irreducible Inconsistent
42+
Subsystem (IIS).
43+
44+
See also [`ConflictStatus`](@ref) and [`ConstraintConflictStatus`](@ref).
45+
46+
### Note
47+
48+
If the model is modified after a call to `compute_conflict!`, the implementor
49+
is not obliged to purge the conflict. Any calls to the above attributes may
50+
return values for the original conflict without a warning. Similarly, when
51+
modifying the model, the conflict can be discarded.
52+
"""
53+
function compute_conflict! end
54+
3555
"""
3656
write_to_file(model::ModelLike, filename::String)
3757

src/attributes.jl

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,35 @@ A model attribute for the number of results available.
910910
"""
911911
struct ResultCount <: AbstractModelAttribute end
912912

913+
"""
914+
ConflictStatusCode
915+
916+
An Enum of possible values for the `ConflictStatus` attribute. This attribute
917+
is meant to explain the reason why the conflict finder stopped executing in the
918+
most recent call to [`compute_conflict!`](@ref).
919+
920+
Possible values are:
921+
* `COMPUTE_CONFLICT_NOT_CALLED`: the function [`compute_conflict!`](@ref) has
922+
not yet been called
923+
* `NO_CONFLICT_EXISTS`: there is no conflict because the problem is feasible
924+
* `NO_CONFLICT_FOUND`: the solver could not find a conflict
925+
* `CONFLICT_FOUND`: at least one conflict could be found
926+
"""
927+
@enum ConflictStatusCode begin
928+
COMPUTE_CONFLICT_NOT_CALLED
929+
NO_CONFLICT_EXISTS
930+
NO_CONFLICT_FOUND
931+
CONFLICT_FOUND
932+
end
933+
934+
"""
935+
ConflictStatus()
936+
937+
A model attribute for the [`ConflictStatusCode`](@ref) explaining why the conflict
938+
refiner stopped when computing the conflict.
939+
"""
940+
struct ConflictStatus <: AbstractModelAttribute end
941+
913942
## Variable attributes
914943

915944
"""
@@ -1117,6 +1146,30 @@ function throw_set_error_fallback(::ModelLike, ::ConstraintSet,
11171146
type $(typeof(set)). Use `transform` instead."""))
11181147
end
11191148

1149+
"""
1150+
ConflictParticipationStatusCode
1151+
1152+
An Enum of possible values for the [`ConstraintConflictStatus`](@ref) attribute.
1153+
This attribute is meant to indicate whether a given constraint participates
1154+
or not in the last computed conflict.
1155+
1156+
Possible values are:
1157+
* `NOT_IN_CONFLICT`: the constraint does not participate in the conflict
1158+
* `IN_CONFLICT`: the constraint participates in the conflict
1159+
* `MAYBE_IN_CONFLICT`: the constraint may participate in the conflict,
1160+
the solver was not able to prove that the constraint can be excluded from
1161+
the conflict
1162+
"""
1163+
@enum(ConflictParticipationStatusCode, NOT_IN_CONFLICT, IN_CONFLICT, MAYBE_IN_CONFLICT)
1164+
1165+
"""
1166+
ConstraintConflictStatus()
1167+
1168+
A constraint attribute indicating whether the constraint participates
1169+
in the conflict. Its type is [`ConflictParticipationStatusCode`](@ref).
1170+
"""
1171+
struct ConstraintConflictStatus <: AbstractConstraintAttribute end
1172+
11201173
## Termination status
11211174
"""
11221175
TerminationStatus()
@@ -1318,6 +1371,8 @@ function is_set_by_optimize(::Union{ObjectiveValue,
13181371
NodeCount,
13191372
RawSolver,
13201373
ResultCount,
1374+
ConflictStatus,
1375+
ConstraintConflictStatus,
13211376
TerminationStatus,
13221377
RawStatusString,
13231378
PrimalStatus,

0 commit comments

Comments
 (0)