feat: extend IIS calculation to support Xpress solver#473
feat: extend IIS calculation to support Xpress solver#473FabianHofmann merged 4 commits intomasterfrom
Conversation
- Add support for Xpress solver IIS computation alongside existing Gurobi support - Implement _compute_infeasibilities_xpress() method using xpress.iisall() API - Update compute_infeasibilities() to auto-detect solver type and route appropriately - Extend test coverage to include both Gurobi and Xpress in infeasibility tests - Add comprehensive test suite in test_infeasibility.py with various scenarios - Update documentation to reflect dual solver support in docstrings - Maintain backward compatibility with existing Gurobi-only code 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @FabianHofmann's task —— View job PR Review CompleteReview Todo List:
Code ReviewThis PR successfully extends IIS (Irreducible Infeasible Set) calculation to support Xpress solver alongside Gurobi. The implementation is well-structured and maintains backward compatibility. ✅ Strengths1. Type Safety and Python Best Practices:
2. Mathematical Correctness:
3. Performance Considerations:
4. Test Coverage:
|
- Extract IIS constraint extraction logic into separate helper method for better readability - Optimize memory usage by using constraint-to-index mapping instead of repeated list.index() calls - Add more detailed type annotations and documentation in _extract_iis_constraints method - Improve docstring clarity for compute_infeasibilities method - Add explanatory comments for constraint mapping edge cases Addresses feedback from automated code review focusing on: - Code organization and maintainability - Performance optimization for large models - Better type safety and documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add return type annotations to all test fixture methods (-> Model) - Add parameter and return type annotations to all test methods (-> None) - Fix mypy no-untyped-def errors for comprehensive type safety Resolves mypy type checking issues in the new test file while maintaining full test functionality and pytest compatibility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…orted solvers - Fix CI test failures by raising NotImplementedError instead of ValueError for unsupported solvers - Improve logic flow to check solver support first, then solver model availability - Add better test coverage for different error scenarios (unsolved models vs missing solver models) - Maintain backward compatibility for supported solvers (gurobi/xpress) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary
This PR extends the IIS (Irreducible Infeasible Set) calculation functionality in linopy to support the Xpress solver, in addition to the existing Gurobi support.
Changes
compute_infeasibilities()method: Now auto-detects solver type and routes to appropriate IIS implementation_compute_infeasibilities_xpress()method: Implements Xpress-specific IIS computation usingxpress.iisall()APIprint_infeasibilities()method: Now works with both Gurobi and Xpress solverstest_infeasibility.pyTechnical Implementation
iisall()method to compute all IIS in the modelgetiisdata()API to extract constraint information from each IISTest Plan
🤖 Generated with Claude Code