Skip to content

Infeasibility diagnosis (IIS) support - #3

Merged
fhamonic merged 27 commits into
fhamonic:mainfrom
mheyman:astra/iis-support
Sep 28, 2026
Merged

fhamonic merged 27 commits into
fhamonic:mainfrom
mheyman:astra/iis-support

Conversation

@mheyman

@mheyman mheyman commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

I know it is only yellow on the roadmap but I had extra astra tokens and a need. I've got this working on Windows (MSVC) and WSL (gcc) and it should work on Mac as well as it does nothing fancy OS-wise. I iterated a bit to get the API and error messages to my liking - I've been C++ coding for many years but I've never done MIP library work.

Summary

Adds portable IIS (irreducible infeasible subsystem) extraction for diagnosing conflicting linear constraints and variable bounds across all MIP++ backends, without requiring native IIS support.

  • Portable core: standalone C++20 deletion and elasticity algorithms, plus an LP/MIP adapter with compile-time policies and cohesive runtime options.
  • Efficiency: batched deletion, candidate ordering, reusable buffers, retained models, and reuse of established infeasibility proofs avoid unnecessary work. Optional Clp, patched SoPlex, and MOSEK certificates seed smaller searches; unsupported features fall back to built-in code automatically.
  • Reliable results: proposed seeds are independently verified. Shared time/solve limits and cancellation preserve proven conflicts without claiming irreducibility prematurely. Structured diagnostics and inexpensive counters explain outcomes.
  • Backend integration: adds certificate accessors, improves MOSEK solve/resource handling, and provides actionable library/license diagnostics with credential redaction.
    Includes a user guide and backend feature matrix, an optional SoPlex C-interface patch, and a local HiGHS/Clp benchmark that verifies correctness independently of timing.

Validation

  • 279 IIS tests and 286 core/CBC tests passed on Windows and under WSL.
  • Public-header and standalone C++20 compilation checks passed.
  • 162 local benchmark strategy cases verified.
    Performance options are opt-in; benefits depend on the model and solver. Native IIS dispatch and explicit basis transfer are not included.

Add Clp and optional SoPlex row rays and MOSEK bound-side certificates. Correct MOSEK solve and resource handling, forward time limits, and provide actionable loading and license errors with credential redaction.
Add Clp and optional SoPlex row rays and MOSEK bound-side certificates. Correct MOSEK solve and resource handling, forward time limits, and provide actionable loading and license errors with credential redaction.
Provide standalone deletion and elasticity algorithms with a linear-model adapter, verified certificate seeds, retained models, candidate ordering, shared budgets, and on-demand reports. Add solver-free and backend integration regressions.

Validation: 279 IIS tests and 286 core/CBC tests passed in WSL; public-header and standalone C++20 checks passed.
Provide standalone deletion and elasticity algorithms with a linear-model adapter, verified certificate seeds, retained models, candidate ordering, shared budgets, and on-demand reports. Add solver-free and backend integration regressions.

Validation: 279 IIS tests and 286 core/CBC tests passed in WSL; public-header and standalone C++20 checks passed.
Compare fallback strategies with independent conflict verification, work counters, strict argument validation, and overwrite-safe private CSV output. Verified 162 strategy cases in local smoke runs.
Compare fallback strategies with independent conflict verification, work counters, strict argument validation, and overwrite-safe private CSV output. Verified 162 strategy cases in local smoke runs.
Introduce conflict extraction with a complete example, explain proof states and configuration, and distinguish generic fallback features from native capabilities, including stock and patched SoPlex.
Introduce conflict extraction with a complete example, explain proof states and configuration, and distinguish generic fallback features from native capabilities, including stock and patched SoPlex.
# Conflicts:
#	.gitignore
#	include/mippp/detail/solver_library.hpp
#	include/mippp/solvers/clp/impl/v1/clp_lp.hpp
#	include/mippp/solvers/cplex/impl/v1/cplex_api.hpp
#	include/mippp/solvers/gurobi/impl/v1/gurobi_api.hpp
#	include/mippp/solvers/mosek/impl/v1/mosek_base.hpp
#	include/mippp/solvers/mosek/impl/v1/mosek_handle_guard.hpp
#	include/mippp/solvers/mosek/impl/v1/mosek_milp.hpp
#	include/mippp/solvers/soplex/impl/v1/soplex_api.hpp
#	include/mippp/solvers/soplex/impl/v1/soplex_lp.hpp
@fhamonic

Copy link
Copy Markdown
Owner

Hello @mheyman and thank you for your PR !

I will need some time to merge it since, like you guessed, the API does not exactly match MIP++ one.
The IIS interface should resemble to a LP basis in the sense that each variable and constraint is associated to one status: outside, inside at LB, inside at UB ...
Thus, I think IIS support will fit well alongside LP basis support in a future v1.1.0 release.
I made Fable 5.1 generate a note and a todo list I will use to merge your IIS PR in v1.1.0. If you have the will and extra tokens you can use it too :)

Thanks for your contribution !

@mheyman

mheyman commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

I'm limited to working on this Friday nights after work (work paid-for tokens plus Saturday morning OpenAI refresh). I'll try to get to it if you don't beat me to it...

Michael Heyman added 4 commits September 25, 2026 20:15
Fall back to cooperative deadlines when SoPlex lacks its optional setter and report runtime capability in IIS diagnostics. Preserve explicit setter failures and tighter native caps. Share MOSEK primal-solution classification and cover stopped-solve evidence and factory verbosity. Update IIS documentation and remove its README roadmap row.

Validation: 105 core and HiGHS tests passed; 93 public headers compiled; standard-include audit passed. Native MOSEK and SoPlex runtime validation remains outstanding.
@mheyman

mheyman commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Astra implemented the items in the TODO with a minor amount of scanning of the diffs by me (I didn't see anything to complain about this time). A lot more tests added, now calling through to HiGHS.

@fhamonic

Copy link
Copy Markdown
Owner

Hi @mheyman, thanks again for this PR and for the time you put into it.

I reviewed it against the design notes and the branch doesn't follow them yet: it keeps the explicit linear_system utility and its model factory instead of a model-level has_iis API, and it calls no native IIS routine.
Rather than asking you for another round, I'll do the rework myself, directly on this branch, and squash-merge it when ready, with you credited as co-author.

A lot of your PR carries over:

  • The deletion filter becomes a public algorithm of the library, with your tests, its limit semantics, the in-place trial updates and the crossing-bounds shortcut.
  • The published HiGHS vectors with the exact checker and the MOSEK fixes carry over too.
  • The SoPlex patch, the elastic prefilter and the certificate seeds won't land now, but they are recorded as deferred
    ideas.
    Going through your PR also surfaced bugs on main, which I'll fix separately.

I'm converting the PR to a draft while I work on it. Please avoid pushing to astra/iis-support in
the meantime, so we don't collide. Nothing is lost: the branch as you submitted it is tagged
archive/pr3-a1a9f11, and the updated design notes will be in misc/design/iis/.

Thanks!

@fhamonic
fhamonic marked this pull request as draft September 27, 2026 21:08
fhamonic and others added 3 commits September 27, 2026 23:22
Remove the files this pull request added that the design of
misc/design/iis replaces, and restore main's version of every file it
modified, per the file map of iis_pr_plan.md. The reshaped IIS support
is rebuilt on top of main in the following commits.

The removed code stays reachable through the tag archive/pr3-a1a9f11,
from which later work packages port the engine, the MOSEK fixes, the
tests and the vectors.
Add the solver-agnostic engine of the deletion filter (iis_todo.md 2.1,
WP4) and the std-only IIS limits, outcomes and reasons it reports with
(2.2, the types part of WP5).

utility/iis_outcome.hpp holds iis_limits {max_solves, time_limit,
stop_token}, defaulted to no limit (Q5 c), and the enum classes
iis_outcome and iis_reason, inconclusive_trial included (N2 b, N19 e).
An absent reason is an empty std::optional (N27 a).

utility/deletion_filter.hpp holds deletion_filter, deletion_verdict,
deletion_oracle and deletion_filter_result (N19 a), which lists the
members in ascending order with the outcome and the reason, and no call
count (N19 f). The time limit becomes one deadline: NaN and negative
durations throw std::invalid_argument, and infinite or huge ones
saturate to no deadline. Before a trial, a stop request beats the
deadline, which beats the solve count. After an inconclusive trial the
reason is inconclusive_trial, or time_limit when the deadline has passed,
and a proof on the last permitted trial is complete. The detail entry
adds the continuation from a known proof, a Clock parameter, and the
dormant batching behind a batch size defaulting to 1 (N3 b), outside
iis_limits and the public entry.

The engine and its tests are ported from a1a9f11 (PR fhamonic#3), without the
statistics, the candidate ordering and phase_budget. test/deletion_filter.cpp
runs in mippp_test on a fake clock. The PR's test/iis.cpp:1009-1022 is
inverted per N2 (b), and the exhaustive monotone test covers the single
pass and the batch sizes through the detail entry.

Co-authored-by: Michael Heyman <mheyman@gmail.com>
Add the types of iis_todo.md 2.3 (WP5): the shape of an IIS answer on
either path, before any model computes one.

model_concepts.hpp gets the iis_status tags next to basis_status:
absent, member, and member_lower, member_upper and member_both deriving
from member, with no possible-member tag (N1 a). lp_iis_status accepts a
variant containing absent and member. lp_iis<I, T> checks both
get_status overloads against it, the outcome, the reason and the member
counts, and model_iis_t<T> deduces what compute_iis() returns. The
single-parameter has_iis<T> means that the model has a native IIS
routine (Q1 b). There is no archetype (N10 a), and no model satisfies
has_iis yet.

detail/handle_status_table.hpp keeps one byte per handle id, sized by
the id bound, where ids past it read as alternative 0. It takes any
variant of tags, so that basis support can reuse it (N16 b). Its set()
rejects a tag the variant does not list, which would otherwise convert
to the base alternative and lose its refinement at run time.
utility/iis_snapshot.hpp holds the public iis_snapshot<Variable,
Constraint, VariableStatus, ConstraintStatus> over two such tables,
returned by value (Q2 a). It requires iis_status::absent as alternative
0 and counts the members once. Its comment says that it describes the
model as it was, so a later handle may reuse a removed id (N8 a); the
IIS suites pin that on a real remove and re-add.

test/iis_snapshot.cpp runs in mippp_test, with a static_assert that the
snapshot satisfies lp_iis and one negative check per lp_iis
requirement. The concepts.md rows come with WP15 and WP17, where the
plan places them.
Add the independent oracle of iis_todo.md 2.4 (WP5), which both IIS
suites will use to validate any answer without trusting the backend
under test.

test/test_suites/iis_oracle.hpp holds the exact Fourier-Motzkin
feasibility check of the pull request, keyed by case-local sides: a case
describes its model as a linear_system, and read_answer keys a snapshot
by the position of each handle in the case's own lists. is_iis applies
the rules: member_lower and member_upper select one side, member_both
selects both and drops each in turn, and a bare member keeps or drops its
variable or row whole. The check refuses more than 6 variables, and
throws on infinite data and on any product or sum that rounds, so the
"small dyadic data" condition is checked instead of assumed. It also
throws on a term naming a variable the case does not have: the pull
request's row.at(column) let column n through into the right-hand side
slot, which then decided a different system.

test/test_suites/iis_vectors.hpp holds the four HiGHS 1.12.0 TestIis.cpp
vectors with their attribution, checked against the v1.12.0 sources,
and test/data/iis/HIGHS-LICENSE.txt is restored. A provenance comment
replaces the README, whose claim that integer witnesses prove
minimality was never checked by the tests.

test/iis_oracle.cpp runs in mippp_test. Its exhaustive subset test now
requires the minimal conflicts to have exactly the listed sizes, and the
other tests pin each rule and each rejection, the sum and product
guards separately.

Ported from a1a9f11 (PR fhamonic#3) by Michael Heyman.

Co-authored-by: Michael Heyman <mheyman@gmail.com>
fhamonic added a commit that referenced this pull request Sep 28, 2026
The final loader error told every platform to add the library's directory
to LD_LIBRARY_PATH, which Windows and macOS never read. It now names PATH
on Windows, DYLD_LIBRARY_PATH on macOS and LD_LIBRARY_PATH elsewhere, taken
from the constant the directory search itself reads.

Every loader failure (explicit path, MIPPP_<KEY>_LIBRARY, directory search)
also states the precedence and quotes the current MIPPP_<KEY>_LIBRARY value
with escaping, so an empty value or a stray space shows. The search
variable's value is never printed.

diagnostic_value and its tests are ported, trimmed, from the IIS pull
request (#3), without its version-warning and license help (N18 a).

Co-authored-by: Michael Heyman <mheyman@gmail.com>
@fhamonic
fhamonic marked this pull request as ready for review September 28, 2026 04:24
@fhamonic
fhamonic merged commit e322ef1 into fhamonic:main Sep 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants