Examples demonstrating FICO® Xpress integration with PyOptInterface.
| Example | Description | Notes |
|---|---|---|
| portfolio_pyoptinterface.py | Portfolio optimization with direct C++ bindings, callbacks, and advanced solver features | Part of the "Xpress Everywhere" blog series |
PyOptInterface provides direct C++ bindings to solver APIs, offering maximum performance and full access to solver-specific features. Unlike other modeling libraries that use file I/O or intermediate representations, PyOptInterface communicates directly with the solver's native C/C++ interface.
Key features:
- Direct C++ bindings - no file I/O overhead
- Full solver control - access to all solver parameters and features
- Callbacks - real-time progress monitoring and custom branching
- Advanced features - SOS constraints, warm starts, incremental solving
- High performance - minimal overhead between Python and solver
PyOptInterface supports both high-level algebraic syntax and low-level performance-oriented APIs:
quicksum()- clean, readable expressionsExprBuilder- efficient C-style API (4-5x faster for large models)
- Python 3.9+
- PyOptInterface:
pip install pyoptinterface - FICO Xpress:
pip install xpress - Valid Xpress license (Community Edition or full license)
cd xpress-3rdparty-interfaces/pyoptinterface
python portfolio_pyoptinterface.py