C interfaces
This page shows the C interface of HPR-LP with a minimal, task-oriented guide. Use the CLI to solve .mps files, or link your C/C++ program against libhprlp for programmatic access.
Usage
Solving from MPS Files
Use the prebuilt executable in build/. The default settings enable GPU, standard scalings, and a 3600-second time limit.
# Show help
./build/solve_mps_file -h
# Run with default settings
./build/solve_mps_file -i data/model.mps
# Run with custom settings
./build/solve_mps_file -i data/model.mps --tol 1e-4 --time-limit 3600
Using as a Library
Link against libhprlp.a (static) or libhprlp.so (shared) and include the public headers under include/.
See the examples/ directory for small, self-contained demos (C and C++) showing compilation flags and basic API calls.
For more details, check examples/c(cpp)/README.md on integrating HPR-LP-C into external projects (include paths, link order, and CUDA libs).
Command-Line Options
Option |
Description |
Default |
|---|---|---|
|
Path to input MPS file |
required |
|
CUDA device ID |
0 |
|
Maximum iterations |
unlimited |
|
Stopping tolerance |
1e-4 |
|
Time limit in seconds |
3600 |
|
Convergence check interval |
150 |
|
Ruiz scaling |
true |
|
Pock-Chambolle scaling |
true |
|
Bounds/cost scaling |
true |
|
Show help message |
- |
Tip: If the runtime can’t find
libhprlp.so, setLD_LIBRARY_PATH=$PWD/lib:$LD_LIBRARY_PATH(or install to a system path).
Language Interface Installation
Python (pip only):
cd HPR-LP-C/bindings/python
python -m pip install . # or: python -m pip install -e .
Julia Interface:
cd bindings/julia
bash install.sh
MATLAB Interface:
cd bindings/matlab
bash install.sh
See the respective README files in bindings/ for usage, version notes, and troubleshooting.
Language Interfaces
HPR-LP-C provides native interfaces for multiple languages:
Python: pybind11 bindings (see
bindings/python/README.md)MATLAB: MEX interface with OOP wrapper (see
bindings/matlab/README.md)Julia: Native Julia wrapper (see
bindings/julia/README.md)C/C++: Direct API usage (see
examples/c/andexamples/cpp/for minimal build/run demos)