Needs a C++20 compiler, CMake 3.20+, Ninja, Python 3 and git. No CUDA, no internet after the clone: the Netlib instances are committed.
pacman -S --needed git mingw-w64-ucrt-x86_64-gcc \
mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja \
mingw-w64-ucrt-x86_64-python
Use the "MSYS2 UCRT64" shell for every command below. If the Microsoft Store owns python3 on your PATH, run the demo as PYTHON=python …; scripts/preflight.sh tells you.
sudo apt update && sudo apt install -y \
build-essential cmake ninja-build python3 git
GCC 10 or newer is required for C++20; Ubuntu 22.04 and later ship GCC 11+. This is what CI runs on, so it is the reference platform.
xcode-select --install
brew install cmake ninja python git
Apple clang 12+ is fine. OpenMP is optional; without it threads is ignored with a note in the log.
git clone https://github.com/thegoodengineers/SANKHYA
cd SANKHYA
scripts/configure.sh build Release
cmake --build build -j
ctest --test-dir build --output-on-failure
What you should see: the configure script names the compiler it picked (it checks the version rather than trusting PATH order), the build finishes with no warnings under -Wall -Wextra -Werror, and ctest reports 100% tests passed out of 731. Windows sometimes blocks a freshly linked binary through Smart App Control; scripts/preflight.sh names the fix.
Or skip straight to everything: scripts/reproduce.sh does the build, the tests, the Netlib benchmark with verification, the HiGHS comparison (if pip install highspy is present) and the PS26119 demo.
./build/sankhya info demo/crude_blend.mps
./build/sankhya solve demo/crude_blend.mps \
--write-sol blend.sol --stats blend.json --ranging
python tools/verify_solution.py demo/crude_blend.mps blend.sol
The solution file carries the objective, the point, every row's shadow price, cost and right-hand-side ranges, and, when the model has no plan, the certificate and the smallest conflicting set of constraints. The verifier re-derives all of it from the model file alone.
./build/sankhya solve model.mps.gz \
--option algorithm=ipm --option time_limit=60
./build/sankhya solve model.mps --progress-out live.jsonl
./build/sankhya options # every option, its default, why
Exit codes: 0 optimal · 1 a limit, or infeasible / unbounded proven · 3 unreadable file · 5 numerical or model error. Ctrl-C stops at the next safe point and returns the best point so far.
export PYTHONPATH=bindings/python
import sankhya
m = sankhya.Model(maximize=True)
x = m.add_column(cost=3.0, upper=3.0, name="x")
y = m.add_column(cost=2.0, name="y")
m.add_row({x: 1.0, y: 1.0}, upper=4.0)
m.add_row({x: 1.0, y: 3.0}, upper=6.0)
r = m.solve()
print(r.status, r.objective, r.x) # optimal 11.0 [3.0, 1.0]
m = sankhya.Model.read("data/netlib/afiro.mps")
r = m.solve(sankhya.Options(time_limit=30))
print(r.row_duals, r.primal_infeasibility)#include <sankhya/sankhya.h>
sankhya_model* m = sankhya_model_create();
sankhya_model_read(m, "model.mps");
sankhya_options* o = sankhya_options_create();
sankhya_options_set_double(o, "time_limit", 60.0);
sankhya_solution* s = NULL;
sankhya_solve(m, o, &s);
printf("%s %.10g\n", sankhya_solution_message(s),
sankhya_solution_objective(s));
sankhya_solution_free(s);
sankhya_options_free(o);
sankhya_model_free(m);The Python package is ctypes over the C API, so the shared library the build produces is the whole dependency. Callbacks arrive at most ten times a second and can stop the solve by returning non-zero.
demo/run_sih_demo.sh # full PS26119 walkthrough
demo/run_sih_demo.sh --quick
demo/run_demo.sh --list
demo/run_demo.sh share2b # solve, then verify
Walks the problem statement in its own order: blending LP with prices and ranges, the QP variant, the scheduling MILP corroborated by exhaustive enumeration, the three robustness hazards, Netlib with verification, the HiGHS comparison, and the list of what is not done. Every number it prints comes from a command it just ran.